mirror of
https://github.com/home-assistant/frontend.git
synced 2026-10-19 12:19:32 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c440976aa |
No files matched your search
@@ -1,106 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-components
|
||||
description: Home Assistant frontend component patterns. Use when implementing or reviewing dialogs, ha-form, ha-alert, keyboard shortcuts, tooltips, panels, Lovelace cards, or ha-button usage.
|
||||
---
|
||||
|
||||
# HA Frontend Components
|
||||
|
||||
Use this skill when creating or reviewing Home Assistant UI components and common interaction patterns.
|
||||
|
||||
Cross-load `ha-frontend-events` when component work includes event listener typing, custom event dispatch, or event-map declarations.
|
||||
|
||||
## Dialogs
|
||||
|
||||
Open dialogs through the fire-event pattern:
|
||||
|
||||
```ts
|
||||
fireEvent(this, "show-dialog", {
|
||||
dialogTag: "dialog-example",
|
||||
dialogImport: () => import("./dialog-example"),
|
||||
dialogParams: { title: "Example", data: someData },
|
||||
});
|
||||
```
|
||||
|
||||
Dialog implementation requirements:
|
||||
|
||||
- Use `ha-dialog`.
|
||||
- Use `DialogMixin`, which implements `HassDialogNext<T>`, for new dialogs. See `src/dialogs/dialog-mixin.ts`.
|
||||
- Read dialog parameters from the mixin's `params` property and render the dialog open. Return `nothing` while required parameters are absent.
|
||||
- Call the mixin's `closeDialog()` to close a new dialog. The mixin handles the `closed` event, fires `dialog-closed`, and removes the host element.
|
||||
- Existing dialogs may implement the legacy `HassDialog<T>` interface from `src/dialogs/make-dialog-manager.ts`.
|
||||
- Preserve the existing `showDialog()`, open-state, and close-event lifecycle when maintaining a legacy dialog; do not copy that lifecycle into a `DialogMixin` dialog.
|
||||
- Use `header-title` and `header-subtitle` for simple header text.
|
||||
- Use slots when standard header attributes are not enough.
|
||||
- Use `ha-dialog-footer` with `primaryAction` and `secondaryAction` slots.
|
||||
- Add `autofocus` to the first focusable element, such as `<ha-form autofocus>`, and forward it internally if needed.
|
||||
|
||||
Use standard dialog widths: `small`, `medium`, `large`, or `full`. Avoid custom dialog sizing unless there is a clear product need.
|
||||
|
||||
## Buttons
|
||||
|
||||
`ha-button` wraps the Web Awesome button in `src/components/ha-button.ts`.
|
||||
|
||||
Axes:
|
||||
|
||||
- `variant`: `brand`, `neutral`, `danger`, `warning`, `success`.
|
||||
- `appearance`: `accent`, `filled`, `outlined`, `plain`.
|
||||
- `size`: `xs`, `s`, `m`, `l`, `xl`.
|
||||
|
||||
Common usage:
|
||||
|
||||
- Use `appearance="filled"` for primary emphasis when needed.
|
||||
- Use `appearance="plain"` for cancel and dismiss actions.
|
||||
- Use `variant="danger"` for destructive actions.
|
||||
- Place primary actions in `slot="primaryAction"` and secondary actions in `slot="secondaryAction"`.
|
||||
|
||||
## Forms
|
||||
|
||||
`ha-form` is schema-driven with `HaFormSchema[]` and supports common selectors for entities, devices, areas, targets, numbers, booleans, time, actions, text, objects, selects, icons, media, and location.
|
||||
|
||||
Use `computeLabel`, `computeError`, and `computeHelper` for translated labels, validation, and helper text.
|
||||
|
||||
```ts
|
||||
<ha-form
|
||||
.hass=${this.hass}
|
||||
.data=${this._data}
|
||||
.schema=${this._schema}
|
||||
.error=${this._errors}
|
||||
.computeLabel=${(schema) => this._localize(`ui.panel.${schema.name}`)}
|
||||
@value-changed=${this._valueChanged}
|
||||
></ha-form>
|
||||
```
|
||||
|
||||
## Alerts
|
||||
|
||||
Use `ha-alert` for user-visible status messaging.
|
||||
|
||||
- Alert types: `error`, `warning`, `info`, `success`.
|
||||
- Useful properties: `title`, `alert-type`, `dismissable`, `narrow`.
|
||||
- Slots: `icon` for custom leading icon, `action` for custom action content.
|
||||
- Content is announced by screen readers when dynamically displayed.
|
||||
|
||||
```ts
|
||||
html`
|
||||
<ha-alert alert-type="error">${this._localize("ui.example.error")}</ha-alert>
|
||||
<ha-alert alert-type="warning" .title=${this._localize("ui.example.warning")}>
|
||||
${this._localize("ui.example.description")}
|
||||
</ha-alert>
|
||||
<ha-alert alert-type="success" dismissable>
|
||||
${this._localize("ui.example.success")}
|
||||
</ha-alert>
|
||||
`;
|
||||
```
|
||||
|
||||
## Shortcuts And Tooltips
|
||||
|
||||
Use `ShortcutManager` from `src/common/keyboard/shortcuts.ts` for keyboard shortcuts. It blocks shortcuts in input fields, can prevent shortcuts during text selection, and supports character and KeyCode shortcuts for non-latin keyboards. See `src/state/quick-bar-mixin.ts` for global shortcut examples.
|
||||
|
||||
Use `ha-tooltip` from `src/components/ha-tooltip.ts` for contextual hover help. See `src/components/ha-label.ts` for an example.
|
||||
|
||||
## Panels And Lovelace Cards
|
||||
|
||||
Panels commonly extend `SubscribeMixin(LitElement)` and receive route and narrow-layout properties.
|
||||
|
||||
Lovelace cards should implement `LovelaceCard`, validate config in `setConfig()`, handle loading, error, unavailable, and missing-entity states, and add a configuration editor when needed.
|
||||
|
||||
Cards are user-story surfaces. Support different households, entity types, responsive layouts, and accessible interaction states.
|
||||
@@ -1,97 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-contexts
|
||||
description: Home Assistant frontend Lit context and hass migration guidance. Use when adding or changing component state access, replacing hass reads, consuming entity or registry contexts, or reviewing rerender behavior.
|
||||
---
|
||||
|
||||
# HA Frontend Contexts
|
||||
|
||||
Use this skill when a component reads Home Assistant state, registries, localization, services, config, UI data, connection state, or API helpers.
|
||||
|
||||
## Goal
|
||||
|
||||
Move leaf components away from the broad `hass: HomeAssistant` object. Broad `hass` access rerenders components for unrelated changes, hides the data a component depends on, and makes tests harder to mock.
|
||||
|
||||
Container components may keep `hass` when they own it and feed providers. Leaf components should consume the narrowest context that covers their reads.
|
||||
|
||||
## Core Files
|
||||
|
||||
- Context definitions: `src/data/context/index.ts`
|
||||
- `consume` decorator, `ContextSubscriptionController`, and `consumeContext` / `ContextController` for reactive controllers: `src/common/decorators/consume.ts` (use instead of `@lit/context`'s `consume` and `ContextConsumer`, enforced by ESLint)
|
||||
- Entity-scoped consume helpers: `src/common/decorators/consume-context-entry.ts`
|
||||
- Transform decorator: `src/common/decorators/transform.ts`
|
||||
- Canonical migration example: `src/panels/lovelace/cards/hui-button-card.ts`
|
||||
- Providers are wired by `contextMixin` on `HassBaseEl`; consumers do not wire providers manually.
|
||||
|
||||
## Context Selection
|
||||
|
||||
| Context | Replaces |
|
||||
| -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
||||
| `statesContext` | `hass.states` |
|
||||
| `entitiesContext`, `devicesContext`, `areasContext`, `floorsContext` | `hass.entities`, `hass.devices`, `hass.areas`, `hass.floors` |
|
||||
| `registriesContext` | all four registries together |
|
||||
| `servicesContext` | `hass.services` |
|
||||
| `internationalizationContext` | `hass.localize`, `hass.locale`, `hass.language` |
|
||||
| `formattersContext` | entity and attribute formatters |
|
||||
| `configContext` | `hass.config`, `hass.user`, `hass.auth`, `hass.userData` |
|
||||
| `connectionContext` | `hass.connection`, `hass.connected`, `hass.debugConnection`, `hass.hassUrl` |
|
||||
| `apiContext` | `hass.callService`, `hass.callApi`, `hass.callApiRaw`, `hass.callWS`, `hass.sendWS`, `hass.fetchWithAuth` |
|
||||
| `uiContext` | themes, selected theme, panels, sidebar, and UI state |
|
||||
| `narrowViewportContext` | narrow-layout boolean |
|
||||
| `reducedMotionContext` | `prefers-reduced-motion` media query |
|
||||
|
||||
Lazy contexts subscribe on first consumer and tear down after the last consumer: `labelsContext`, `fullEntitiesContext`, `configEntriesContext`, `manifestsContext`, `triggerDescriptionsContext`, and `conditionDescriptionsContext`.
|
||||
|
||||
The single-field contexts such as `localizeContext`, `themesContext`, and `userContext` are deprecated. Use grouped contexts instead.
|
||||
|
||||
## Consumption Patterns
|
||||
|
||||
Import `consume` from `src/common/decorators/consume`, not from `@lit/context`. The `@lit/context` version forces a host update on every context change, so every consumed field rerenders the component, even without `@state()`, and `@transform` cannot skip anything. Our `consume` leaves update scheduling to the field:
|
||||
|
||||
- `@state()` plus `@consume`: rerenders when the context value changes.
|
||||
- `@state()` plus `@consume` plus `@transform`: rerenders only when the transformed value changes.
|
||||
- `@consume` alone: the field stays current but never triggers a render. Use this for values only read in event handlers or callbacks, such as `apiContext`, or for data read on demand, such as picker item callbacks.
|
||||
|
||||
In reactive controllers, extend `ContextController` and decorate fields with `consumeContext({ context, subscribe, transform })` from the same file. `transform` stores one part of the context value, and `contextUpdated()` runs only when that part changes. `@state()` and `@transform` do not work on controller fields; call `host.requestUpdate()` when the host needs to rerender. Example: `src/data/service-info-controller.ts`.
|
||||
|
||||
For lazily created subscriptions, use `ContextSubscriptionController` from the same file instead of `@lit/context`'s `ContextConsumer`, which also forces a host update. Its callback must store the value in a reactive field or call `host.requestUpdate()` itself when the host needs to rerender.
|
||||
|
||||
Use entity-scoped helpers when the component watches an entity ID held on the host:
|
||||
|
||||
```ts
|
||||
@state() @consumeEntityState({ entityIdPath: ["_config", "entity"] })
|
||||
private _stateObj?: HassEntity;
|
||||
|
||||
@state() @consumeEntityRegistryEntry({ entityIdPath: ["_config", "entity"] })
|
||||
private _entity?: EntityRegistryDisplayEntry;
|
||||
|
||||
@state() @consumeLocalize()
|
||||
private _localize!: LocalizeFunc;
|
||||
```
|
||||
|
||||
Use `consumeEntityStates` when the host property contains one or more entity IDs. It filters missing entities and preserves the previous record when none of the selected entities changed.
|
||||
|
||||
```ts
|
||||
@state() @consumeEntityStates({ entityIdPath: ["_config", "entities"] })
|
||||
private _stateObjs?: Record<string, HassEntity>;
|
||||
```
|
||||
|
||||
For a single field from a grouped context, pair `@consume` with `@transform`:
|
||||
|
||||
```ts
|
||||
@state()
|
||||
@consume({ context: uiContext, subscribe: true })
|
||||
@transform<HomeAssistantUI, Themes>({ transformer: ({ themes }) => themes })
|
||||
private _themes!: Themes;
|
||||
```
|
||||
|
||||
Use `@transform` with `watch` when the transformer depends on a host property, such as a computed entity ID. `consumeEntityState` and `consumeEntityStates` only watch the first path segment.
|
||||
|
||||
To consume a whole group untransformed, omit `@transform` and type the field as `ContextType<typeof statesContext>` or the matching context type.
|
||||
|
||||
## Review Checklist
|
||||
|
||||
- The component consumes the narrowest context needed for the data it reads.
|
||||
- A broad `hass` property is kept only when the component is a container or external API requires it.
|
||||
- Entity-scoped reads use the consume helpers rather than ad hoc context transforms.
|
||||
- Context fields read during render or `willUpdate` are marked `@state()` so updates trigger rendering. Fields only read outside the render cycle are left without `@state()`.
|
||||
- Tests and mocks only provide the data the component actually consumes.
|
||||
@@ -1,69 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-demo
|
||||
description: Home Assistant standalone demo structure, configurations, URL navigation, mocked APIs, shared demo stubs used by gallery, and verification. Use when changing files under demo/, changing gallery consumers of demo/src/stubs/, or running and validating the demo.
|
||||
---
|
||||
|
||||
# HA Frontend Demo
|
||||
|
||||
Use this skill for standalone demo work and changes to shared demo stubs consumed by the gallery. Follow the persistent repository guidance in `AGENTS.md` and load matching specialist skills alongside this skill, especially `ha-frontend-testing` when running or validating the demo.
|
||||
|
||||
## Purpose
|
||||
|
||||
The demo is the full Home Assistant frontend running against a mocked backend and is published at <https://demo.home-assistant.io>. It needs no Home Assistant server, which makes it the easiest way to load the real UI in a browser, for example to take screenshots.
|
||||
|
||||
## Running The Demo
|
||||
|
||||
Run commands from the repository root:
|
||||
|
||||
```bash
|
||||
pnpm dev:demo # Development server on http://localhost:8090
|
||||
pnpm dev:demo --background # Detached; also supports --status/--stop/--logs
|
||||
```
|
||||
|
||||
Use the E2E workflows documented in `ha-frontend-testing` when validating the demo.
|
||||
|
||||
## Opening A Specific Demo
|
||||
|
||||
The demo contains multiple demo configurations. Select one directly with the `demo` query parameter, for example `http://localhost:8090/?demo=<slug>`. The valid slugs are defined in `demoConfigs` in `demo/src/configs/demo-configs.ts`, so "the second demo" means the slug of the second entry in that list. An unknown slug falls back to the default, which is the first entry.
|
||||
|
||||
## Opening A Specific Page
|
||||
|
||||
The demo build uses hash-based routing: the frontend path goes in the URL hash, and the `demo` query parameter goes before the `#`. The URL format is:
|
||||
|
||||
```text
|
||||
http://localhost:8090/?demo=<slug>#/<path>
|
||||
```
|
||||
|
||||
Useful paths:
|
||||
|
||||
- `/lovelace/0`: The selected demo's dashboard, also the default when no hash is given.
|
||||
- `/energy`: The energy dashboard. Its tabs are views: `/energy/overview` (Summary), `/energy/electricity`, `/energy/gas`, `/energy/water`, and `/energy/now`.
|
||||
- `/map`, `/history`, `/todo`, `/config`: Other sidebar panels.
|
||||
|
||||
For example, the water tab of the energy dashboard of the second demo is:
|
||||
|
||||
```text
|
||||
http://localhost:8090/?demo=<second slug>#/energy/water
|
||||
```
|
||||
|
||||
## Structure
|
||||
|
||||
- `demo/src/ha-demo.ts`: Root element that sets up all backend mocks.
|
||||
- `demo/src/configs/<slug>/`: One directory per demo configuration, containing entities, dashboard, and theme data.
|
||||
- `demo/src/configs/demo-configs.ts`: Registry of demo configurations and URL slug handling.
|
||||
- `demo/src/stubs/`: Mocked WebSocket and REST APIs.
|
||||
- `demo/script/develop_demo`, `demo/script/build_demo`: Development server and static build wrappers.
|
||||
|
||||
## Core Data
|
||||
|
||||
The service descriptions in `src/fake_data/demo_services.ts` and the trigger and condition descriptions and icons in `demo/src/stubs/automation_platforms_*.ts` are generated from Home Assistant Core. Do not edit them by hand. Run `script/gen_demo_core_data` to regenerate them from the core `dev` branch, and add a domain to the lists in `build-scripts/gulp/gen-demo-core-data.js` when the demo needs its services, triggers, or conditions. Their translations come from the backend translations merged into the demo build.
|
||||
|
||||
## Shared Gallery Stubs
|
||||
|
||||
`demo/src/stubs/` is shared, not demo-private: gallery pages import from it directly. Before changing or removing anything a stub does, search for its callers across `demo/src/` and `gallery/src/`, then check the affected gallery pages as well as the demo.
|
||||
|
||||
The two consumers use a stub differently, so demo behavior does not predict gallery behavior. A gallery page calls stubs against the `hass` from `provideHass`, where `hass.config` is the shared `demoConfig` object. A stub that mutates `hass.config` in place is therefore visible to the page. `demo/src/ha-demo.ts` copies `components` into a new array before the stubs run, so the same mutation never reaches the demo. A change can look correct in the demo while quietly breaking a gallery page.
|
||||
|
||||
## Verification
|
||||
|
||||
Load `ha-frontend-testing` and use its demo and gallery workflows. Validate both consumers when changing shared stubs. Documentation-only changes do not require code tests unless examples or commands change.
|
||||
@@ -1,105 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-events
|
||||
description: Home Assistant frontend event patterns. Use when typing event handlers, using HASSDomEvent types, dispatching with fireEvent, or declaring HASSDomEvents and event maps.
|
||||
---
|
||||
|
||||
# HA Frontend Events
|
||||
|
||||
Use this skill when implementing or reviewing event listeners and custom event contracts. Cross-load `ha-frontend-components` when the work also involves dialogs, forms, alerts, shortcuts, tooltips, panels, Lovelace cards, or buttons.
|
||||
|
||||
## Event Handling
|
||||
|
||||
Use the event types from `src/common/dom/fire_event.ts` instead of plain `Event`, generic `CustomEvent`, or element casts when they express the handler contract:
|
||||
|
||||
- Use `HASSDomCurrentTargetEvent<T>` to read the element on which the listener was registered through `ev.currentTarget`.
|
||||
- Use `HASSDomTargetEvent<T>` only to read the element that originated the event through `ev.target`.
|
||||
- Use `HASSDomEvent<T>` to read a custom event payload through `ev.detail`.
|
||||
- Use `ValueChangedEvent<T>` from `src/types.ts` for the standard `value-changed` event.
|
||||
- Prefer an event type exported by the component being listened to, such as `HaSelectSelectEvent<T, Clearable>` or `HaDropdownSelectEvent<TValue, TData>`, over reconstructing its detail type.
|
||||
- Use `ActionHandlerEvent` from `src/data/lovelace/action_handler.ts` for Lovelace tap, hold, and double-tap handlers.
|
||||
|
||||
Import event and element types with `import type`:
|
||||
|
||||
```ts
|
||||
import type {
|
||||
HASSDomCurrentTargetEvent,
|
||||
HASSDomEvent,
|
||||
HASSDomTargetEvent,
|
||||
} from "../common/dom/fire_event";
|
||||
import type { HaCheckbox } from "../components/ha-checkbox";
|
||||
import type { HaEntityPicker } from "../components/entity/ha-entity-picker";
|
||||
import type { HaRadioGroup } from "../components/radio/ha-radio-group";
|
||||
import type { ValueChangedEvent } from "../types";
|
||||
```
|
||||
|
||||
Type the handler so the selected property can be read directly. Do not cast `ev.currentTarget` or assign it to a single-use variable:
|
||||
|
||||
```ts
|
||||
private _scopeChanged(ev: HASSDomCurrentTargetEvent<HaRadioGroup>): void {
|
||||
this._scope = ev.currentTarget.value;
|
||||
}
|
||||
|
||||
private _checkedChanged(ev: HASSDomTargetEvent<HaCheckbox>): void {
|
||||
this._checked = ev.target.checked;
|
||||
}
|
||||
|
||||
private _valueChanged(ev: ValueChangedEvent<string>): void {
|
||||
this._value = ev.detail.value;
|
||||
}
|
||||
|
||||
private _itemSelected(ev: HASSDomEvent<{ id: string }>): void {
|
||||
this._selectedId = ev.detail.id;
|
||||
}
|
||||
```
|
||||
|
||||
Use intersections when a handler needs more than one facet of an event. Keep the native event type when the handler reads native fields such as `key`, modifier keys, `dataTransfer`, or focus relationships:
|
||||
|
||||
```ts
|
||||
private _entityChanged(
|
||||
ev: ValueChangedEvent<string> & HASSDomCurrentTargetEvent<HaEntityPicker>
|
||||
): void {
|
||||
ev.currentTarget.value = ev.detail.value;
|
||||
}
|
||||
|
||||
private _keyDown(
|
||||
ev: KeyboardEvent & HASSDomCurrentTargetEvent<HTMLInputElement>
|
||||
): void {
|
||||
if (ev.key === "Enter") {
|
||||
this._submit(ev.currentTarget.value);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Dispatch Home Assistant component events with `fireEvent()` instead of constructing `Event` or `CustomEvent` directly. Register the event name and detail type by augmenting `HASSDomEvents`; use `undefined` when an event has no detail. `fireEvent()` constrains event names and supplied detail, and events bubble and cross shadow boundaries by default:
|
||||
|
||||
```ts
|
||||
fireEvent(this, "item-selected", { id: item.id });
|
||||
fireEvent(this, "refresh-requested");
|
||||
```
|
||||
|
||||
When an event is already registered, derive handler and listener types from its registration rather than repeating the payload shape:
|
||||
|
||||
```ts
|
||||
private _itemSelected(
|
||||
ev: HASSDomEvent<HASSDomEvents["item-selected"]>
|
||||
): void {
|
||||
this._selectedId = ev.detail.id;
|
||||
}
|
||||
```
|
||||
|
||||
`HASSDomEvents` types `fireEvent()` calls. Augment `HTMLElementEventMap` for typed listeners on HTML elements, or `GlobalEventHandlersEventMap` when the event is handled on global event targets.
|
||||
|
||||
In component files, prefer placing global event declarations after the class at the bottom of the file. Preserve the existing placement when editing established files; foundational type, helper, and mixin files commonly keep declarations near the top before their consumers.
|
||||
|
||||
```ts
|
||||
declare global {
|
||||
interface HASSDomEvents {
|
||||
"item-selected": { id: string };
|
||||
"refresh-requested": undefined;
|
||||
}
|
||||
|
||||
interface HTMLElementEventMap {
|
||||
"item-selected": HASSDomEvent<HASSDomEvents["item-selected"]>;
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,128 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-gallery
|
||||
description: Home Assistant frontend gallery structure, pages, demos, content, and verification. Use when changing files under gallery/, including gallery markdown, TypeScript demos, sidebar entries, mock data, page generation, or gallery builds.
|
||||
---
|
||||
|
||||
# HA Frontend Gallery
|
||||
|
||||
Use this skill for all work under `gallery/`. Follow the persistent repository guidance in `AGENTS.md` and load the matching specialist skills alongside this gallery-specific guidance.
|
||||
|
||||
## Quick Reference
|
||||
|
||||
Run commands from the repository root unless noted otherwise:
|
||||
|
||||
```bash
|
||||
gallery/script/develop_gallery # Start the gallery development server
|
||||
gallery/script/build_gallery # Build the static gallery
|
||||
pnpm lint # ESLint, Prettier, TypeScript, and Lit checks
|
||||
pnpm lint:types # TypeScript compiler, without file arguments
|
||||
```
|
||||
|
||||
Never run `pnpm lint:types` or `tsc` with file arguments. File arguments make `tsc` ignore `tsconfig.json` and can emit `.js` files into `src/`.
|
||||
|
||||
## Purpose
|
||||
|
||||
The gallery is a developer and designer reference for Home Assistant frontend UI patterns. It documents component APIs, shows realistic Lovelace and more-info states, captures brand and copy guidance, and provides reproducible demos that are safe to inspect outside a running Home Assistant instance.
|
||||
|
||||
- Prefer demonstrating real production components from `src/` instead of creating gallery-only replacements.
|
||||
- Keep fake state, sample data, and demo-only helpers inside `gallery/`.
|
||||
- Do not move gallery stubs or demo data into production code unless a production feature explicitly needs them.
|
||||
- Do not hand-edit generated output under `gallery/build/` or `gallery/dist/`.
|
||||
|
||||
## Structure
|
||||
|
||||
- `gallery/sidebar.js`: Defines gallery sections, headers, and explicit page ordering.
|
||||
- `gallery/script/develop_gallery`: Wrapper for the `develop-gallery` gulp task.
|
||||
- `gallery/script/build_gallery`: Wrapper for the `build-gallery` gulp task.
|
||||
- `gallery/src/entrypoint.js`: Creates the `<ha-gallery>` shell.
|
||||
- `gallery/src/ha-gallery.ts`: Renders the drawer, page routing, markdown descriptions, demos, edit links, and RTL toggle.
|
||||
- `gallery/src/html/index.html.template`: HTML template used by the gallery build.
|
||||
- `gallery/src/pages/<category>/<page>.markdown`: Optional page description and frontmatter.
|
||||
- `gallery/src/pages/<category>/<page>.ts`: Optional live demo module for the same page ID.
|
||||
- `gallery/src/components/`: Gallery-only demo wrappers like `demo-card`, `demo-cards`, `demo-more-info`, and `page-description`.
|
||||
- `gallery/src/data/`: Fake `hass`, demo states, mock traces, and reusable sample data.
|
||||
- `gallery/public/`: Static assets copied into the gallery output.
|
||||
|
||||
## Page Model
|
||||
|
||||
Gallery pages are generated by `gather-gallery-pages` in `build-scripts/gulp/gallery.js`.
|
||||
|
||||
- A page ID is the path under `gallery/src/pages/` without the extension, like `components/ha-button`.
|
||||
- A `.markdown` file and a `.ts` file with the same page ID become one gallery page.
|
||||
- A page may have only markdown, only a TypeScript demo, or both.
|
||||
- Markdown can contain YAML frontmatter with `title` and optional `subtitle`.
|
||||
- Markdown that contains only frontmatter contributes metadata without rendering a description block.
|
||||
- TypeScript demo modules are dynamically imported for side effects when the page is opened.
|
||||
- A demo module must define a custom element named `demo-${category}-${page}` with slashes replaced by hyphens, like `demo-components-ha-button` for `components/ha-button`.
|
||||
- `gallery/src/ha-gallery.ts` renders that element with `dynamicElement()` based on the current page ID.
|
||||
|
||||
## Sidebar
|
||||
|
||||
Use `gallery/sidebar.js` when a page needs a visible section, section header, or deterministic ordering.
|
||||
|
||||
- `category` must match the first directory name under `gallery/src/pages/`.
|
||||
- `header` is the section label shown in the drawer.
|
||||
- `pages` is optional. When present, listed pages keep that exact order.
|
||||
- Pages in a category that are not listed are appended alphabetically after the listed pages.
|
||||
- New categories without a sidebar entry are appended by the generator with their category name as the header.
|
||||
- If a listed page does not exist, the generator logs an error during `gather-gallery-pages`.
|
||||
|
||||
### Subsections
|
||||
|
||||
A section can group its pages under named subsections instead of one flat list. Use this for large categories where related pages should sit together.
|
||||
|
||||
- `subsections` is an array of `{ header, pages }`. It is mutually exclusive with a flat `pages` array on the same group.
|
||||
- Each subsection `header` is a non-collapsible label rendered inside the section's expansion panel; the section stays the only collapsible level.
|
||||
- Listed pages keep their per-subsection order.
|
||||
- Any pages found in the category but not listed in a subsection are collected into a generated `Other` subsection, appended alphabetically. The `Other` subsection is omitted when there are no leftovers.
|
||||
- A listed page that does not exist still logs an error during `gather-gallery-pages`.
|
||||
- Use sentence case for subsection headers and follow the content standards below.
|
||||
|
||||
## Markdown Pages
|
||||
|
||||
Use markdown pages for explanations, design guidance, API notes, and copy standards.
|
||||
|
||||
- Start with frontmatter when the page needs a title or subtitle.
|
||||
- Use sentence case for titles, headings, labels, and UI copy.
|
||||
- Put the live example before the reference API when that makes the page easier to scan.
|
||||
- Use fenced code blocks with a language tag for copyable examples.
|
||||
- Keep examples short and focused on the behavior being documented.
|
||||
- Prefer real component names and attributes over prose-only descriptions.
|
||||
- Use Home Assistant terminology from `ha-frontend-user-facing-text`.
|
||||
- For remove/delete and add/create wording, follow `gallery/src/pages/misc/remove-delete-add-create.markdown`.
|
||||
|
||||
Gallery markdown is documentation content and is not localized with `localize`. If demo code creates production UI strings, follow the localization and copy guidance in `ha-frontend-user-facing-text`.
|
||||
|
||||
## Demo Components
|
||||
|
||||
Use TypeScript demo pages for interactive or stateful examples.
|
||||
|
||||
- Import production components from `src/` using the correct relative path from the demo file.
|
||||
- Import reusable gallery helpers from `gallery/src/components/` when they already model the pattern.
|
||||
- Use `demo-card` and `demo-cards` for Lovelace card examples that render YAML card configs.
|
||||
- Use `demo-more-info` and `demo-more-infos` for more-info dialog examples.
|
||||
- Use shared mock data from `gallery/src/data/` instead of repeating large fake state objects inline.
|
||||
- Show meaningful states, such as loading, unavailable, empty, error, active, inactive, and disabled when relevant.
|
||||
- Check responsive behavior and the gallery RTL toggle when layout or direction-sensitive UI changes.
|
||||
- Keep unavoidable casts or loose demo parsing local to the demo helper or demo page.
|
||||
|
||||
The gallery ESLint config allows `console` for gallery diagnostics. Do not copy that exception into production frontend code.
|
||||
|
||||
## Content Standards
|
||||
|
||||
Follow the detailed copy standards in `ha-frontend-user-facing-text`: use American English, sentence case, active voice, inclusive language, direct user-focused wording, and consistent Home Assistant terminology.
|
||||
|
||||
- Use `Home Assistant` in full, not `HA` or `HASS`.
|
||||
- Use `integration` instead of `component` for product concepts.
|
||||
- Use `Remove` for reversible disassociation and `Delete` for permanent deletion.
|
||||
- Use `Add` for existing items and `Create` for something made from scratch.
|
||||
- Avoid Latin abbreviations like `e.g.` and `i.e.` in prose.
|
||||
- Avoid stitching sentence fragments together in production UI examples.
|
||||
|
||||
## Verification
|
||||
|
||||
- For markdown, sidebar, and page-generation changes, run `gallery/script/build_gallery`.
|
||||
- For TypeScript demo or gallery shell changes, run the smallest relevant check plus `pnpm lint` when practical.
|
||||
- For type checking, run `pnpm lint:types` without file arguments.
|
||||
- For visual changes, run `gallery/script/develop_gallery` and check the affected page on desktop, narrow viewport, and RTL when relevant.
|
||||
- If verification is skipped, state which command was skipped and why.
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-lit
|
||||
description: Home Assistant frontend Lit conventions. Use when working with reactive properties, internal state, DOM queries, lifecycle methods, or render-derived state.
|
||||
---
|
||||
|
||||
# HA Frontend Lit
|
||||
|
||||
Use this skill when implementing or reviewing Lit component state, DOM access, lifecycle methods, or rendering behavior. Cross-load `ha-frontend-types` for Home Assistant data contracts, assertions, and lifecycle parameter types.
|
||||
|
||||
## Reactive Fields
|
||||
|
||||
This project currently uses Lit's TypeScript experimental decorators with `useDefineForClassFields: false`. Match existing declarations and do not introduce standard-decorator `accessor` syntax unless the project changes decorator mode.
|
||||
|
||||
- Use `@property()` for public reactive API and `@state()` for private reactive state.
|
||||
- Prefer inferred types for initialized reactive fields when inference preserves the intended type; annotate when widening or an external contract requires it.
|
||||
|
||||
## DOM Queries
|
||||
|
||||
Prefer Lit's `@query()` or `@queryAll()` decorators for fixed selectors in the component's render root.
|
||||
|
||||
- Type the decorated field with the narrowest useful DOM or component interface.
|
||||
- Keep the field optional when it may be absent at the point of access, including conditional rendering or pre-render lifecycle access.
|
||||
- Use a definite assignment assertion only when every call site runs after the node is guaranteed to exist.
|
||||
- The optional second argument to `@query()`, as in `@query("#target", true)`, caches the first query result. Use it only when later renders cannot replace the queried node.
|
||||
- Use a direct query when the selector is dynamic or the target is outside the component's render root. Before querying a child, consider whether the required value belongs in parent state or data flow.
|
||||
|
||||
## Render-Derived State
|
||||
|
||||
- Prefer render-local values for inexpensive structures used only by that render.
|
||||
- Assign a render-local value once when repeated evaluation is non-trivial or a local name improves clarity.
|
||||
- Keep purely presentational derivations in `render()`. Use stored state or `willUpdate()` when the value must participate in lifecycle work, reflection, CSS, or non-render consumers.
|
||||
- Use `memoizeOne` for pure, argument-derived transforms when stable input identity avoids meaningful repeated work. Keep inputs explicit and limited, and do not add caching without a credible benefit over computing the value directly.
|
||||
|
||||
## References
|
||||
|
||||
- [Reactive properties](https://lit.dev/docs/components/properties/)
|
||||
- [Decorators](https://lit.dev/docs/components/decorators/)
|
||||
- [Shadow DOM queries](https://lit.dev/docs/components/shadow-dom/#query)
|
||||
- [Reactive update cycle](https://lit.dev/docs/components/lifecycle/)
|
||||
@@ -1,127 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-review
|
||||
description: Home Assistant frontend PR and review guidance, including implementation quality, existing review feedback, established design patterns, and the authority of UI/UX evidence. Use when reviewing frontend changes, preparing a PR, checking recurring review issues, or applying the PR template.
|
||||
---
|
||||
|
||||
# HA Frontend Review
|
||||
|
||||
Use this skill when reviewing Home Assistant frontend changes or preparing a pull request.
|
||||
|
||||
## Review Preparation
|
||||
|
||||
1. Establish the review scope from the diff and the behavior changed by it.
|
||||
2. Before identifying findings, use the [project skill catalogue](../../../AGENTS.md#project-skills) to load every matching companion's `SKILL.md`. Follow applicable companion references in those skills as well; this review skill supplies the workflow, and companions supply the domain-specific criteria.
|
||||
3. Apply all loaded guidance within that scope. Report only problems introduced or worsened by the changeset, anchored to changed lines. Read surrounding code to understand affected behavior, not to generate unrelated cleanup or migration requests.
|
||||
|
||||
## Pull Request Body
|
||||
|
||||
When creating a pull request, use `.github/PULL_REQUEST_TEMPLATE.md` as the body.
|
||||
|
||||
- Do not omit, reorder, or rewrite template sections.
|
||||
- Check the appropriate "Type of change" box based on the actual change.
|
||||
- Do not check checklist items on behalf of the user.
|
||||
- If the PR includes UI changes, remind the user to add screenshots or a short video.
|
||||
- Explain what the change does for users, not only implementation details.
|
||||
- Use Markdown.
|
||||
|
||||
## Pre-Submission Checklist
|
||||
|
||||
- `pnpm lint` passes when practical for the scope.
|
||||
- `pnpm test` or focused relevant tests are green when practical for the scope.
|
||||
- Each test added by the change protects real logic, not the look of a component.
|
||||
- User-facing text is localized and follows `ha-frontend-user-facing-text` guidance.
|
||||
- Components handle loading, error, unavailable, and missing-entity states.
|
||||
- Entity existence is checked before property access.
|
||||
- Event listeners and subscriptions are cleaned up.
|
||||
- UI is accessible to screen readers and keyboard users.
|
||||
|
||||
## Recurring Review Issues
|
||||
|
||||
Scope and public surface:
|
||||
|
||||
- Keep changes independently reviewable and limited to the requested area.
|
||||
- Prefer existing Home Assistant helpers, Lit primitives, and component seams over parallel implementations.
|
||||
- Challenge new public properties and optional feature surface when transient options or existing seams meet the requirement with less lifecycle and consistency cost.
|
||||
|
||||
Stateful and asynchronous UI:
|
||||
|
||||
- Review transitions in both directions, not only individual rendered states.
|
||||
- When controls reappear, restore valid defaults instead of retaining state that was only valid while they were hidden.
|
||||
- Establish immutable dirty-state baselines before asynchronous work, guard against stale responses, and preserve unsaved state in mounted editors.
|
||||
- Determine an action's current meaning before applying dirty-state checks, especially when an action can change between Save and Close.
|
||||
|
||||
Readiness and invalidation:
|
||||
|
||||
- Treat readiness as the first displayable terminal result, including stable empty and error states.
|
||||
- Register child readiness before resolving the parent, do not treat fallback work as terminal, and replay readiness correctly for cached or reused panels.
|
||||
- Ensure every value read by memoized output participates in its invalidation.
|
||||
|
||||
Repository-owned contracts:
|
||||
|
||||
- Consult the public [frontend developer documentation](https://developers.home-assistant.io/docs/frontend/) for documented architecture, data flow, design, and development workflows.
|
||||
- For new leaf components, load `ha-frontend-contexts` and verify they consume narrow contexts instead of introducing a broad `hass` property; containers and external APIs may still require `hass`.
|
||||
- Verify backend assumptions against the owning Core, Supervisor, or WebSocket implementation, and component assumptions against the exported component contract.
|
||||
- Prefer canonical repository helpers and test setup over duplicate local implementations.
|
||||
- Promote AI-review concerns into durable guidance only when supported by code evidence, reproduced behavior, an accepted corrective commit, or human-maintainer validation.
|
||||
|
||||
User experience and accessibility:
|
||||
|
||||
- Forms need proper labels, helper text, and validation feedback.
|
||||
- Form markup should not cause password managers to identify fields incorrectly.
|
||||
- Clickable areas should be large enough for touch interaction.
|
||||
- Hover, active, disabled, loading, and focus states should be clear.
|
||||
|
||||
Dialog and modal patterns:
|
||||
|
||||
- Multi-step operations should show progress.
|
||||
- Dialog state should survive background operations correctly.
|
||||
- Cancel and close buttons should behave consistently.
|
||||
- Defaults should be helpful without blocking user override.
|
||||
|
||||
Component design patterns:
|
||||
|
||||
- Terminology should be consistent. Use words like "Join" or "Apply" instead of "Group" when that better matches the user action.
|
||||
- Visual hierarchy should use appropriate font sizes, weights, and spacing ratios.
|
||||
- Components should align to the design grid.
|
||||
- Badges and indicators should be placed consistently.
|
||||
|
||||
Code quality:
|
||||
|
||||
- Null and undefined paths should be handled explicitly.
|
||||
- Potentially undefined array and object access should be guarded.
|
||||
- Event handlers, timers, observers, and subscriptions should be cleaned up.
|
||||
|
||||
Configuration and props:
|
||||
|
||||
- Make configuration fields optional when sensible.
|
||||
- Provide reasonable defaults.
|
||||
- Keep APIs extensible without adding speculative abstractions.
|
||||
- Validate configuration before applying changes.
|
||||
|
||||
## UI/UX Evidence
|
||||
|
||||
For user-facing changes, establish the existing design context as part of frontend review:
|
||||
|
||||
- Treat an applicable gallery specification as the authoritative repository source for the documented component or interaction. Inspect its written guidance and demos when present.
|
||||
- Note relevant production designs, approved designs, and shared `ha-*` components so the implementation can also be compared with established frontend behaviour.
|
||||
- Require the applicable gallery documentation or demo to change when the implementation intentionally changes behaviour documented there.
|
||||
- Prefer an established input layout or appropriate shared component over a raw input or ad hoc control.
|
||||
- Treat explicit UI/UX approval, current repository guidance, and direct human or workflow instructions as stronger evidence than inference.
|
||||
- Treat linked tasks as evidence of the problem and stated requirements, not automatic UI/UX approval.
|
||||
- When the direction remains uncertain, search frontend pull requests that carry or previously carried **Needs UX**. Inspect their label history, comments, and reviews rather than relying on the current label alone.
|
||||
- Judge relevant feedback by its content and surrounding discussion. When GitHub provides `author_association`, prioritise feedback marked `MEMBER`.
|
||||
- Prefer recent feedback about similar interactions or components. Label removal can show that a workflow gate moved on, but does not prove approval without the surrounding discussion.
|
||||
- Summarise the applicable guidance instead of maintaining a reviewer list or treating one historical decision as a permanent rule.
|
||||
|
||||
## Review Flow
|
||||
|
||||
- Before reviewing a pull request, read its existing comments, reviews, and threads, including their status, resolver, and Copilot resolution reason when available.
|
||||
- Prioritise substantive human feedback, especially from authors marked `MEMBER`, and validate agent-generated feedback against the code and repository guidance.
|
||||
- Do not duplicate unresolved findings as new inline comments; reference any that still need action in the review summary. Treat resolved feedback as closed only when the resolution reason or surrounding discussion supports that outcome; otherwise validate it against the current code before suppressing it. Respect **Won't fix** and **Incorrect** reasons.
|
||||
- When a later commit addresses an unresolved thread, note in the review summary that it looks addressed, linking the thread and the commit, so it can be resolved. Do not report it as still open.
|
||||
- Identify behavioral regressions, bugs, accessibility issues, and missing tests that `ha-frontend-testing` calls for first.
|
||||
- Do not ask for new tests on visual components. If the visuals clearly changed and the PR has no screenshots or videos, suggest adding them instead.
|
||||
- When the change adds something repository guidance rules out, such as a rendering test, open the comment with the removal ("Remove this test file") and cite the guidance in one sentence. Do not critique how the unwanted code is written, as that reads as a request to fix it.
|
||||
- Record the applicable UI/UX evidence for user-facing changes, whether or not further input is needed.
|
||||
- Keep style-only comments secondary unless they affect maintainability or user experience.
|
||||
- Prefer small, direct fixes over large refactors during review follow-up.
|
||||
@@ -1,78 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-styling
|
||||
description: Home Assistant frontend styling, theming, spacing, responsive layout, RTL, and View Transitions guidance. Use when editing CSS, layout, motion, or visual component structure.
|
||||
---
|
||||
|
||||
# HA Frontend Styling
|
||||
|
||||
Use this skill when editing CSS, layout, visual hierarchy, theme integration, responsive behavior, RTL support, or view transitions.
|
||||
|
||||
## Theme And Layout Basics
|
||||
|
||||
- Use Home Assistant CSS custom properties instead of hardcoded colors.
|
||||
- Use `--ha-space-*` spacing tokens instead of hardcoded spacing where possible.
|
||||
- Keep components mobile-first and enhance for desktop.
|
||||
- Keep layouts RTL-safe. Prefer logical properties when they fit.
|
||||
- Prefer `ha-*` components and current Web Awesome wrappers.
|
||||
- Avoid adding new legacy Material Web Components (`mwc-*`).
|
||||
- Scope styles to the component. Do not rely on global styles for component internals.
|
||||
|
||||
Spacing tokens are defined in `src/resources/theme/core.globals.ts`. The scale runs from `--ha-space-1` at 4px through `--ha-space-20` at 80px in 4px increments. Common values are `--ha-space-2` at 8px, `--ha-space-4` at 16px, and `--ha-space-8` at 32px.
|
||||
|
||||
```ts
|
||||
static get styles() {
|
||||
return css`
|
||||
:host {
|
||||
padding: var(--ha-space-4);
|
||||
color: var(--primary-text-color);
|
||||
background-color: var(--card-background-color);
|
||||
}
|
||||
|
||||
.content {
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
:host {
|
||||
padding: var(--ha-space-2);
|
||||
}
|
||||
}
|
||||
`;
|
||||
}
|
||||
```
|
||||
|
||||
## Interaction States
|
||||
|
||||
- Make touch targets large enough for mobile.
|
||||
- Provide clear hover, active, focus, disabled, loading, error, and unavailable states.
|
||||
- Preserve keyboard navigation and visible focus indicators.
|
||||
- Maintain WCAG AA contrast for text and essential UI affordances.
|
||||
|
||||
## View Transitions
|
||||
|
||||
Use the View Transitions API only for meaningful continuity between DOM states.
|
||||
|
||||
Core resources:
|
||||
|
||||
- Utility wrapper: `src/common/util/view-transition.ts`, `withViewTransition()`.
|
||||
- Launch-screen fade example: `src/util/launch-screen.ts`.
|
||||
- Animation keyframes: `src/resources/theme/animations.globals.ts`.
|
||||
- Animation duration tokens: `src/resources/theme/core.globals.ts`.
|
||||
|
||||
Implementation rules:
|
||||
|
||||
- Use `withViewTransition()` for fallback behavior.
|
||||
- Keep transitions simple. Subtle fades and crossfades usually work best.
|
||||
- Use `--ha-animation-duration-fast`, `--ha-animation-duration-normal`, or `--ha-animation-duration-slow` for timing.
|
||||
- Ensure each `view-transition-name` is unique at any given time.
|
||||
- Remember only one view transition can run at a time.
|
||||
- View transitions operate at document level and do not work inside Shadow DOM style isolation. For web components, set `view-transition-name` on `:host` or use document-level transitions.
|
||||
- The root gets `view-transition-name: root` by default. Target `::view-transition-group(root)` to customize the default page transition.
|
||||
|
||||
## Review Checklist
|
||||
|
||||
- Styling uses theme variables and spacing tokens where practical.
|
||||
- Layout is mobile-first and RTL-safe.
|
||||
- Component styles are scoped.
|
||||
- Interactive states are clear and accessible.
|
||||
- Motion is subtle, tokenized, and respects reduced-motion behavior through existing globals.
|
||||
@@ -1,100 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-testing
|
||||
description: Home Assistant frontend testing and validation workflow. Use when adding or updating tests, running lint, TypeScript checks, Vitest, Playwright e2e suites, dev servers, or chart-data benchmarks.
|
||||
---
|
||||
|
||||
# HA Frontend Testing
|
||||
|
||||
Use this skill when choosing or running validation for frontend changes.
|
||||
|
||||
## Test Helpers
|
||||
|
||||
- Before adding or changing tests, inspect the relevant suite's existing helpers and fixtures. Reuse them instead of duplicating setup, test data, navigation, interactions, waits, or assertions.
|
||||
- When the same test flow appears more than once, move it into the closest suite-local helper with a focused interface.
|
||||
- Keep one-off test behaviour in the test unless a helper makes the intent materially clearer. Do not hide the behaviour under test behind broad, configurable abstractions.
|
||||
|
||||
## Core Commands
|
||||
|
||||
```bash
|
||||
pnpm lint # ESLint + Prettier + TypeScript + Lit
|
||||
pnpm format # Auto-fix ESLint + Prettier
|
||||
pnpm lint:types # TypeScript compiler, run without file arguments
|
||||
pnpm test # Vitest
|
||||
pnpm build # Full production build
|
||||
pnpm dev # App dev server
|
||||
pnpm dev:serve # Local serving dev server
|
||||
```
|
||||
|
||||
Never run `tsc` or `pnpm lint:types` with file arguments. File arguments make `tsc` ignore `tsconfig.json` and can emit `.js` files into `src/`.
|
||||
|
||||
For focused type feedback on one file, use editor diagnostics instead of a file-scoped `tsc` command.
|
||||
|
||||
## Production Builds
|
||||
|
||||
Production builds support foreground and managed background execution:
|
||||
|
||||
```bash
|
||||
pnpm build # Full foreground build
|
||||
pnpm build --background # Full managed background build
|
||||
pnpm build --modern # Modern frontend_latest bundle only
|
||||
pnpm build --modern --background # Modern managed background build
|
||||
pnpm build --status
|
||||
pnpm build --logs [--follow]
|
||||
pnpm build --stop
|
||||
```
|
||||
|
||||
Use `pnpm build --modern --background` for production bundle-size or browser performance comparisons that only need modern browser output. It runs the normal metadata and static preparation, minifies and compresses the modern `frontend_latest` bundle and shared static assets, and generates modern-only entry pages and service workers. It deliberately skips the legacy bundle and its service worker.
|
||||
|
||||
Do not pass `--help`, `--background`, or `--modern` to `script/build_frontend`; that raw script does not parse arguments and always starts the full foreground build. Use `pnpm build` for managed builds. App builds and development servers keep exclusive ownership of `hass_frontend/` for their lifetime.
|
||||
|
||||
Managed app, demo, gallery, and E2E app workflows share one lifetime lock, so only one build or development server can run at a time.
|
||||
|
||||
## When To Add Tests
|
||||
|
||||
- Write tests for code that computes something: data processing, utilities, config validation, and strategies.
|
||||
- Do not write rendering tests. This includes views, panels, and components whose text, styles, slots, or option defaults are checked, or that only put context and helper data into a template.
|
||||
- Do not try to cover every scenario, especially for behaviour that changes often.
|
||||
- If you are not sure a test is useful, describe it and what it would catch, and let the user decide.
|
||||
- Tests never talk to a real Home Assistant. Replace `callWS`, `callApi`, and the connection with fakes.
|
||||
|
||||
## Dev Servers
|
||||
|
||||
`pnpm dev` builds and watches the app, served by a running Home Assistant core configured through `development_repo`.
|
||||
|
||||
`pnpm dev:serve` also serves locally and supports `-c` for the core URL and `-p` for the port. The default is 8124, or 8123 in a devcontainer.
|
||||
|
||||
Dev server commands support `--background`, `--status`, `--stop`, and `--logs [--follow]`. `pnpm dev`, `pnpm dev:serve`, `pnpm dev:demo`, and `pnpm dev:gallery` also support `--fetch-translations`; this runs translation fetching, including first-time GitHub device authentication, under the workflow lock before starting the watcher. It works in foreground and background modes. Prefer managed background mode while iterating so the watcher stays available across test runs without occupying the terminal. `pnpm dev` and `pnpm dev:serve` share one managed process slot because both write the app output.
|
||||
|
||||
## Playwright E2E
|
||||
|
||||
Each suite has its own dev server port. Playwright reuses an existing server locally when its configured URL responds; otherwise it performs a slow full build. When a development watcher is being reused, rspack recompiles on save and reruns should not need a restart.
|
||||
|
||||
Start the relevant suite server, then run that suite:
|
||||
|
||||
| Suite | Background server | Test command |
|
||||
| ------- | -------------------------------------------- | ----------------------- |
|
||||
| App | `pnpm test:e2e:app:dev --background` on 8095 | `pnpm test:e2e:app` |
|
||||
| Demo | `pnpm dev:demo --background` on 8090 | `pnpm test:e2e:demo` |
|
||||
| Gallery | `pnpm dev:gallery --background` on 8100 | `pnpm test:e2e:gallery` |
|
||||
|
||||
The custom development wrappers use `/__ha_dev_status` to identify and manage their own suites. Playwright server reuse checks the configured URL instead. Wrapper start and stop operations are idempotent for a matching suite and reject an unrelated process occupying the port.
|
||||
|
||||
Local runs against a watched development server do not always match CI's clean build artifacts, environment, sharding, or worker configuration. Use background servers for the fast iteration loop, but confirm the relevant CI jobs complete successfully before considering E2E changes verified.
|
||||
|
||||
Use `-g "<title>" --project=chromium` to narrow a run. `pnpm test:e2e` runs suites sequentially when managed servers are unavailable to prevent cold builds racing over shared generated assets. Run suites directly; piping through output truncation hides progress and failures.
|
||||
|
||||
The app suite uses a stripped-down harness for e2e. Demo and gallery use their normal dev servers.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
For chart data transforms such as history, statistics, energy, and downsampling, read and follow the complete workflow in `test/benchmarks/README.md` before making benchmark or optimization changes.
|
||||
|
||||
That workflow owns the baseline, noise analysis, guardrails, acceptance thresholds, and reporting requirements. In particular, optimizations must keep output bit-identical; never update snapshots or modify fixtures to make an optimization pass.
|
||||
|
||||
## Verification Selection
|
||||
|
||||
- Documentation-only change: no code test required unless examples or commands changed.
|
||||
- Type-only or utility change: run focused Vitest if available, then `pnpm lint:types` if practical.
|
||||
- Lit component change: run relevant tests plus lint or typecheck depending on scope.
|
||||
- E2E-sensitive flow: start the relevant e2e dev server and run the narrow Playwright suite.
|
||||
- Broad refactor: run `pnpm lint` and relevant test suites when practical.
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-types
|
||||
description: Home Assistant frontend TypeScript conventions. Use when defining or reviewing backend data contracts, optional schemas, shared types, assertions, or Lit lifecycle types.
|
||||
---
|
||||
|
||||
# HA Frontend Types
|
||||
|
||||
Use this skill for Home Assistant-specific TypeScript contracts and type choices.
|
||||
|
||||
## Home Assistant Data Contracts
|
||||
|
||||
Verify data contracts against the source that owns them, such as Home Assistant Core, Supervisor, a WebSocket handler, or an exported component type. Do not shape a type around assumptions made by its current frontend consumers.
|
||||
|
||||
- Match required, optional, nullable, and defaulted fields to the producer and runtime contract. Preserve optional configuration fields when omission is supported and has defined behavior.
|
||||
- Use distinct request and response types when their wire shapes differ.
|
||||
- When changing a shared contract, check affected consumers, tests, fixtures, and mocks.
|
||||
|
||||
## Reuse Home Assistant Contracts
|
||||
|
||||
- Reuse the canonical Home Assistant type when one exists. Define shared contract types in the data or API module that owns them.
|
||||
- Reuse types exported by components and helpers rather than reconstructing their payloads. For event types, follow `ha-frontend-events`.
|
||||
- When one domain contract is used across modules, define and export it from the module that owns that contract.
|
||||
|
||||
Prefer an existing owning contract. Introduce a frontend-specific type when the frontend shape or boundary genuinely differs.
|
||||
|
||||
## Assertions
|
||||
|
||||
Prefer accurate types and runtime narrowing. Use assertions or TypeScript suppressions at boundaries where the runtime invariant is understood but cannot be expressed cleanly; keep them narrow and explain non-obvious invariants.
|
||||
|
||||
## Lit Lifecycle Types
|
||||
|
||||
For Lit lifecycle methods that receive changed properties, use `PropertyValues<this>` when the method only needs public reactive properties:
|
||||
|
||||
```ts
|
||||
protected willUpdate(changedProperties: PropertyValues<this>) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Use unparameterized `PropertyValues` when the method inspects private or protected reactive properties, which are not keys of `this`. Do not add assertions solely to retain `PropertyValues<this>`.
|
||||
|
||||
## Enforced Baseline
|
||||
|
||||
Use `import type` for type-only imports. This is enforced by the repository ESLint configuration.
|
||||
@@ -1,98 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-user-facing-text
|
||||
description: Home Assistant frontend copy, localization, terminology, and user-facing text guidance. Use when adding or reviewing labels, buttons, dialogs, errors, translations, or UI strings.
|
||||
---
|
||||
|
||||
# HA Frontend User-Facing Text
|
||||
|
||||
Use this skill for all user-facing text, translations, labels, buttons, dialog copy, errors, helper text, and review comments about wording.
|
||||
|
||||
## Localization
|
||||
|
||||
- All user-facing text must be translatable.
|
||||
- Add translation keys to `src/translations/en.json` when introducing new strings.
|
||||
- Use the localization system instead of inline user-visible strings.
|
||||
- Prefer complete localized strings with placeholders over concatenating translated fragments.
|
||||
- Give translators enough context through key naming and placeholders.
|
||||
|
||||
```ts
|
||||
this._localize("ui.panel.config.updates.updates_refreshed", {
|
||||
count: 5,
|
||||
});
|
||||
```
|
||||
|
||||
## Voice And Style
|
||||
|
||||
- Use American English.
|
||||
- Use a friendly, informational tone.
|
||||
- Address users directly with "you" and "your" when appropriate.
|
||||
- Be inclusive, objective, and non-discriminatory.
|
||||
- Be concise and clear.
|
||||
- Use active voice.
|
||||
- Avoid jargon where a familiar home automation term works.
|
||||
- Always write "Home Assistant" in full. Do not use "HA" or "HASS" in user-facing copy.
|
||||
- Spell out terms when possible.
|
||||
- Use sentence case for titles, headings, buttons, labels, and UI elements.
|
||||
- Use the Oxford comma in lists.
|
||||
- Prefer "like" over "e.g." and "for example" over "i.e.".
|
||||
- Avoid all caps for emphasis. Use wording, bold, or italics instead.
|
||||
- Write for both technical and non-technical users.
|
||||
|
||||
Sentence case examples:
|
||||
|
||||
- Use: "Create new automation"
|
||||
- Avoid: "Create New Automation"
|
||||
- Use: "Device settings"
|
||||
- Avoid: "Device Settings"
|
||||
|
||||
## Terminology
|
||||
|
||||
Use "integration" instead of "component" for user-facing product language unless referring to a frontend component in developer context.
|
||||
|
||||
Technical product terms are lowercase in prose: automation, entity, device, service.
|
||||
|
||||
## Delete, Remove, Create, Add
|
||||
|
||||
Use "Remove" for actions that can be restored or reapplied:
|
||||
|
||||
- Removing a user's permission.
|
||||
- Removing a user from a group.
|
||||
- Removing links between items.
|
||||
- Removing a widget from a dashboard.
|
||||
- Removing an item from a cart.
|
||||
|
||||
Use "Delete" for permanent, non-recoverable actions:
|
||||
|
||||
- Deleting a field.
|
||||
- Deleting a value in a field.
|
||||
- Deleting a task.
|
||||
- Deleting a group.
|
||||
- Deleting a permission.
|
||||
- Deleting a calendar event.
|
||||
|
||||
Use "Add" for already-existing items:
|
||||
|
||||
- Adding a permission to a user.
|
||||
- Adding a user to a group.
|
||||
- Adding links between items.
|
||||
- Adding a widget to a dashboard.
|
||||
- Adding an item to a cart.
|
||||
|
||||
Use "Create" for something made from scratch:
|
||||
|
||||
- Creating a new field.
|
||||
- Creating a new task.
|
||||
- Creating a new group.
|
||||
- Creating a new permission.
|
||||
- Creating a new calendar event.
|
||||
|
||||
Create pairs with Delete. Add pairs with Remove.
|
||||
|
||||
## Review Checklist
|
||||
|
||||
- Text is localized.
|
||||
- Copy uses sentence case.
|
||||
- "Home Assistant" is written in full.
|
||||
- Delete/Remove and Create/Add match recoverability and object lifecycle.
|
||||
- Placeholders are used instead of string concatenation.
|
||||
- The wording is concise and understandable without implementation knowledge.
|
||||
@@ -1,44 +0,0 @@
|
||||
---
|
||||
name: ha-frontend-ux-readiness
|
||||
description: Home Assistant frontend UI/UX readiness routing for new cards, badges, screens, and interaction patterns. Use it with `ha-frontend-review` to decide whether frontend review is enough or further UI/UX input is needed. Skip it for PRs already carrying Needs UX and for fixes or technical details that preserve an established experience.
|
||||
---
|
||||
|
||||
# HA Frontend UI/UX Readiness
|
||||
|
||||
Use the design context and evidence gathered through `ha-frontend-review` to decide whether a change's UI/UX direction is settled and whether further UI/UX review should be recommended or is explicitly required. This skill routes the result; it does not repeat or replace implementation, accessibility, or frontend quality review.
|
||||
|
||||
## Early Exit
|
||||
|
||||
If the PR already carries the **Needs UX** label, reviewers have already decided to ask designers or UX reviewers for guidance. Do not use this skill to make that recommendation again.
|
||||
|
||||
## Triage
|
||||
|
||||
1. Apply `ha-frontend-review` and record its UI/UX evidence.
|
||||
- Include the applicable gallery specification, production or approved designs, shared `ha-*` components, task requirements, historical feedback, and direct instructions.
|
||||
- Keep the implementation review separate from this readiness decision.
|
||||
2. Classify the user-facing decision.
|
||||
- Existing-feature fixes and technical details normally remain with frontend review when they preserve the established experience.
|
||||
- New cards, badges, screens, and interaction patterns normally need this readiness check.
|
||||
3. Decide whether the evidence gathered during frontend review settles the direction.
|
||||
- Frontend maintainer guidance, explicit UI/UX approval, current guidance, an established pattern, or a task that settles the material visual and interaction choices can settle the direction.
|
||||
- Insufficient or conflicting evidence leaves the direction unresolved.
|
||||
4. Select exactly one route below and state which frontend-review evidence supports it.
|
||||
|
||||
## Routes
|
||||
|
||||
- **Frontend review sufficient:** The change preserves the established experience, or the evidence settles the material visual and interaction choices. Cite that evidence and continue with `ha-frontend-review`.
|
||||
- **UI/UX review recommended:** A new user experience has material design choices that remain unresolved. Identify the decision that needs input and recommend UI/UX review.
|
||||
- **UI/UX review required:** A workflow rule or direct human instruction explicitly requires UI/UX review. Cite that evidence. A new design, task link, or lack of evidence is not enough on its own.
|
||||
|
||||
Frontend maintainer guidance, explicit UI/UX approval, established patterns, and task requirements inform the route. A task can settle requirements without settling the UI/UX. Recommend UI/UX review when important design choices remain unresolved.
|
||||
|
||||
## Reporting
|
||||
|
||||
Keep the result concise and use this structure:
|
||||
|
||||
- **Route:** Frontend review sufficient, UI/UX review recommended, or UI/UX review required
|
||||
- **Established patterns:** relevant gallery specifications, production designs, and shared `ha-*` components for the next reviewer to compare
|
||||
- **Supporting evidence:** approval, guidance, established patterns, task requirements, direct instructions, or the evidence gap or conflict
|
||||
- **Next action:** the review action implied by the route
|
||||
|
||||
Separate whether the UI/UX direction is settled from whether the implementation is correct.
|
||||
@@ -1,52 +0,0 @@
|
||||
[modern]
|
||||
# Modern builds target recent browsers supporting the latest features to minimize transpilation, polyfills, etc.
|
||||
# It is served to browsers meeting the following requirements:
|
||||
# - released in the last 2 years + current alpha/beta versions
|
||||
# - exclude dead browsers (no security maintenance for 2+ years)
|
||||
# - exclude QQ, and UC browsers due to lack of sufficient feature support data
|
||||
unreleased versions
|
||||
last 2 years
|
||||
not dead
|
||||
not QQAndroid > 0
|
||||
not UCAndroid > 0
|
||||
|
||||
[legacy]
|
||||
# Legacy builds are served when modern requirements are not met.
|
||||
# Floors are pinned explicitly (not usage-based) so the support policy is
|
||||
# deliberate and does not drift with global usage statistics, which do not
|
||||
# represent old tablets and wall displays used as Home Assistant dashboards:
|
||||
# - iOS/Safari >= 12: iPad Air 1 / mini 2 / mini 3 (last supported iOS).
|
||||
# Older iPads (iPad 2/3/mini 1 on iOS 9.3, iPad 4 on iOS 10.3) cannot run
|
||||
# the app: their engines lack custom elements, shadow DOM, and/or CSS grid.
|
||||
# - Chrome >= 59: Fire OS 5 tablets (Fire 7/HD 8/HD 10 through ~2017) have
|
||||
# their system WebView pinned at Chromium 59 and commonly run Fully Kiosk;
|
||||
# also covers old kiosk browsers and no-longer-updating webviews above it.
|
||||
# - Edge >= 79: all Chromium-based Edge. Costs nothing (above the Chrome
|
||||
# floor); mainly catches Edge 109 on Windows 7/8.1 and update-frozen
|
||||
# enterprise installs, whose engines can run the legacy build fine.
|
||||
# - Firefox >= 94: the zero-cost floor, not a chased population — pinning it
|
||||
# adds no babel transforms, core-js modules, or Lightning CSS prefixes to
|
||||
# the output. Mozilla-supported Firefox (incl. current ESR) always matches
|
||||
# [modern]; Firefox on old OSes is not supported (use Chrome 109 instead).
|
||||
# If Firefox ever becomes the pin forcing extra output, raise it first.
|
||||
# - Samsung >= 9: Samsung Internet on old Galaxy tablets
|
||||
Chrome >= 59
|
||||
ChromeAndroid >= 59
|
||||
Edge >= 79
|
||||
Firefox >= 94
|
||||
FirefoxAndroid >= 94
|
||||
iOS >= 12
|
||||
Safari >= 12
|
||||
Samsung >= 9
|
||||
|
||||
[legacy-sw]
|
||||
# Same as legacy, restricted to browsers that support service workers
|
||||
# (currently resolves to the same set; guards the service worker build if the legacy floor ever drops below them)
|
||||
Chrome >= 59 and supports serviceworkers
|
||||
ChromeAndroid >= 59 and supports serviceworkers
|
||||
Edge >= 79 and supports serviceworkers
|
||||
Firefox >= 94 and supports serviceworkers
|
||||
FirefoxAndroid >= 94 and supports serviceworkers
|
||||
iOS >= 12 and supports serviceworkers
|
||||
Safari >= 12 and supports serviceworkers
|
||||
Samsung >= 9 and supports serviceworkers
|
||||
@@ -1 +0,0 @@
|
||||
../.agents/skills
|
||||
@@ -1,6 +1,13 @@
|
||||
FROM mcr.microsoft.com/devcontainers/python:3.14
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.9
|
||||
|
||||
ENV \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
DEVCONTAINER=true \
|
||||
PATH=$PATH:./node_modules/.bin
|
||||
|
||||
# Install nvm
|
||||
COPY .nvmrc /tmp/.nvmrc
|
||||
RUN \
|
||||
su vscode -c \
|
||||
"source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1"
|
||||
@@ -5,45 +5,30 @@
|
||||
"context": ".."
|
||||
},
|
||||
"appPort": "8124:8123",
|
||||
"postCreateCommand": "./.devcontainer/post_create.sh",
|
||||
"postStartCommand": "script/bootstrap",
|
||||
"containerEnv": {
|
||||
"DEV_CONTAINER": "1",
|
||||
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
||||
},
|
||||
"remoteEnv": {
|
||||
"NODE_OPTIONS": "--max_old_space_size=8192"
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"runem.lit-plugin",
|
||||
"github.vscode-pull-request-github",
|
||||
"eamodio.gitlens",
|
||||
"yeion7.styled-global-variables-autocomplete"
|
||||
],
|
||||
"settings": {
|
||||
"files.eol": "\n",
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"editor.renderWhitespace": "boundary",
|
||||
"editor.rulers": [80],
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"terminal.integrated.shell.linux": "/usr/bin/zsh",
|
||||
"gitlens.showWelcomeOnInstall": false,
|
||||
"gitlens.showWhatsNewAfterUpgrades": false,
|
||||
"workbench.startupEditor": "none"
|
||||
}
|
||||
}
|
||||
"context": "..",
|
||||
"postCreateCommand": "script/bootstrap",
|
||||
"extensions": [
|
||||
"github.vscode-pull-request-github",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"ms-vscode.vscode-typescript-tslint-plugin",
|
||||
"esbenp.prettier-vscode",
|
||||
"bierner.lit-html",
|
||||
"runem.lit-plugin",
|
||||
"ms-python.vscode-pylance"
|
||||
],
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"files.eol": "\n",
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnPaste": false,
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnType": true,
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"files.trimTrailingWhitespace": true
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script will run after the container is created
|
||||
|
||||
# add github cli
|
||||
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
|
||||
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
|
||||
&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
|
||||
&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
|
||||
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
|
||||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
||||
|
||||
# Update package lists
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt upgrade -y
|
||||
|
||||
# Install necessary packages
|
||||
sudo apt-get install -y libpcap-dev gh
|
||||
|
||||
# Display a message
|
||||
echo "Post-create script has been executed successfully."
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"airbnb-typescript/base",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:wc/recommended",
|
||||
"plugin:lit/all",
|
||||
"prettier"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"ecmaFeatures": {
|
||||
"modules": true
|
||||
},
|
||||
"sourceType": "module",
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"webpack": {
|
||||
"config": "./webpack.config.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"__DEV__": false,
|
||||
"__DEMO__": false,
|
||||
"__BUILD__": false,
|
||||
"__VERSION__": false,
|
||||
"__STATIC_PATH__": false,
|
||||
"Polymer": true
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"rules": {
|
||||
"class-methods-use-this": "off",
|
||||
"new-cap": "off",
|
||||
"prefer-template": "off",
|
||||
"object-shorthand": "off",
|
||||
"func-names": "off",
|
||||
"no-underscore-dangle": "off",
|
||||
"strict": "off",
|
||||
"no-plusplus": "off",
|
||||
"no-bitwise": "error",
|
||||
"comma-dangle": "off",
|
||||
"vars-on-top": "off",
|
||||
"no-continue": "off",
|
||||
"no-param-reassign": "off",
|
||||
"no-multi-assign": "off",
|
||||
"no-console": "error",
|
||||
"radix": "off",
|
||||
"no-alert": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"prefer-destructuring": "off",
|
||||
"no-restricted-globals": [2, "event"],
|
||||
"prefer-promise-reject-errors": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"import/no-default-export": "off",
|
||||
"import/no-unresolved": "off",
|
||||
"import/no-cycle": "off",
|
||||
"import/extensions": [
|
||||
"error",
|
||||
"ignorePackages",
|
||||
{ "ts": "never", "js": "never" }
|
||||
],
|
||||
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
|
||||
"object-curly-newline": "off",
|
||||
"default-case": "off",
|
||||
"wc/no-self-class": "off",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/camelcase": "off",
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/no-use-before-define": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/explicit-function-return-type": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-shadow": ["error"],
|
||||
"@typescript-eslint/naming-convention": [
|
||||
"off",
|
||||
{
|
||||
"selector": "default",
|
||||
"format": ["camelCase", "snake_case"],
|
||||
"leadingUnderscore": "allow",
|
||||
"trailingUnderscore": "allow"
|
||||
},
|
||||
{
|
||||
"selector": ["variable"],
|
||||
"format": ["camelCase", "snake_case", "UPPER_CASE"],
|
||||
"leadingUnderscore": "allow",
|
||||
"trailingUnderscore": "allow"
|
||||
},
|
||||
{
|
||||
"selector": "typeLike",
|
||||
"format": ["PascalCase"]
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"unused-imports/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"vars": "all",
|
||||
"varsIgnorePattern": "^_",
|
||||
"args": "after-used",
|
||||
"argsIgnorePattern": "^_",
|
||||
"ignoreRestSiblings": true
|
||||
}
|
||||
],
|
||||
"unused-imports/no-unused-imports": "error",
|
||||
"lit/attribute-value-entities": "off",
|
||||
"lit/no-template-map": "off",
|
||||
"lit/no-template-arrow": "warn"
|
||||
},
|
||||
"plugins": ["disable", "unused-imports"],
|
||||
"processor": "disable/disable"
|
||||
}
|
||||
@@ -51,7 +51,7 @@ DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed w
|
||||
<!--
|
||||
Provide details about the versions you are using, which helps us reproducing
|
||||
and finding the issue quicker. Version information is found in the
|
||||
Home Assistant frontend: Settings -> About.
|
||||
Home Assistant frontend: Configuration -> Info.
|
||||
|
||||
Browser version and operating system is important! Please try to replicate
|
||||
your issue in a different browser and be sure to include your findings.
|
||||
@@ -67,7 +67,7 @@ DO NOT DELETE ANY TEXT from this template! Otherwise, your issue may be closed w
|
||||
<!--
|
||||
If your issue is about how an entity is shown in the UI, please add the state
|
||||
and attributes for all situations with a screenshot of the UI.
|
||||
You can find this information at `/config/tools/state`
|
||||
You can find this information at `/developer-tools/state`
|
||||
-->
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Report a bug with the UI / Dashboards
|
||||
name: Report a bug with the UI, Frontend or Lovelace
|
||||
description: Report an issue related to the Home Assistant frontend.
|
||||
labels: bug
|
||||
body:
|
||||
@@ -7,17 +7,13 @@ body:
|
||||
value: |
|
||||
Make sure you are running the [latest version of Home Assistant][releases] before reporting an issue.
|
||||
|
||||
Please read our [issue reporting guide][reporting-issues] before submitting a report.
|
||||
If you have a feature or enhancement request for the frontend, please [start an discussion][fr] instead of creating an issue.
|
||||
|
||||
If you have a feature or enhancement request for the frontend, please [start a discussion][fr] instead of creating an issue.
|
||||
**Please not not report issues for custom Lovelace cards.**
|
||||
|
||||
**Please do not report issues for custom cards.**
|
||||
|
||||
[fr]: https://github.com/orgs/home-assistant/discussions
|
||||
[fr]: https://github.com/home-assistant/frontend/discussions
|
||||
[releases]: https://github.com/home-assistant/home-assistant/releases
|
||||
[reporting-issues]: https://www.home-assistant.io/help/reporting_issues/
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: Checklist
|
||||
description: Please verify that you've followed these steps
|
||||
@@ -28,27 +24,23 @@ body:
|
||||
required: true
|
||||
- label: I have tried a different browser to see if it is related to my browser.
|
||||
required: true
|
||||
- label: I have tried reproducing the issue in [safe mode](https://www.home-assistant.io/blog/2023/11/01/release-202311/#restarting-into-safe-mode) to rule out problems with unsupported custom resources.
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## The problem
|
||||
- type: textarea
|
||||
id: problem
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Describe the issue you are experiencing
|
||||
description: Provide a clear and concise description of what the bug is.
|
||||
- type: textarea
|
||||
id: expected_behavior
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: Describe the behavior you expected
|
||||
description: Describe what you expected to happen or it should look/behave.
|
||||
- type: textarea
|
||||
id: steps_to_reproduce
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
@@ -66,30 +58,26 @@ body:
|
||||
value: |
|
||||
## Environment
|
||||
- type: input
|
||||
id: core_version
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: What version of Home Assistant Core has the issue?
|
||||
placeholder: core-
|
||||
description: >
|
||||
Can be found in: [Settings -> About](https://my.home-assistant.io/redirect/info/).
|
||||
Can be found in the Configuration panel -> Info.
|
||||
- type: input
|
||||
id: last_working_version
|
||||
attributes:
|
||||
label: What was the last working version of Home Assistant Core?
|
||||
placeholder: core-
|
||||
description: >
|
||||
If known, otherwise leave blank.
|
||||
- type: input
|
||||
id: browser
|
||||
attributes:
|
||||
label: In which browser are you experiencing the issue?
|
||||
label: In which browser are you experiencing the issue with?
|
||||
placeholder: Google Chrome 88.0.4324.150
|
||||
description: >
|
||||
Provide the full name and don't forget to add the version!
|
||||
- type: input
|
||||
id: os
|
||||
attributes:
|
||||
label: Which operating system are you using to run this browser?
|
||||
placeholder: macOS Big Sur (1.11)
|
||||
@@ -101,16 +89,14 @@ body:
|
||||
# Details
|
||||
|
||||
- type: textarea
|
||||
id: entity_state
|
||||
attributes:
|
||||
label: State of relevant entities
|
||||
description: >
|
||||
If your issue is about how an entity is shown in the UI, please add the
|
||||
state and attributes for all situations. You can find this
|
||||
information in the Details view of the More info dialog.
|
||||
state and attributes for all situations. You can find this information
|
||||
at Developer Tools -> States.
|
||||
render: txt
|
||||
- type: textarea
|
||||
id: configuration
|
||||
attributes:
|
||||
label: Problem-relevant frontend configuration
|
||||
description: >
|
||||
@@ -120,15 +106,13 @@ body:
|
||||
passwords, private URLs and other credentials.
|
||||
render: yaml
|
||||
- type: textarea
|
||||
id: javascript_errors
|
||||
attributes:
|
||||
label: JavaScript errors shown in your browser console/inspector
|
||||
label: Javascript errors shown in your browser console/inspector
|
||||
description: >
|
||||
If you come across any JavaScript or other error logs, e.g., in your
|
||||
If you come across any Javascript or other error logs, e.g., in your
|
||||
browser console/inspector please provide them.
|
||||
render: txt
|
||||
- type: textarea
|
||||
id: additional_information
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: >
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Request a feature for the UI / Dashboards
|
||||
url: https://github.com/orgs/home-assistant/discussions
|
||||
about: Request a new feature for the Home Assistant frontend.
|
||||
- name: Discuss UI or UX design
|
||||
url: https://github.com/OpenHomeFoundation/ux-design/discussions
|
||||
about: Share design feedback and discuss visual or UX changes with the design team.
|
||||
- name: Report a bug that is NOT related to the UI / Dashboards
|
||||
- name: Request a feature for the UI, Frontend or Lovelace
|
||||
url: https://github.com/home-assistant/frontend/discussions/category_choices
|
||||
about: Request an new feature for the Home Assistant frontend.
|
||||
- name: Report a bug that is NOT related to the UI, Frontend or Lovelace
|
||||
url: https://github.com/home-assistant/core/issues
|
||||
about: This is the issue tracker for our frontend. Please report other issues in the backend ("core") repository.
|
||||
about: This is the issue tracker for our frontend. Please report other issues with the backend repository.
|
||||
- name: Report incorrect or missing information on our website
|
||||
url: https://github.com/home-assistant/home-assistant.io/issues
|
||||
about: Our documentation has its own issue tracker. Please report issues with the website there.
|
||||
- name: I have a question or need support
|
||||
url: https://www.home-assistant.io/help
|
||||
about: We use GitHub for tracking bugs. Check our website for resources on getting help.
|
||||
about: We use GitHub for tracking bugs, check our website for resources on getting help.
|
||||
- name: I'm unsure where to go
|
||||
url: https://www.home-assistant.io/join-chat
|
||||
about: If you are unsure where to go, then joining our chat is recommended; Just ask!
|
||||
@@ -1,53 +0,0 @@
|
||||
name: Task
|
||||
description: For staff only - Create a task
|
||||
type: Task
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
## ⚠️ RESTRICTED ACCESS
|
||||
|
||||
**This form is restricted to Open Home Foundation staff and authorized contributors only.**
|
||||
|
||||
If you are a community member wanting to contribute, please:
|
||||
- For bug reports: Use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml)
|
||||
- For feature requests: Submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions)
|
||||
|
||||
---
|
||||
|
||||
### For authorized contributors
|
||||
|
||||
Use this form to create tasks for development work, improvements, or other actionable items that need to be tracked.
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: |
|
||||
Provide a clear and detailed description of the task that needs to be accomplished.
|
||||
|
||||
Be specific about what needs to be done, why it's important, and any constraints or requirements.
|
||||
placeholder: |
|
||||
Describe the task, including:
|
||||
- What needs to be done
|
||||
- Why this task is needed
|
||||
- Expected outcome
|
||||
- Any constraints or requirements
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: additional_context
|
||||
attributes:
|
||||
label: Additional context
|
||||
description: |
|
||||
Any additional information, links, research, or context that would be helpful.
|
||||
|
||||
Include links to related issues, research, prototypes, roadmap opportunities etc.
|
||||
placeholder: |
|
||||
- Roadmap opportunity: [link]
|
||||
- Epic: [link]
|
||||
- Feature request: [link]
|
||||
- Technical design documents: [link]
|
||||
- Prototype/mockup: [link]
|
||||
- Dependencies: [links]
|
||||
validations:
|
||||
required: false
|
||||
@@ -2,7 +2,9 @@
|
||||
You are amazing! Thanks for contributing to our project!
|
||||
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
|
||||
-->
|
||||
|
||||
## Breaking change
|
||||
|
||||
<!--
|
||||
If your PR contains a breaking change for existing users, it is important
|
||||
to tell them what breaks, how to make it work again and why we did this.
|
||||
@@ -11,8 +13,8 @@
|
||||
Note: Remove this section if this PR is NOT a breaking change.
|
||||
-->
|
||||
|
||||
|
||||
## Proposed change
|
||||
|
||||
<!--
|
||||
Describe the big picture of your changes here to communicate to the
|
||||
maintainers why we should accept this pull request. If it fixes a bug
|
||||
@@ -20,16 +22,8 @@
|
||||
in the additional information section.
|
||||
-->
|
||||
|
||||
|
||||
## Screenshots
|
||||
<!--
|
||||
If your PR includes visual changes, please add screenshots or a short video
|
||||
showing the before and after. This helps reviewers understand the impact of
|
||||
your changes.
|
||||
Note: Remove this section if this PR has no visual changes.
|
||||
-->
|
||||
|
||||
## Type of change
|
||||
|
||||
<!--
|
||||
What type of change does your PR introduce to the Home Assistant frontend?
|
||||
NOTE: Please, check only 1! box!
|
||||
@@ -43,7 +37,19 @@
|
||||
- [ ] Breaking change (fix/feature causing existing functionality to break)
|
||||
- [ ] Code quality improvements to existing code or addition of tests
|
||||
|
||||
## Example configuration
|
||||
|
||||
<!--
|
||||
Supplying a configuration snippet, makes it easier for a maintainer to test
|
||||
your PR.
|
||||
-->
|
||||
|
||||
```yaml
|
||||
|
||||
```
|
||||
|
||||
## Additional information
|
||||
|
||||
<!--
|
||||
Details are important, and help maintainers processing your PR.
|
||||
Please be sure to fill out additional details, if applicable.
|
||||
@@ -52,57 +58,26 @@
|
||||
- This PR fixes or closes issue: fixes #
|
||||
- This PR is related to issue or discussion:
|
||||
- Link to documentation pull request:
|
||||
- Link to developer documentation pull request:
|
||||
- Link to backend pull request:
|
||||
|
||||
## Checklist
|
||||
|
||||
<!--
|
||||
Put an `x` in the boxes that apply. You can also fill these out after
|
||||
creating the PR. If you're unsure about any of them, don't hesitate to ask.
|
||||
We're here to help! This is simply a reminder of what we are going to look
|
||||
for before merging your code.
|
||||
|
||||
AI tools are welcome, but contributors are responsible for *fully*
|
||||
understanding the code before submitting a PR.
|
||||
-->
|
||||
|
||||
- [ ] I understand the code I am submitting and can explain how it works.
|
||||
- [ ] The code change is tested and works locally.
|
||||
- [ ] There is no commented out code in this PR.
|
||||
- [ ] I have followed the [perfect PR recommendations][perfect-pr]
|
||||
- [ ] Any generated code has been carefully reviewed for correctness and compliance with project standards.
|
||||
- [ ] Tests have been added to verify that the new code works.
|
||||
|
||||
If user exposed functionality or configuration variables are added/changed:
|
||||
|
||||
- [ ] Documentation added/updated for [www.home-assistant.io][docs-repository]
|
||||
|
||||
<!--
|
||||
This project is very active and we have a high turnover of pull requests.
|
||||
|
||||
Unfortunately, the number of incoming pull requests is higher than what our
|
||||
reviewers can review and merge so there is a long backlog of pull requests
|
||||
waiting for review. You can help here!
|
||||
|
||||
By reviewing another pull request, you will help raise the code quality of
|
||||
that pull request and the final review will be faster. This way the general
|
||||
pace of pull request reviews will go up and your wait time will go down.
|
||||
|
||||
When picking a pull request to review, try to choose one that hasn't yet
|
||||
been reviewed.
|
||||
|
||||
Thanks for helping out!
|
||||
-->
|
||||
|
||||
To help with the load of incoming pull requests:
|
||||
|
||||
- [ ] I have reviewed two other [open pull requests][prs] in this repository.
|
||||
|
||||
[prs]: https://github.com/home-assistant/frontend/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+sort%3Acreated-desc+review%3Anone+-status%3Afailure
|
||||
|
||||
<!--
|
||||
Thank you for contributing <3
|
||||
|
||||
Below, some useful links you could explore:
|
||||
-->
|
||||
|
||||
[docs-repository]: https://github.com/home-assistant/home-assistant.io
|
||||
[perfect-pr]: https://developers.home-assistant.io/docs/review-process/#creating-the-perfect-pr
|
||||
@@ -1,27 +0,0 @@
|
||||
name: Build frontend target
|
||||
description: Run a gulp build target
|
||||
|
||||
inputs:
|
||||
target:
|
||||
description: gulp target to run
|
||||
required: true
|
||||
github-token:
|
||||
description: GitHub token for fetching nightly translations; omit to build English-only
|
||||
default: ""
|
||||
is-test:
|
||||
description: Set IS_TEST for the build (skips source maps and compression)
|
||||
default: "false"
|
||||
rspack-cache:
|
||||
description: rspack persistent cache mode ("readwrite", "readonly", or "" to disable)
|
||||
default: ""
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Build ${{ inputs.target }}
|
||||
shell: bash
|
||||
run: ./node_modules/.bin/gulp ${{ inputs.target }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.github-token }}
|
||||
IS_TEST: ${{ inputs.is-test }}
|
||||
RSPACK_CACHE: ${{ inputs.rspack-cache }}
|
||||
@@ -1,52 +0,0 @@
|
||||
name: Deploy to Netlify
|
||||
description: Deploy a directory to Netlify (production when alias is empty, otherwise to the alias)
|
||||
|
||||
inputs:
|
||||
dir:
|
||||
description: Directory to deploy
|
||||
required: true
|
||||
alias:
|
||||
description: Deploy alias; leave empty to deploy to production
|
||||
default: ""
|
||||
auth-token:
|
||||
description: NETLIFY_AUTH_TOKEN
|
||||
required: true
|
||||
site-id:
|
||||
description: NETLIFY_SITE_ID
|
||||
required: true
|
||||
|
||||
outputs:
|
||||
netlify_url:
|
||||
description: The deployed URL
|
||||
value: ${{ steps.deploy.outputs.netlify_url }}
|
||||
unique_deploy_url:
|
||||
description: The unique hash-based deployment URL for this specific build
|
||||
value: ${{ steps.deploy.outputs.unique_deploy_url }}
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
shell: bash
|
||||
env:
|
||||
DIR: ${{ inputs.dir }}
|
||||
ALIAS: ${{ inputs.alias }}
|
||||
NETLIFY_AUTH_TOKEN: ${{ inputs.auth-token }}
|
||||
NETLIFY_SITE_ID: ${{ inputs.site-id }}
|
||||
run: |
|
||||
# Execute the deployment
|
||||
if [ -n "$ALIAS" ]; then
|
||||
npx -y netlify-cli deploy --dir="$DIR" --alias "$ALIAS" --json > deploy_output.json
|
||||
else
|
||||
npx -y netlify-cli deploy --dir="$DIR" --prod --json > deploy_output.json
|
||||
fi
|
||||
|
||||
# Collect the urls from the deployment output
|
||||
NETLIFY_URL=$(jq -r '.url // .deploy_url' deploy_output.json)
|
||||
SITE_NAME=$(jq -r '.site_name' deploy_output.json)
|
||||
DEPLOY_ID=$(jq -r '.deploy_id' deploy_output.json)
|
||||
UNIQUE_URL="https://${DEPLOY_ID}--${SITE_NAME}.netlify.app"
|
||||
|
||||
echo "netlify_url=$NETLIFY_URL" >> "$GITHUB_OUTPUT"
|
||||
echo "unique_deploy_url=$UNIQUE_URL" >> "$GITHUB_OUTPUT"
|
||||
@@ -1,41 +0,0 @@
|
||||
name: Prepare dependencies
|
||||
description: Install and cache the complete dependency tree
|
||||
|
||||
inputs:
|
||||
node-modules-cache-key:
|
||||
description: Prefix for the shared node_modules cache key
|
||||
default: node-modules-v1
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Check for complete dependency tree
|
||||
id: dependencies
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
~/.local/share/pnpm/store
|
||||
key: >-
|
||||
${{ inputs.node-modules-cache-key }}-${{ runner.os }}-${{ runner.arch }}-${{
|
||||
hashFiles('.nvmrc', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'patches/**') }}
|
||||
lookup-only: true
|
||||
|
||||
- name: Setup Node and install
|
||||
if: steps.dependencies.outputs.cache-hit != 'true'
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
cache: false
|
||||
|
||||
- name: Save complete dependency tree
|
||||
if: steps.dependencies.outputs.cache-hit != 'true'
|
||||
continue-on-error: true
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
~/.local/share/pnpm/store
|
||||
key: >-
|
||||
${{ inputs.node-modules-cache-key }}-${{ runner.os }}-${{ runner.arch }}-${{
|
||||
hashFiles('.nvmrc', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'patches/**') }}
|
||||
@@ -1,62 +0,0 @@
|
||||
name: Setup Node and install
|
||||
description: Set up Node from .nvmrc and install pnpm dependencies
|
||||
|
||||
inputs:
|
||||
immutable:
|
||||
description: Pass --frozen-lockfile to pnpm install
|
||||
default: "true"
|
||||
cache:
|
||||
description: Cache the pnpm store
|
||||
default: "true"
|
||||
node-modules-cache:
|
||||
description: Restore the exact shared node_modules cache before installing
|
||||
default: "false"
|
||||
node-modules-cache-key:
|
||||
description: Prefix for the shared node_modules cache key
|
||||
default: node-modules-v1
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
# The pnpm store is cached with node_modules because `pnpm licenses`
|
||||
# (used by the license file generation) reads package metadata from it.
|
||||
- name: Restore complete dependency tree
|
||||
id: dependency-cache
|
||||
if: inputs.node-modules-cache == 'true'
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
node_modules
|
||||
~/.local/share/pnpm/store
|
||||
key: >-
|
||||
${{ inputs.node-modules-cache-key }}-${{ runner.os }}-${{ runner.arch }}-${{
|
||||
hashFiles('.nvmrc', 'package.json', 'pnpm-lock.yaml', 'pnpm-workspace.yaml', 'patches/**') }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Enable Corepack
|
||||
shell: bash
|
||||
run: corepack enable
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-store
|
||||
if: inputs.cache == 'true' && (inputs.node-modules-cache != 'true' || steps.dependency-cache.outputs.cache-hit != 'true')
|
||||
shell: bash
|
||||
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Cache pnpm store
|
||||
if: steps.pnpm-store.outputs.path
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ${{ steps.pnpm-store.outputs.path }}
|
||||
key: pnpm-store-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-store-${{ runner.os }}-${{ runner.arch }}-
|
||||
|
||||
- name: Install dependencies
|
||||
if: inputs.node-modules-cache != 'true' || steps.dependency-cache.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: pnpm install ${{ inputs.immutable == 'true' && '--frozen-lockfile' || '--no-frozen-lockfile' }}
|
||||
@@ -1 +0,0 @@
|
||||
../AGENTS.md
|
||||
@@ -1,321 +0,0 @@
|
||||
# Path rules for .github/workflows/labeler.yaml, which runs actions/labeler on
|
||||
# every pull request. A label is added when a pull request changes a matching
|
||||
# file, and removed again when it no longer does, including one added by hand.
|
||||
#
|
||||
# Do not add these labels here. .github/scripts/label-content.mts applies and
|
||||
# removes them from paths and code. A rule here would remove them whenever its
|
||||
# paths don't match, even when the script's code check does:
|
||||
#
|
||||
# - Companion App
|
||||
# - Home Assistant Link
|
||||
# - Labs
|
||||
# - Supervisor
|
||||
|
||||
Activity:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/logbook/**
|
||||
- src/panels/lovelace/**/*logbook*
|
||||
- src/data/logbook.ts
|
||||
|
||||
Agents:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "**/AGENTS.md"
|
||||
- "**/CLAUDE.md"
|
||||
- "**/GEMINI.md"
|
||||
- .agents/**
|
||||
- .claude/**
|
||||
- .github/agents/**
|
||||
- .github/copilot-instructions.md
|
||||
- .github/hooks/**
|
||||
- .github/instructions/**
|
||||
- .github/plugin.json
|
||||
- .github/plugin/**
|
||||
- .github/prompts/**
|
||||
- .github/skills/**
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
|
||||
AI:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/panels/config/core/{ha-config-section-ai,ai-task-pref,mcp-pref}.ts"
|
||||
- src/components/ha-suggest-with-ai-button.ts
|
||||
- "src/data/{ai_task,llm}.ts"
|
||||
|
||||
Areas:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/areas/**
|
||||
- src/data/area/**
|
||||
- "src/data/{area_floor_picker,floor_registry,ws-area_registry,ws-floor_registry}.ts"
|
||||
|
||||
Automations:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/panels/config/{automation,script,scene,blueprint}/**"
|
||||
- src/components/automation/**
|
||||
- src/components/trace/**
|
||||
- src/data/trace*.ts
|
||||
- "src/data/{automation,automation_i18n,script,script_i18n,scene,blueprint,trigger,condition,action}.ts"
|
||||
|
||||
Backups:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/backup/**
|
||||
- src/data/backup*.ts
|
||||
- src/onboarding/onboarding-restore-backup.ts
|
||||
|
||||
Build:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- build-scripts/**
|
||||
- .browserslistrc
|
||||
- gulpfile.js
|
||||
|
||||
Calendar:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/calendar/**
|
||||
- src/panels/lovelace/**/*calendar*
|
||||
- src/data/calendar.ts
|
||||
|
||||
Cast:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- cast/src/**
|
||||
- src/cast/**
|
||||
|
||||
Connectivity:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/connectivity/**
|
||||
- src/panels/config/tags/**
|
||||
- "src/panels/config/integrations/integration-panels/{bluetooth,infrared,matter,modbus,mqtt,radio_frequency,serial,thread,zha,zwave_js}/**"
|
||||
- "src/data/{bluetooth,infrared,matter,matter-lock,modbus,mqtt,otbr,radio_frequency,tag,thread,usb,zha,zwave_js,zwave_js-credentials}.ts"
|
||||
|
||||
Dashboards:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/lovelace/**
|
||||
- "src/panels/{home,climate,light,security,maintenance,map}/**"
|
||||
- src/panels/config/lovelace/**
|
||||
- "src/panels/config/dashboard/{dashboard-card,dialog-new-dashboard,show-dialog-new-dashboard}.ts"
|
||||
- src/data/lovelace/**
|
||||
- src/data/lovelace*.ts
|
||||
|
||||
Demo:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- demo/src/**
|
||||
- src/fake_data/**
|
||||
|
||||
Design:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- gallery/src/**
|
||||
- src/fake_data/**
|
||||
|
||||
Dependencies:
|
||||
- any:
|
||||
- changed-files:
|
||||
# Match when only these files are changed (i.e. don't match PRs that happen to add or remove packages)
|
||||
- any-glob-to-all-files:
|
||||
- package.json
|
||||
- renovate.json
|
||||
- pnpm-lock.yaml
|
||||
- pnpm-workspace.yaml
|
||||
- patches/**
|
||||
- .nvmrc
|
||||
# Dependabot and Renovate branches always match (i.e. compatibility tweaks by members considered minor)
|
||||
- head-branch:
|
||||
- "^renovate/"
|
||||
- "^dependabot/"
|
||||
|
||||
Devices:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/devices/**
|
||||
- src/data/device/device_registry.ts
|
||||
- src/data/ws-device_registry.ts
|
||||
|
||||
Energy:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/energy/**
|
||||
- src/panels/config/energy/**
|
||||
- src/panels/lovelace/cards/energy/**
|
||||
- src/panels/lovelace/**/*energy*
|
||||
- src/data/energy*.ts
|
||||
|
||||
Entities:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/entities/**
|
||||
- src/data/entity/entity_registry*.ts
|
||||
- src/data/ws-entity_registry_display.ts
|
||||
|
||||
GitHub Actions:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- .github/actions/**
|
||||
- .github/workflows/**
|
||||
- .github/*.yml
|
||||
|
||||
Helpers:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/helpers/**
|
||||
- src/data/helpers_crud.ts
|
||||
|
||||
History:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/history/**
|
||||
- src/panels/lovelace/**/*history*
|
||||
- src/data/history.ts
|
||||
|
||||
Integrations:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/integrations/**
|
||||
- src/panels/config/application_credentials/**
|
||||
- src/dialogs/config-flow/**
|
||||
- src/data/application_credential.ts
|
||||
- src/data/config_entries.ts
|
||||
- "src/data/{config_flow,data_entry_flow,options_flow,sub_config_flow}.ts"
|
||||
|
||||
Labels:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/labels/**
|
||||
- src/data/label/**
|
||||
|
||||
Landing Page:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- landing-page/**
|
||||
|
||||
Marketplace:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/marketplace/**
|
||||
- src/data/marketplace/**
|
||||
- src/panels/config/integrations/offer-marketplace-uninstall.ts
|
||||
|
||||
Media:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/media-browser/**
|
||||
- src/components/media-player/**
|
||||
- src/data/media_source.ts
|
||||
|
||||
Notifications:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/dialogs/notifications/**
|
||||
- src/data/persistent_notification.ts
|
||||
|
||||
Onboarding:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/onboarding/**
|
||||
- src/auth/**
|
||||
- src/data/onboarding.ts
|
||||
- src/data/auth.ts
|
||||
|
||||
People:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/panels/config/{person,users}/**"
|
||||
- "src/data/{person,user,ws-user}.ts"
|
||||
|
||||
Profile:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/profile/**
|
||||
|
||||
Search:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/dialogs/quick-bar/**
|
||||
- src/state/quick-bar-mixin.ts
|
||||
- "src/data/{quick_bar,search}.ts"
|
||||
|
||||
Sidebar:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/components/ha-sidebar.ts
|
||||
- src/dialogs/sidebar/**
|
||||
|
||||
System:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- "src/panels/config/{core,hardware,info,logs,network,repairs,storage}/**"
|
||||
- src/panels/config/dashboard/ha-config-updates.ts
|
||||
- "src/dialogs/{repairs-flow,restart}/**"
|
||||
- "src/data/{analytics,entity_id_format,error_log,hardware,network,repairs,system_health,system_log,system_log_report,update}.ts"
|
||||
|
||||
"Tests: E2E":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- test/e2e/**
|
||||
|
||||
"Tests: App":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- test/e2e/app.spec.ts
|
||||
- test/e2e/app/**
|
||||
- test/e2e/playwright.app.config.ts
|
||||
|
||||
"Tests: Demo":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- test/e2e/demo.spec.ts
|
||||
- test/e2e/playwright.demo.config.ts
|
||||
|
||||
"Tests: Design":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- test/e2e/gallery.spec.ts
|
||||
- test/e2e/playwright.gallery.config.ts
|
||||
|
||||
"Tests: Unit":
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- test/*.ts
|
||||
- "test/!(e2e)/**"
|
||||
|
||||
Theming:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/resources/theme/**
|
||||
- src/state/themes-mixin.ts
|
||||
- src/common/dom/apply_themes_on_element.ts
|
||||
- "src/data/{theme,ws-themes}.ts"
|
||||
|
||||
To-do:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/todo/**
|
||||
- src/panels/lovelace/**/*todo*
|
||||
- src/data/todo.ts
|
||||
|
||||
Tools:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/tools/**
|
||||
|
||||
Voice:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/voice-assistants/**
|
||||
- "src/dialogs/{voice-assistant-setup,voice-command-dialog}/**"
|
||||
- src/components/ha-assist-chat.ts
|
||||
- "src/data/{assist_pipeline,assist_satellite,conversation,stt,tts,wake_word}.ts"
|
||||
|
||||
Zones:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- src/panels/config/zone/**
|
||||
- src/data/zone.ts
|
||||
@@ -1,8 +1,3 @@
|
||||
categories:
|
||||
- title: "Dependency updates"
|
||||
collapse-after: 3
|
||||
labels:
|
||||
- "Dependencies"
|
||||
template: |
|
||||
## What's Changed
|
||||
|
||||
|
||||
@@ -1,289 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Checks npm registry metadata for the direct dependencies in package.json:
|
||||
// deprecation, source repository and provenance. On pull requests only newly
|
||||
// added packages are checked, and a deprecated one fails the check. Scheduled
|
||||
// and manual runs report on every direct dependency without failing. Invoked
|
||||
// from the `npm-metadata` job in .github/workflows/dependency-review.yaml via
|
||||
// actions/github-script:
|
||||
//
|
||||
// const { default: checkNpmMetadata } =
|
||||
// await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-npm-metadata.mts`);
|
||||
// await checkNpmMetadata({ github, context, core });
|
||||
|
||||
import type { Octokit } from "@octokit/rest";
|
||||
import type {
|
||||
Context,
|
||||
Core,
|
||||
GitHubScriptArgs,
|
||||
PullRequestPayload,
|
||||
} from "./github-script.d.ts";
|
||||
import { withRetry } from "./github-retry.mts";
|
||||
|
||||
// Scheduled and manual runs have no pull request
|
||||
type Payload = Partial<PullRequestPayload>;
|
||||
|
||||
type Section =
|
||||
| "dependencies"
|
||||
| "devDependencies"
|
||||
| "optionalDependencies"
|
||||
| "peerDependencies";
|
||||
|
||||
type PackageJson = Partial<Record<Section, Record<string, string>>>;
|
||||
|
||||
interface Dependency {
|
||||
name: string;
|
||||
// The package npm installs, which differs from name for npm: aliases
|
||||
registryName: string;
|
||||
version: string;
|
||||
section: Section;
|
||||
}
|
||||
|
||||
// The fields read from a version document on registry.npmjs.org
|
||||
interface NpmManifest {
|
||||
deprecated?: string;
|
||||
repository?: string | { url?: string };
|
||||
dist?: { attestations?: object };
|
||||
}
|
||||
|
||||
interface Result {
|
||||
name: string;
|
||||
version: string;
|
||||
section: Section;
|
||||
skipped?: string;
|
||||
deprecated?: string;
|
||||
repository?: string;
|
||||
provenance?: boolean;
|
||||
}
|
||||
|
||||
const SECTIONS: Section[] = [
|
||||
"dependencies",
|
||||
"devDependencies",
|
||||
"optionalDependencies",
|
||||
"peerDependencies",
|
||||
];
|
||||
|
||||
const EXACT_VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
||||
|
||||
const NPM_ALIAS = /^npm:((?:@[^/]+\/)?[^@]+)@(.+)$/;
|
||||
|
||||
const CONCURRENCY = 8;
|
||||
|
||||
// Returns undefined when the registry reports 404, and throws on any other
|
||||
// failure so a registry outage fails the job instead of skipping the check.
|
||||
const fetchJson = async <T,>(url: string): Promise<T | undefined> => {
|
||||
const response = await fetch(url);
|
||||
|
||||
if (response.status === 404) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Request to ${url} failed: ${response.status} ${response.statusText}`
|
||||
);
|
||||
}
|
||||
|
||||
return JSON.parse(await response.text());
|
||||
};
|
||||
|
||||
const readPackageJson = async (
|
||||
github: Octokit,
|
||||
context: Context<Payload>,
|
||||
ref: string
|
||||
): Promise<PackageJson> => {
|
||||
const { data } = await withRetry(`package.json lookup at ${ref}`, () =>
|
||||
github.rest.repos.getContent({
|
||||
...context.repo,
|
||||
path: "package.json",
|
||||
ref,
|
||||
mediaType: { format: "raw" },
|
||||
})
|
||||
);
|
||||
|
||||
// The raw media type returns the file contents as a string, but Octokit
|
||||
// types the response as the JSON form
|
||||
if (typeof data !== "string") {
|
||||
throw new Error("Expected raw package.json contents");
|
||||
}
|
||||
|
||||
return JSON.parse(data);
|
||||
};
|
||||
|
||||
const listDependencies = (pkg: PackageJson): Dependency[] =>
|
||||
SECTIONS.flatMap((section) =>
|
||||
Object.entries(pkg[section] ?? {}).map(([name, spec]) => {
|
||||
// npm: aliases install another package, e.g. npm:[email protected]
|
||||
const alias = spec.match(NPM_ALIAS);
|
||||
|
||||
return {
|
||||
name,
|
||||
registryName: alias?.[1] ?? name,
|
||||
version: alias?.[2] ?? spec,
|
||||
section,
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
const repositoryUrl = (repository: NpmManifest["repository"]) => {
|
||||
const url = typeof repository === "string" ? repository : repository?.url;
|
||||
|
||||
return url?.replace(/^git\+/, "").replace(/\.git$/, "");
|
||||
};
|
||||
|
||||
const checkPackage = async ({
|
||||
name,
|
||||
registryName,
|
||||
version,
|
||||
section,
|
||||
}: Dependency): Promise<Result> => {
|
||||
const result = {
|
||||
name: registryName === name ? name : `${name} (npm:${registryName})`,
|
||||
version,
|
||||
section,
|
||||
};
|
||||
|
||||
if (!EXACT_VERSION.test(version)) {
|
||||
return { ...result, skipped: "not an exact version" };
|
||||
}
|
||||
|
||||
const manifest = await fetchJson<NpmManifest>(
|
||||
`https://registry.npmjs.org/${encodeURIComponent(registryName)}/${version}`
|
||||
);
|
||||
|
||||
if (!manifest) {
|
||||
return { ...result, skipped: "not found on the npm registry" };
|
||||
}
|
||||
|
||||
return {
|
||||
...result,
|
||||
deprecated: manifest.deprecated,
|
||||
repository: repositoryUrl(manifest.repository),
|
||||
provenance: Boolean(manifest.dist?.attestations),
|
||||
};
|
||||
};
|
||||
|
||||
const checkAll = async (dependencies: Dependency[]) => {
|
||||
const results: Result[] = [];
|
||||
|
||||
for (let i = 0; i < dependencies.length; i += CONCURRENCY) {
|
||||
results.push(
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
...(await Promise.all(
|
||||
dependencies.slice(i, i + CONCURRENCY).map(checkPackage)
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
return results;
|
||||
};
|
||||
|
||||
const writeSummary = async (core: Core, heading: string, results: Result[]) => {
|
||||
await core.summary
|
||||
.addHeading(heading, 2)
|
||||
.addTable([
|
||||
[
|
||||
"Package",
|
||||
"Version",
|
||||
"Section",
|
||||
"Deprecated",
|
||||
"Provenance",
|
||||
"Repository",
|
||||
].map((data) => ({ data, header: true })),
|
||||
...results.map((result) =>
|
||||
result.skipped
|
||||
? [
|
||||
result.name,
|
||||
result.version,
|
||||
result.section,
|
||||
`skipped: ${result.skipped}`,
|
||||
"-",
|
||||
"-",
|
||||
]
|
||||
: [
|
||||
result.name,
|
||||
result.version,
|
||||
result.section,
|
||||
result.deprecated ? "yes" : "no",
|
||||
result.provenance ? "yes" : "no",
|
||||
result.repository ?? "none",
|
||||
]
|
||||
),
|
||||
])
|
||||
.write();
|
||||
};
|
||||
|
||||
export default async function checkNpmMetadata({
|
||||
github,
|
||||
context,
|
||||
core,
|
||||
}: GitHubScriptArgs<Payload>) {
|
||||
const pr = context.payload.pull_request;
|
||||
|
||||
if (!pr) {
|
||||
const pkg = await readPackageJson(github, context, context.sha);
|
||||
const results = await checkAll(listDependencies(pkg));
|
||||
|
||||
const flagged = (result: Result) =>
|
||||
Number(
|
||||
Boolean(result.skipped || result.deprecated || !result.repository)
|
||||
);
|
||||
|
||||
results.sort(
|
||||
(a, b) => flagged(b) - flagged(a) || a.name.localeCompare(b.name)
|
||||
);
|
||||
await writeSummary(core, "Direct dependencies", results);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const [base, head] = await Promise.all([
|
||||
readPackageJson(github, context, pr.base.sha),
|
||||
readPackageJson(github, context, pr.head.sha),
|
||||
]);
|
||||
|
||||
// Compare the packages npm installs, so pointing an npm: alias at another
|
||||
// package counts as new, but moving a package between sections does not
|
||||
const existing = new Set(
|
||||
listDependencies(base).map(({ registryName }) => registryName)
|
||||
);
|
||||
|
||||
const added = listDependencies(head).filter(
|
||||
({ registryName }) => !existing.has(registryName)
|
||||
);
|
||||
|
||||
if (added.length === 0) {
|
||||
core.info("No new dependencies");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const results = await checkAll(added);
|
||||
const annotation = { file: "package.json" };
|
||||
|
||||
for (const result of results) {
|
||||
const label = `${result.name}@${result.version}`;
|
||||
|
||||
if (result.skipped) {
|
||||
core.warning(`${label}: ${result.skipped}, not checked`, annotation);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (result.deprecated) {
|
||||
core.error(`${label} is deprecated: ${result.deprecated}`, annotation);
|
||||
}
|
||||
|
||||
if (!result.repository) {
|
||||
core.warning(`${label} has no source repository`, annotation);
|
||||
}
|
||||
|
||||
if (!result.provenance) {
|
||||
core.notice(`${label} was published without provenance`, annotation);
|
||||
}
|
||||
}
|
||||
|
||||
await writeSummary(core, "New dependencies", results);
|
||||
|
||||
if (results.some((result) => result.deprecated)) {
|
||||
core.setFailed("New dependencies must not be deprecated on npm");
|
||||
}
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Checks that a pull request follows the contribution standards: it must use the
|
||||
// PR template, tick exactly one "Type of change" option, and describe the change.
|
||||
// Labels and comments the PR when it does not, and fails the check so it blocks
|
||||
// merging. Invoked from the `check` job in .github/workflows/pull-request-standards.yaml
|
||||
// via actions/github-script:
|
||||
//
|
||||
// const { default: checkStandards } =
|
||||
// await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-pull-request-standards.mts`);
|
||||
// await checkStandards({ github, context, core });
|
||||
|
||||
import type {
|
||||
GitHubScriptArgs,
|
||||
PullRequestPayload,
|
||||
} from "./github-script.d.ts";
|
||||
import { withRetry } from "./github-retry.mts";
|
||||
|
||||
export default async function checkPullRequestStandards({
|
||||
github,
|
||||
context,
|
||||
core,
|
||||
}: GitHubScriptArgs<PullRequestPayload>) {
|
||||
const pr = context.payload.pull_request;
|
||||
|
||||
// Exempt bots (Copilot agent, dependabot), drafts, and maintainers.
|
||||
if (pr.user.type === "Bot") {
|
||||
core.info(`Skipping bot author: ${pr.user.login}`);
|
||||
return;
|
||||
}
|
||||
if (pr.draft) {
|
||||
core.info("Skipping draft pull request");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await withRetry("organization membership check", () =>
|
||||
github.rest.orgs.checkMembershipForUser({
|
||||
org: "home-assistant",
|
||||
username: pr.user.login,
|
||||
})
|
||||
);
|
||||
core.info(`Skipping organization member: ${pr.user.login}`);
|
||||
return;
|
||||
} catch (_error) {
|
||||
core.info(
|
||||
`${pr.user.login} is not an organization member, checking standards`
|
||||
);
|
||||
}
|
||||
|
||||
const label = "Needs Template";
|
||||
const marker = "<!-- pr-standards-check -->";
|
||||
const { owner, repo } = context.repo;
|
||||
const issue_number = pr.number;
|
||||
|
||||
let body = pr.body || "";
|
||||
let previous;
|
||||
do {
|
||||
previous = body;
|
||||
body = body.replace(/<!--[\s\S]*?-->/g, "");
|
||||
} while (body !== previous);
|
||||
const normalized = body.toLowerCase();
|
||||
|
||||
// Ignore 404s from mutations that race manual edits or cancelled runs.
|
||||
const ignoreMissing = async <T,>(fn: () => Promise<T>) => {
|
||||
try {
|
||||
await fn();
|
||||
} catch (error) {
|
||||
if (
|
||||
typeof error === "object" &&
|
||||
error !== null &&
|
||||
"status" in error &&
|
||||
error.status === 404
|
||||
) {
|
||||
core.info("Target already removed, nothing to do");
|
||||
return;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// Hide/restore our comment via GraphQL (REST cannot minimize).
|
||||
const setMinimized = async (subjectId: string, minimized: boolean) => {
|
||||
const mutation = minimized
|
||||
? `mutation($id: ID!) {
|
||||
minimizeComment(input: { subjectId: $id, classifier: RESOLVED }) {
|
||||
clientMutationId
|
||||
}
|
||||
}`
|
||||
: `mutation($id: ID!) {
|
||||
unminimizeComment(input: { subjectId: $id }) {
|
||||
clientMutationId
|
||||
}
|
||||
}`;
|
||||
try {
|
||||
await withRetry(`comment ${minimized ? "minimize" : "restore"}`, () =>
|
||||
github.graphql(mutation, { id: subjectId })
|
||||
);
|
||||
} catch (error) {
|
||||
core.info(
|
||||
`Could not ${minimized ? "minimize" : "restore"} comment: ${error instanceof Error ? error.message : error}`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Content of a "## <name>" section, or null when the heading is absent.
|
||||
const section = (name: string) => {
|
||||
const match = body.match(
|
||||
new RegExp(`##\\s${name}([\\s\\S]*?)(?=\\n##\\s|$)`, "i")
|
||||
);
|
||||
return match ? match[1] : null;
|
||||
};
|
||||
|
||||
const problems = [];
|
||||
|
||||
const requiredHeadings = [
|
||||
"## proposed change",
|
||||
"## type of change",
|
||||
"## checklist",
|
||||
];
|
||||
if (requiredHeadings.some((h) => !normalized.includes(h))) {
|
||||
problems.push(
|
||||
"Use the pull request template without removing its sections."
|
||||
);
|
||||
}
|
||||
|
||||
const typeOfChange = section("type of change");
|
||||
if (typeOfChange !== null) {
|
||||
const ticked = (typeOfChange.match(/-\s*\[[xX]\]/g) || []).length;
|
||||
if (ticked !== 1) {
|
||||
problems.push('Select exactly one option under "Type of change".');
|
||||
}
|
||||
}
|
||||
|
||||
const proposedChange = section("proposed change");
|
||||
if (proposedChange !== null && proposedChange.trim().length === 0) {
|
||||
problems.push('Describe your changes under "Proposed change".');
|
||||
}
|
||||
|
||||
const isValid = problems.length === 0;
|
||||
|
||||
const comments = await withRetry("comment list", () =>
|
||||
github.paginate(github.rest.issues.listComments, {
|
||||
owner,
|
||||
repo,
|
||||
issue_number,
|
||||
per_page: 100,
|
||||
})
|
||||
);
|
||||
|
||||
const existing = comments.find((c) => c.body?.includes(marker));
|
||||
const hasLabel = pr.labels.some((l) => l.name === label);
|
||||
|
||||
if (isValid) {
|
||||
core.info("Pull request standards met");
|
||||
|
||||
if (hasLabel) {
|
||||
await ignoreMissing(() =>
|
||||
withRetry("label removal", () =>
|
||||
github.rest.issues.removeLabel({
|
||||
owner,
|
||||
repo,
|
||||
issue_number,
|
||||
name: label,
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
if (existing) {
|
||||
await setMinimized(existing.node_id, true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
core.info(`Pull request standards not met:\n- ${problems.join("\n- ")}`);
|
||||
|
||||
if (!hasLabel) {
|
||||
await withRetry("label addition", () =>
|
||||
github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number,
|
||||
labels: [label],
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const message =
|
||||
`${marker}\n` +
|
||||
`Hey @${pr.user.login}!\n\n` +
|
||||
`Thank you for your contribution! To help reviewers, please update ` +
|
||||
`this pull request to follow our pull request standards:\n\n` +
|
||||
problems.map((p) => `- ${p}`).join("\n") +
|
||||
`\n\n` +
|
||||
`Please complete the ` +
|
||||
`[PR template](https://github.com/home-assistant/frontend/blob/dev/.github/PULL_REQUEST_TEMPLATE.md?plain=1) ` +
|
||||
`and see the [developer docs](https://developers.home-assistant.io/docs/review-process) ` +
|
||||
`for more on creating a great pull request (see point 6).`;
|
||||
|
||||
if (existing) {
|
||||
await withRetry("comment update", () =>
|
||||
github.rest.issues.updateComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: existing.id,
|
||||
body: message,
|
||||
})
|
||||
);
|
||||
await setMinimized(existing.node_id, false);
|
||||
} else {
|
||||
// Not retried, as a retry after GitHub created the comment would post it twice
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number,
|
||||
body: message,
|
||||
});
|
||||
}
|
||||
|
||||
// Fail this check so it can block the PR from being merged
|
||||
core.setFailed(`Pull request standards not met:\n- ${problems.join("\n- ")}`);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Restricts Task issues to organization members: closes and labels the issue with
|
||||
// an explanatory comment when the author is not an org member. Invoked from the
|
||||
// `check-authorization` job in .github/workflows/restrict-task-creation.yaml via
|
||||
// actions/github-script:
|
||||
//
|
||||
// const { default: checkTaskAuthorization } =
|
||||
// await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-task-authorization.mts`);
|
||||
// await checkTaskAuthorization({ github, context, core });
|
||||
|
||||
import type { GitHubScriptArgs, IssuePayload } from "./github-script.d.ts";
|
||||
import { withRetry } from "./github-retry.mts";
|
||||
|
||||
export default async function checkTaskAuthorization({
|
||||
github,
|
||||
context,
|
||||
core,
|
||||
}: GitHubScriptArgs<IssuePayload>) {
|
||||
const issueAuthor = context.payload.issue.user.login;
|
||||
|
||||
// Check if user is an organization member
|
||||
try {
|
||||
await withRetry("organization membership check", () =>
|
||||
github.rest.orgs.checkMembershipForUser({
|
||||
org: "home-assistant",
|
||||
username: issueAuthor,
|
||||
})
|
||||
);
|
||||
core.info(`✅ ${issueAuthor} is an organization member`);
|
||||
return; // Authorized
|
||||
} catch (_error) {
|
||||
core.info(`❌ ${issueAuthor} is not authorized to create Task issues`);
|
||||
}
|
||||
|
||||
// Close the issue with a comment. Not retried, as a retry after GitHub
|
||||
// created the comment would post it twice.
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body:
|
||||
`Hi @${issueAuthor}, thank you for your contribution!\n\n` +
|
||||
`Task issues are restricted to Open Home Foundation staff and authorized contributors.\n\n` +
|
||||
`If you would like to:\n` +
|
||||
`- Report a bug: Please use the [bug report form](https://github.com/home-assistant/frontend/issues/new?template=bug_report.yml)\n` +
|
||||
`- Request a feature: Please submit to [Feature Requests](https://github.com/orgs/home-assistant/discussions)\n\n` +
|
||||
`If you believe you should have access to create Task issues, please contact the maintainers.`,
|
||||
});
|
||||
|
||||
await withRetry("issue close", () =>
|
||||
github.rest.issues.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
state: "closed",
|
||||
})
|
||||
);
|
||||
|
||||
// Add a label to indicate this was auto-closed
|
||||
await withRetry("auto-closed label", () =>
|
||||
github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ["auto-closed"],
|
||||
})
|
||||
);
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
// Retries GitHub API requests with jittered exponential backoff. Shared by the
|
||||
// workflow scripts in this directory, test/e2e/post-report-comment.mjs and the
|
||||
// fetch-nightly-translations gulp task. Only wrap requests that are safe to
|
||||
// repeat: a create that fails after GitHub has applied it would run twice.
|
||||
//
|
||||
// This replaces @octokit/plugin-retry, which only retries HTTP error statuses
|
||||
// on a fixed 1s, 4s, 9s delay with no jitter or logging. GitHub can also
|
||||
// answer 200 with briefly stale data, such as the nightly translations lookup
|
||||
// returning an old run with no artifact, and the plugin cannot retry that.
|
||||
// github-script also leaves its built-in retries off by default.
|
||||
|
||||
const RETRIES = 3;
|
||||
|
||||
const BASE_DELAY = 1000; // ms
|
||||
|
||||
const MAX_DELAY = 10000; // ms
|
||||
|
||||
const TRANSIENT_STATUSES = new Set([408, 429, 500, 502, 503, 504]);
|
||||
|
||||
// Throw from a request to retry a response GitHub may answer differently on
|
||||
// the next attempt, such as briefly stale data
|
||||
export class RetryableError extends Error {}
|
||||
|
||||
// Octokit reports network failures as status 500
|
||||
const isRetryable = (err: unknown) => {
|
||||
if (err instanceof RetryableError) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(err instanceof Error) || !("status" in err)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const status = Number(err.status);
|
||||
|
||||
return (
|
||||
TRANSIENT_STATUSES.has(status) ||
|
||||
(status === 403 && /rate limit/i.test(err.message))
|
||||
);
|
||||
};
|
||||
|
||||
export async function withRetry<T>(
|
||||
label: string,
|
||||
request: () => Promise<T>
|
||||
): Promise<T> {
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
try {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
return await request();
|
||||
} catch (err) {
|
||||
if (attempt > RETRIES || !isRetryable(err)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
const delay =
|
||||
Math.min(BASE_DELAY * 2 ** (attempt - 1), MAX_DELAY) *
|
||||
(0.8 + Math.random() * 0.4);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
`Retrying ${label} after ${(delay / 1000).toFixed(1)}s (attempt ${attempt}/${RETRIES}): ${err instanceof Error ? err.message : err}`
|
||||
);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
// The arguments actions/github-script passes to the scripts in this directory,
|
||||
// limited to the parts they use.
|
||||
import type { Octokit } from "@octokit/rest";
|
||||
|
||||
export type SummaryTableCell = string | { data: string; header?: boolean };
|
||||
|
||||
export interface Summary {
|
||||
addHeading(text: string, level?: number): Summary;
|
||||
addRaw(text: string): Summary;
|
||||
addTable(rows: SummaryTableCell[][]): Summary;
|
||||
write(): Promise<Summary>;
|
||||
}
|
||||
|
||||
export interface AnnotationProperties {
|
||||
file?: string;
|
||||
}
|
||||
|
||||
export interface Core {
|
||||
info(message: string): void;
|
||||
notice(message: string, properties?: AnnotationProperties): void;
|
||||
warning(message: string, properties?: AnnotationProperties): void;
|
||||
error(message: string, properties?: AnnotationProperties): void;
|
||||
setFailed(message: string): void;
|
||||
summary: Summary;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
login: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface PullRequestPayload {
|
||||
pull_request: {
|
||||
number: number;
|
||||
body: string | null;
|
||||
draft: boolean;
|
||||
user: User;
|
||||
labels: { name: string }[];
|
||||
base: { sha: string };
|
||||
head: { sha: string };
|
||||
};
|
||||
}
|
||||
|
||||
export interface IssuePayload {
|
||||
issue: {
|
||||
user: User;
|
||||
};
|
||||
}
|
||||
|
||||
export interface Context<Payload> {
|
||||
sha: string;
|
||||
repo: { owner: string; repo: string };
|
||||
issue: { owner: string; repo: string; number: number };
|
||||
payload: Payload;
|
||||
}
|
||||
|
||||
export interface GitHubScriptArgs<Payload> {
|
||||
github: Octokit;
|
||||
context: Context<Payload>;
|
||||
core: Core;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/**
|
||||
* Builds a section of a workflow run's summary: a heading, a table of rows and
|
||||
* the warnings raised along the way.
|
||||
*
|
||||
* Warnings are also logged as annotations, so a script can report problems
|
||||
* without failing its step.
|
||||
*/
|
||||
|
||||
import type { AnnotationProperties, Core } from "./github-script.d.ts";
|
||||
|
||||
interface SummaryOptions {
|
||||
heading: string;
|
||||
columns: string[];
|
||||
// Shown instead of the table when no rows were added
|
||||
empty: string;
|
||||
}
|
||||
|
||||
export const createSummary = (
|
||||
core: Core,
|
||||
{ heading, columns, empty }: SummaryOptions
|
||||
) => {
|
||||
const rows: string[][] = [];
|
||||
const warnings: string[] = [];
|
||||
|
||||
return {
|
||||
addRow: (...cells: string[]) => {
|
||||
rows.push(cells);
|
||||
},
|
||||
|
||||
warn: (message: string, properties?: AnnotationProperties) => {
|
||||
core.warning(message, properties);
|
||||
warnings.push(message);
|
||||
},
|
||||
|
||||
write: async () => {
|
||||
core.summary.addHeading(heading, 2);
|
||||
|
||||
if (rows.length > 0) {
|
||||
core.summary.addTable([
|
||||
columns.map((data) => ({ data, header: true })),
|
||||
...rows,
|
||||
]);
|
||||
} else {
|
||||
core.summary.addRaw(`${empty}\n`);
|
||||
}
|
||||
|
||||
if (warnings.length > 0) {
|
||||
core.summary
|
||||
.addHeading("Warnings", 3)
|
||||
.addRaw(`${warnings.map((warning) => `- ${warning}`).join("\n")}\n`);
|
||||
}
|
||||
|
||||
await core.summary.write();
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,324 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Applies the Companion App, Home Assistant Link, Labs and Supervisor labels
|
||||
* to pull requests.
|
||||
*
|
||||
* These areas are often changed from code outside their folders, which
|
||||
* actions/labeler can't see, so this script owns them and .github/labeler.yml
|
||||
* leaves them out.
|
||||
*
|
||||
* A label matches when the pull request:
|
||||
* - changes a file in one of the area's paths, or
|
||||
* - adds or removes a line that uses the area's API, such as gating a feature
|
||||
* behind Labs or only showing it on Supervisor installs.
|
||||
*
|
||||
* Like actions/labeler, a label is removed once the pull request no longer
|
||||
* matches, including one added by hand.
|
||||
*
|
||||
* Invoked from the `triage` job in .github/workflows/labeler.yaml.
|
||||
*/
|
||||
|
||||
import type {
|
||||
GitHubScriptArgs,
|
||||
PullRequestPayload,
|
||||
} from "./github-script.d.ts";
|
||||
import { withRetry } from "./github-retry.mts";
|
||||
import { createSummary } from "./github-summary.mts";
|
||||
|
||||
const RULES: { label: string; paths: RegExp[]; pattern: RegExp }[] = [
|
||||
{
|
||||
label: "Companion App",
|
||||
paths: [
|
||||
/^src\/external_app\//,
|
||||
/^src\/data\/external\.ts$/,
|
||||
/^src\/util\/is_ios\.ts$/,
|
||||
],
|
||||
// Reads or messages the companion app the frontend is running in, or
|
||||
// imports its modules. Matches imports of data/external rather than
|
||||
// isExternal, which is also a common local name.
|
||||
pattern:
|
||||
/\bauth\??\.external\b(?:[!?]*\.\w+)*(?:\([^)]*)?|\bfireExternalBusMessage\([^)]*|(?:\bimport\s[^;]*?from\s*|\bimport\(\s*)["'][^"']*\/(?:external_app\/[^"']*|data\/external)["']/g,
|
||||
},
|
||||
{
|
||||
label: "Home Assistant Link",
|
||||
paths: [
|
||||
/^src\/panels\/config\/cloud\//,
|
||||
/^src\/data\/cloud\//,
|
||||
/^src\/data\/cloud\.ts$/,
|
||||
],
|
||||
// Only runs when Home Assistant Link is set up
|
||||
pattern: /isComponentLoaded\([^)]*["']cloud["']/g,
|
||||
},
|
||||
{
|
||||
label: "Labs",
|
||||
paths: [/^src\/panels\/config\/labs\//, /^src\/data\/labs\.ts$/],
|
||||
// Gates a feature behind, or toggles, a Labs preview feature
|
||||
pattern:
|
||||
/\b(?:subscribeLabFeatures?|fetchLabFeatures|labsUpdatePreviewFeature)\([^)]*/g,
|
||||
},
|
||||
{
|
||||
label: "Supervisor",
|
||||
paths: [
|
||||
/^src\/panels\/config\/apps\//,
|
||||
/^src\/panels\/app\//,
|
||||
/^src\/data\/hassio\//,
|
||||
/^src\/data\/supervisor\//,
|
||||
],
|
||||
// Only runs on installs with the Supervisor
|
||||
pattern: /isComponentLoaded\([^)]*["']hassio["']/g,
|
||||
},
|
||||
];
|
||||
|
||||
interface HunkSide {
|
||||
lines: string[];
|
||||
changed: boolean[];
|
||||
}
|
||||
|
||||
interface CodeChange {
|
||||
code: string;
|
||||
filename: string;
|
||||
}
|
||||
|
||||
const parseHunks = (patch: string) => {
|
||||
const hunks: { before: HunkSide; after: HunkSide }[] = [];
|
||||
|
||||
for (const line of patch.split("\n")) {
|
||||
if (line.startsWith("@@")) {
|
||||
hunks.push({
|
||||
before: { lines: [], changed: [] },
|
||||
after: { lines: [], changed: [] },
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
const hunk = hunks.at(-1);
|
||||
|
||||
if (!hunk || line.startsWith("\\")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const text = line.slice(1);
|
||||
|
||||
if (!line.startsWith("+")) {
|
||||
hunk.before.lines.push(text);
|
||||
hunk.before.changed.push(line.startsWith("-"));
|
||||
}
|
||||
|
||||
if (!line.startsWith("-")) {
|
||||
hunk.after.lines.push(text);
|
||||
hunk.after.changed.push(line.startsWith("+"));
|
||||
}
|
||||
}
|
||||
|
||||
return hunks;
|
||||
};
|
||||
|
||||
// Ignores whitespace and trailing commas outside strings, as Prettier changes
|
||||
// them when wrapping
|
||||
const normaliseCode = (code: string) => {
|
||||
const parts = code.split(
|
||||
/("(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'|`(?:[^`\\]|\\.)*`)/
|
||||
);
|
||||
|
||||
return parts
|
||||
.map((part, i) => {
|
||||
if (i % 2 === 1) {
|
||||
return part;
|
||||
}
|
||||
|
||||
const stripped = part.replace(/\s+/g, "").replace(/,(?=[}\])])/g, "");
|
||||
|
||||
return i === parts.length - 1 ? stripped.replace(/,$/, "") : stripped;
|
||||
})
|
||||
.join("");
|
||||
};
|
||||
|
||||
// Matches whole calls, which can span lines, that touch a changed line
|
||||
const changedMatches = (side: HunkSide, pattern: RegExp) => {
|
||||
const text = side.lines.join("\n");
|
||||
const matches: string[] = [];
|
||||
|
||||
for (const match of text.matchAll(pattern)) {
|
||||
const first = text.slice(0, match.index).split("\n").length - 1;
|
||||
const last = first + match[0].split("\n").length - 1;
|
||||
|
||||
if (side.changed.slice(first, last + 1).some(Boolean)) {
|
||||
matches.push(normaliseCode(match[0]));
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
};
|
||||
|
||||
// Matches that were only moved, reindented or reformatted cancel out in pairs,
|
||||
// returning a file with a match that doesn't
|
||||
const unmatchedChange = (added: CodeChange[], removed: CodeChange[]) => {
|
||||
const remaining = [...removed];
|
||||
|
||||
for (const change of added) {
|
||||
const index = remaining.findIndex(({ code }) => code === change.code);
|
||||
|
||||
if (index === -1) {
|
||||
return change.filename;
|
||||
}
|
||||
|
||||
remaining.splice(index, 1);
|
||||
}
|
||||
|
||||
return remaining[0]?.filename;
|
||||
};
|
||||
|
||||
const describeError = (cause: unknown) =>
|
||||
cause instanceof Error ? cause.message : String(cause);
|
||||
|
||||
const isNotFound = (cause: unknown) =>
|
||||
cause instanceof Error && "status" in cause && cause.status === 404;
|
||||
|
||||
export default async function labelContent({
|
||||
github,
|
||||
context,
|
||||
core,
|
||||
}: GitHubScriptArgs<PullRequestPayload>) {
|
||||
const pr = context.payload.pull_request;
|
||||
|
||||
const summary = createSummary(core, {
|
||||
heading: "Content labels",
|
||||
columns: ["Label", "Change", "Reason"],
|
||||
empty: "No content labels changed.",
|
||||
});
|
||||
|
||||
if (process.env.LABELER_OUTCOME === "failure") {
|
||||
summary.warn(
|
||||
"Applying labels from .github/labeler.yml failed, see its step"
|
||||
);
|
||||
}
|
||||
|
||||
// Bot pull requests, such as Prettier bumps, rewrite code they don't change
|
||||
const checkCode = pr.user.type !== "Bot";
|
||||
|
||||
const { owner, repo } = context.repo;
|
||||
|
||||
let files;
|
||||
let existing: Set<string>;
|
||||
|
||||
try {
|
||||
// Read the current labels, as the event's snapshot can be stale by now
|
||||
const [fileList, labels] = await Promise.all([
|
||||
withRetry("pull request files", () =>
|
||||
github.paginate(github.rest.pulls.listFiles, {
|
||||
owner,
|
||||
repo,
|
||||
pull_number: pr.number,
|
||||
per_page: 100,
|
||||
})
|
||||
),
|
||||
withRetry("pull request labels", () =>
|
||||
github.paginate(github.rest.issues.listLabelsOnIssue, {
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pr.number,
|
||||
per_page: 100,
|
||||
})
|
||||
),
|
||||
]);
|
||||
|
||||
files = fileList;
|
||||
existing = new Set(labels.map((l) => l.name));
|
||||
} catch (error) {
|
||||
summary.warn(
|
||||
`Could not read the pull request's files and labels: ${describeError(error)}`
|
||||
);
|
||||
await summary.write();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const add: { label: string; reason: string }[] = [];
|
||||
const remove: string[] = [];
|
||||
|
||||
for (const rule of RULES) {
|
||||
const added: CodeChange[] = [];
|
||||
const removed: CodeChange[] = [];
|
||||
|
||||
if (checkCode) {
|
||||
for (const { filename, patch } of files) {
|
||||
for (const { before, after } of parseHunks(patch ?? "")) {
|
||||
for (const code of changedMatches(after, rule.pattern)) {
|
||||
added.push({ code, filename });
|
||||
}
|
||||
|
||||
for (const code of changedMatches(before, rule.pattern)) {
|
||||
removed.push({ code, filename });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Renames count for both locations, as moving a file out of an area changes it
|
||||
const match =
|
||||
files.find(({ filename, previous_filename }) =>
|
||||
rule.paths.some(
|
||||
(path) =>
|
||||
path.test(filename) ||
|
||||
(previous_filename !== undefined && path.test(previous_filename))
|
||||
)
|
||||
)?.filename ?? unmatchedChange(added, removed);
|
||||
|
||||
if (match && !existing.has(rule.label)) {
|
||||
core.info(`Adding ${rule.label} for ${match}`);
|
||||
add.push({ label: rule.label, reason: match });
|
||||
} else if (!match && existing.has(rule.label)) {
|
||||
core.info(`Removing ${rule.label}, no longer matched`);
|
||||
remove.push(rule.label);
|
||||
}
|
||||
}
|
||||
|
||||
const removals = await Promise.allSettled(
|
||||
remove.map((name) =>
|
||||
withRetry("label removal", () =>
|
||||
github.rest.issues.removeLabel({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pr.number,
|
||||
name,
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
removals.forEach((removal, i) => {
|
||||
const name = remove[i];
|
||||
|
||||
// Already removed, such as by hand or a run that raced this one
|
||||
if (removal.status === "fulfilled" || isNotFound(removal.reason)) {
|
||||
summary.addRow(name, "Removed", "No longer matched");
|
||||
} else {
|
||||
summary.warn(
|
||||
`Could not remove ${name}: ${describeError(removal.reason)}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (add.length > 0) {
|
||||
try {
|
||||
await withRetry("label addition", () =>
|
||||
github.rest.issues.addLabels({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: pr.number,
|
||||
labels: add.map(({ label }) => label),
|
||||
})
|
||||
);
|
||||
|
||||
for (const { label, reason } of add) {
|
||||
summary.addRow(label, "Added", reason);
|
||||
}
|
||||
} catch (error) {
|
||||
summary.warn(
|
||||
`Could not add ${add.map(({ label }) => label).join(", ")}: ${describeError(error)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await summary.write();
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2024",
|
||||
"lib": ["ES2024"],
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
// actions/github-script imports these directly, relying on Node's type stripping
|
||||
"erasableSyntaxOnly": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"skipLibCheck": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["*.mts", "*.d.ts"]
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Lint workflow files
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
paths:
|
||||
- ".github/actions/**"
|
||||
- ".github/workflows/**"
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
paths:
|
||||
- ".github/actions/**"
|
||||
- ".github/workflows/**"
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
actionlint:
|
||||
name: Check workflow files
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
# renovate: datasource=github-releases depName=rhysd/actionlint
|
||||
ACTIONLINT_VERSION: 1.7.12
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Run actionlint
|
||||
run: |
|
||||
curl -sSfL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
|
||||
| tar -xz actionlint
|
||||
./actionlint -color
|
||||
@@ -1,79 +0,0 @@
|
||||
name: Cast deployment
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
deploy_dev:
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy Development
|
||||
if: github.repository == 'home-assistant/frontend' && github.event_name != 'push'
|
||||
environment:
|
||||
name: Cast Development
|
||||
url: ${{ steps.deploy.outputs.netlify_url }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: dev
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Cast
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-cast
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: cast/dist
|
||||
alias: dev
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
||||
|
||||
deploy_master:
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy Production
|
||||
if: github.repository == 'home-assistant/frontend' && github.event_name == 'push'
|
||||
environment:
|
||||
name: Cast Production
|
||||
url: ${{ steps.deploy.outputs.netlify_url }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: master
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Cast
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-cast
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: cast/dist
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_CAST_SITE_ID }}
|
||||
+56
-111
@@ -1,7 +1,6 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
@@ -12,139 +11,85 @@ on:
|
||||
- master
|
||||
|
||||
env:
|
||||
NODE_VERSION: 14
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare-dependencies:
|
||||
name: Prepare dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Prepare dependencies
|
||||
uses: ./.github/actions/prepare-dependencies
|
||||
|
||||
lint:
|
||||
name: Lint and check format
|
||||
needs: prepare-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
- name: Check for duplicate dependencies
|
||||
run: pnpm dedupe --check
|
||||
- name: Build resources
|
||||
id: build_resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Setup lint cache
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: |
|
||||
node_modules/.cache/prettier
|
||||
node_modules/.cache/eslint
|
||||
node_modules/.cache/typescript
|
||||
key: lint-${{ github.sha }}
|
||||
restore-keys: lint-
|
||||
CI: true
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations gather-gallery-demos
|
||||
- name: Run eslint
|
||||
run: pnpm run lint:eslint --quiet
|
||||
run: yarn run lint:eslint
|
||||
- name: Run tsc
|
||||
if: ${{ !cancelled() && steps.build_resources.outcome == 'success' }}
|
||||
run: pnpm run lint:types
|
||||
- name: Run lit-analyzer
|
||||
if: ${{ !cancelled() && steps.build_resources.outcome == 'success' }}
|
||||
run: pnpm run lint:lit --quiet
|
||||
run: yarn run lint:types
|
||||
- name: Run prettier
|
||||
if: ${{ !cancelled() && steps.build_resources.outcome == 'success' }}
|
||||
run: pnpm run lint:prettier
|
||||
- name: Check dependency licenses
|
||||
if: ${{ !cancelled() && steps.build_resources.outcome == 'success' }}
|
||||
run: pnpm run lint:licenses
|
||||
- name: Check the bundled map sprite sheet
|
||||
if: ${{ !cancelled() }}
|
||||
run: ./node_modules/.bin/gulp check-map-sprites
|
||||
run: yarn run lint:prettier
|
||||
- name: Check for duplicate dependencies
|
||||
run: yarn dedupe --check
|
||||
test:
|
||||
name: Run tests
|
||||
needs: prepare-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CI: true
|
||||
- name: Run Tests
|
||||
run: pnpm run test
|
||||
run: yarn run test
|
||||
build:
|
||||
name: Build frontend
|
||||
needs:
|
||||
- lint
|
||||
- test
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
# Read-only reuse of the rspack cache written by the nightly (see
|
||||
# nightly.yaml). rspack itself decides what is still valid (version +
|
||||
# buildDependencies + node_modules snapshot), so the GHA key just restores
|
||||
# the latest nightly cache; no fingerprint, and no save step (CI never
|
||||
# writes the shared cache).
|
||||
- name: Restore rspack cache
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .rspack-cache
|
||||
key: rspack-cache-${{ runner.os }}-${{ github.run_id }}
|
||||
restore-keys: |
|
||||
rspack-cache-${{ runner.os }}-
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
env:
|
||||
CI: true
|
||||
- name: Build Application
|
||||
uses: ./.github/actions/build
|
||||
run: ./node_modules/.bin/gulp build-app
|
||||
env:
|
||||
IS_TEST: "true"
|
||||
supervisor:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
target: build-app
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
is-test: true
|
||||
rspack-cache: readonly
|
||||
- name: Upload bundle stats
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: frontend-bundle-stats
|
||||
path: build/stats/*.json
|
||||
if-no-files-found: error
|
||||
- name: Check entrypoint bundle size budget
|
||||
run: pnpm run check-bundlesize
|
||||
- name: Upload frontend build
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: frontend-build
|
||||
path: hass_frontend/
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
env:
|
||||
CI: true
|
||||
- name: Build Application
|
||||
run: ./node_modules/.bin/gulp build-hassio
|
||||
env:
|
||||
IS_TEST: "true"
|
||||
@@ -1,43 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches:
|
||||
- dev
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 360
|
||||
permissions:
|
||||
contents: read # To check out the repository
|
||||
security-events: write # To upload CodeQL results
|
||||
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||
with:
|
||||
languages: javascript-typescript
|
||||
build-mode: none
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2
|
||||
with:
|
||||
category: "/language:javascript-typescript"
|
||||
@@ -0,0 +1,60 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev, master]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [dev]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Override automatic language detection by changing the below list
|
||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||
language: ['javascript']
|
||||
# Learn more...
|
||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
@@ -1,34 +0,0 @@
|
||||
name: Copilot Setup Steps
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/copilot-setup-steps.yml
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
copilot-setup-steps:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
|
||||
- name: Skip fetching nightly translations
|
||||
run: echo "SKIP_FETCH_NIGHTLY_TRANSLATIONS=1" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
@@ -0,0 +1,35 @@
|
||||
name: Demo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
env:
|
||||
NODE_VERSION: 14
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
env:
|
||||
CI: true
|
||||
- name: Build Demo
|
||||
run: ./node_modules/.bin/gulp build-demo
|
||||
- name: Deploy to Netlify
|
||||
uses: netlify/actions/cli@master
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
|
||||
with:
|
||||
args: deploy --dir=demo/dist --prod
|
||||
@@ -1,79 +0,0 @@
|
||||
name: Demo deployment
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
deploy_dev:
|
||||
runs-on: ubuntu-latest
|
||||
name: Demo Development
|
||||
if: github.repository == 'home-assistant/frontend' && (github.event_name != 'push' || github.ref_name != 'master')
|
||||
environment:
|
||||
name: Demo Development
|
||||
url: ${{ steps.deploy.outputs.unique_deploy_url }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: dev
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Demo
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-demo
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: demo/dist
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_DEMO_DEV_SITE_ID }}
|
||||
|
||||
deploy_master:
|
||||
runs-on: ubuntu-latest
|
||||
name: Demo Production
|
||||
if: github.repository == 'home-assistant/frontend' && github.event_name == 'push' && github.ref_name == 'master'
|
||||
environment:
|
||||
name: Demo Production
|
||||
url: ${{ steps.deploy.outputs.netlify_url }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
ref: master
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Demo
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-demo
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: demo/dist
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_DEMO_SITE_ID }}
|
||||
@@ -1,55 +0,0 @@
|
||||
name: Dependency review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- package.json
|
||||
- pnpm-lock.yaml
|
||||
- pnpm-workspace.yaml
|
||||
schedule:
|
||||
- cron: "0 6 1 * *" # Monthly report on all direct dependencies
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
name: Review dependency changes
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read # To compare the dependency graph between base and head
|
||||
steps:
|
||||
- name: Dependency review
|
||||
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
|
||||
with:
|
||||
license-check: false # Covered by pnpm lint:licenses
|
||||
fail-on-severity: high
|
||||
show-openssf-scorecard: true
|
||||
warn-on-openssf-scorecard-level: 3
|
||||
|
||||
npm-metadata:
|
||||
name: Check npm metadata
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read # To read package.json
|
||||
steps:
|
||||
- name: Check out workflow scripts
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: .github/scripts
|
||||
- name: Check npm metadata
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const { default: checkNpmMetadata } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-npm-metadata.mts`
|
||||
);
|
||||
await checkNpmMetadata({ github, context, core });
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Design deployment
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: Design
|
||||
url: ${{ steps.deploy.outputs.netlify_url }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Gallery
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-gallery
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: gallery/dist
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
||||
@@ -1,50 +0,0 @@
|
||||
name: Design preview
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- labeled
|
||||
branches:
|
||||
- dev
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
runs-on: ubuntu-latest
|
||||
# Skip running on forks since it won't have access to secrets
|
||||
# Skip running PRs without 'needs design preview' label
|
||||
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build Gallery
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-gallery
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Deploy preview to Netlify
|
||||
id: deploy
|
||||
uses: ./.github/actions/netlify-deploy
|
||||
with:
|
||||
dir: gallery/dist
|
||||
alias: deploy-preview-${{ github.event.number }}
|
||||
auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
site-id: ${{ secrets.NETLIFY_GALLERY_SITE_ID }}
|
||||
|
||||
- name: Generate summary
|
||||
run: echo "${{ steps.deploy.outputs.netlify_url }}" >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -1,396 +0,0 @@
|
||||
name: E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- dev
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare-dependencies:
|
||||
name: Prepare dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Prepare dependencies
|
||||
uses: ./.github/actions/prepare-dependencies
|
||||
|
||||
prepare-container-dependencies:
|
||||
name: Prepare container dependencies
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.64.0-noble
|
||||
options: --user 1001
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Prepare dependencies
|
||||
uses: ./.github/actions/prepare-dependencies
|
||||
with:
|
||||
node-modules-cache-key: node-modules-container-v1
|
||||
|
||||
# ── Build the demo once and share it across test jobs via artifact ──────────
|
||||
build-demo:
|
||||
name: Build demo
|
||||
needs: prepare-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
|
||||
- name: Build demo
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-demo-e2e
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
is-test: true
|
||||
|
||||
- name: Upload demo build
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: demo-dist
|
||||
path: demo/dist/
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
|
||||
# ── Build the e2e test app and share it via artifact ────────────────────────
|
||||
build-e2e-test-app:
|
||||
name: Build e2e test app
|
||||
needs: prepare-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
|
||||
- name: Build e2e test app
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-e2e-test-app-e2e
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
is-test: true
|
||||
|
||||
- name: Upload e2e test app build
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: e2e-test-app-dist
|
||||
path: test/e2e/app/dist/
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
|
||||
# ── Build the gallery and share it via artifact ─────────────────────────────
|
||||
build-gallery:
|
||||
name: Build gallery
|
||||
needs: prepare-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
|
||||
- name: Build gallery
|
||||
uses: ./.github/actions/build
|
||||
with:
|
||||
target: build-gallery
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
is-test: true
|
||||
|
||||
- name: Upload gallery build
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: gallery-dist
|
||||
path: gallery/dist/
|
||||
if-no-files-found: error
|
||||
retention-days: 3
|
||||
|
||||
# ── Run Playwright tests against Chromium ──────────────────────────────────
|
||||
e2e-demo:
|
||||
name: E2E demo (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
|
||||
needs:
|
||||
- build-demo
|
||||
- prepare-container-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.64.0-noble
|
||||
options: --user 1001 --ipc=host
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex:
|
||||
- 1
|
||||
- 2
|
||||
shardTotal:
|
||||
- 2
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
node-modules-cache-key: node-modules-container-v1
|
||||
|
||||
- name: Download demo build
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: demo-dist
|
||||
path: demo/dist/
|
||||
|
||||
- name: Run Playwright demo tests
|
||||
run: pnpm run test:e2e:demo --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
||||
timeout-minutes: 15
|
||||
|
||||
- name: Upload demo blob report
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
if: always()
|
||||
with:
|
||||
name: blob-report-demo-${{ matrix.shardIndex }}
|
||||
path: test/e2e/reports/demo/
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
|
||||
e2e-app:
|
||||
name: E2E app (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
|
||||
needs:
|
||||
- build-e2e-test-app
|
||||
- prepare-container-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.64.0-noble
|
||||
options: --user 1001 --ipc=host
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
shardTotal:
|
||||
- 4
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
node-modules-cache-key: node-modules-container-v1
|
||||
|
||||
- name: Download e2e test app build
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: e2e-test-app-dist
|
||||
path: test/e2e/app/dist/
|
||||
|
||||
- name: Run Playwright app tests
|
||||
run: pnpm run test:e2e:app --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
||||
timeout-minutes: 15
|
||||
|
||||
- name: Upload app blob report
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
if: always()
|
||||
with:
|
||||
name: blob-report-app-${{ matrix.shardIndex }}
|
||||
path: test/e2e/reports/app/
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
|
||||
e2e-gallery:
|
||||
name: E2E gallery (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
|
||||
needs:
|
||||
- build-gallery
|
||||
- prepare-container-dependencies
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: mcr.microsoft.com/playwright:v1.64.0-noble
|
||||
options: --user 1001 --ipc=host
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shardIndex:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
shardTotal:
|
||||
- 4
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
node-modules-cache-key: node-modules-container-v1
|
||||
|
||||
- name: Download gallery build
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: gallery-dist
|
||||
path: gallery/dist/
|
||||
|
||||
- name: Run Playwright gallery tests
|
||||
run: pnpm run test:e2e:gallery --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}
|
||||
timeout-minutes: 15
|
||||
|
||||
- name: Upload gallery blob report
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
if: always()
|
||||
with:
|
||||
name: blob-report-gallery-${{ matrix.shardIndex }}
|
||||
path: test/e2e/reports/gallery/
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
|
||||
report:
|
||||
name: Report
|
||||
needs:
|
||||
- e2e-demo
|
||||
- e2e-app
|
||||
- e2e-gallery
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ always() }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node with shared dependencies
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
node-modules-cache: true
|
||||
|
||||
- name: Download demo blob reports
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
continue-on-error: true
|
||||
with:
|
||||
pattern: blob-report-demo-*
|
||||
path: test/e2e/reports/demo/
|
||||
|
||||
- name: Download app blob reports
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
continue-on-error: true
|
||||
with:
|
||||
pattern: blob-report-app-*
|
||||
path: test/e2e/reports/app/
|
||||
|
||||
- name: Download gallery blob reports
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
continue-on-error: true
|
||||
with:
|
||||
pattern: blob-report-gallery-*
|
||||
path: test/e2e/reports/gallery/
|
||||
|
||||
- name: Stage blobs for merge
|
||||
run: node test/e2e/collect-blob-reports.mjs
|
||||
|
||||
- name: Merge blob reports
|
||||
run: npx playwright merge-reports -c test/e2e/playwright.merge.config.ts test/e2e/reports/blob
|
||||
|
||||
- name: Upload merged HTML report
|
||||
id: upload-report
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: playwright-report
|
||||
path: test/e2e/reports/combined/
|
||||
retention-days: 14
|
||||
|
||||
- name: Post report to PR
|
||||
if: >-
|
||||
github.event_name == 'pull_request' &&
|
||||
(needs.e2e-demo.result == 'failure' ||
|
||||
needs.e2e-app.result == 'failure' ||
|
||||
needs.e2e-gallery.result == 'failure')
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const { default: postReportComment } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/test/e2e/post-report-comment.mjs`
|
||||
);
|
||||
await postReportComment({ github, context, core });
|
||||
|
||||
- name: Check suite results
|
||||
run: |
|
||||
failed=0
|
||||
for suite in \
|
||||
"demo:${{ needs.e2e-demo.result }}" \
|
||||
"app:${{ needs.e2e-app.result }}" \
|
||||
"gallery:${{ needs.e2e-gallery.result }}"; do
|
||||
name="${suite%%:*}"
|
||||
result="${suite#*:}"
|
||||
echo "E2E ${name}: ${result}"
|
||||
if [ "$result" != "success" ]; then
|
||||
failed=1
|
||||
fi
|
||||
done
|
||||
exit "$failed"
|
||||
@@ -1,38 +0,0 @@
|
||||
name: "Pull Request Labeler"
|
||||
|
||||
on: pull_request_target # zizmor: ignore[dangerous-triggers] -- safe: checks out base repo scripts only and reads PR files through the API, never PR head code
|
||||
|
||||
# Runs one at a time per pull request, so an older run can't undo a newer one
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Apply labels
|
||||
id: labeler
|
||||
continue-on-error: true
|
||||
uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0
|
||||
with:
|
||||
sync-labels: true
|
||||
- name: Check out workflow scripts
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: .github/scripts
|
||||
- name: Apply content labels
|
||||
continue-on-error: true
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
env:
|
||||
LABELER_OUTCOME: ${{ steps.labeler.outcome }}
|
||||
with:
|
||||
script: |
|
||||
const { default: labelContent } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/.github/scripts/label-content.mts`
|
||||
);
|
||||
await labelContent({ github, context, core });
|
||||
@@ -1,24 +0,0 @@
|
||||
name: Lock
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 * * * *"
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@89ae32b08ed1a541efecbab17912962a5e38981c # v6.0.2
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
process-only: "issues, prs"
|
||||
issue-inactive-days: "30"
|
||||
issue-lock-reason: ""
|
||||
pr-inactive-days: "1"
|
||||
pr-lock-reason: ""
|
||||
@@ -0,0 +1,20 @@
|
||||
name: Lock
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/[email protected]
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: "30"
|
||||
issue-exclude-created-before: "2020-10-01T00:00:00Z"
|
||||
issue-lock-reason: ""
|
||||
pr-lock-inactive-days: "1"
|
||||
pr-exclude-created-before: "2020-11-01T00:00:00Z"
|
||||
pr-lock-reason: ""
|
||||
@@ -0,0 +1,19 @@
|
||||
name: Netlify
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
trigger_builds:
|
||||
name: Trigger netlify build preview
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Trigger Cast build
|
||||
run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_CAST_DEV_BUILD_HOOK }}
|
||||
|
||||
- name: Trigger Demo build
|
||||
run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_DEMO_DEV_BUILD_HOOK }}
|
||||
|
||||
- name: Trigger Gallery build
|
||||
run: curl -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_GALLERY_DEV_BUILD_HOOK }}
|
||||
@@ -1,144 +0,0 @@
|
||||
name: Nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 1 * * *"
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.14"
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
permissions:
|
||||
actions: none
|
||||
|
||||
jobs:
|
||||
nightly:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
name: Nightly
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
immutable: false
|
||||
|
||||
- name: Download translations
|
||||
run: ./script/translations_download
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
# The wheel only builds the app (build-app), which does not merge
|
||||
# backend translations. Skipping the whole-project backend export (as
|
||||
# the release does) keeps this off the build's critical path; the full
|
||||
# translations artifact is produced in parallel by the job below.
|
||||
SKIP_BACKEND_TRANSLATIONS: "1"
|
||||
|
||||
- name: Bump version
|
||||
run: script/version_bump.js nightly
|
||||
|
||||
# Warm the shared compression cache so releases reuse it (see release.yaml).
|
||||
- name: Restore compression cache
|
||||
id: compress-cache
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .compress-cache
|
||||
key: compress-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
compress-cache-${{ runner.os }}-
|
||||
|
||||
# The nightly writes the rspack persistent cache; CI reads it read-only
|
||||
# (see ci.yaml). rspack invalidates internally (version + buildDependencies
|
||||
# + node_modules snapshot), so the cache rolls forward daily and a single
|
||||
# dependency bump keeps most of it warm instead of dropping the lineage.
|
||||
- name: Restore rspack cache
|
||||
id: rspack-cache
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .rspack-cache
|
||||
key: rspack-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
rspack-cache-${{ runner.os }}-
|
||||
|
||||
- name: Build nightly Python wheels
|
||||
env:
|
||||
COMPRESS_CACHE_DIR: ${{ github.workspace }}/.compress-cache
|
||||
RSPACK_CACHE: readwrite
|
||||
run: |
|
||||
pip install build
|
||||
pnpm install --frozen-lockfile
|
||||
export SKIP_FETCH_NIGHTLY_TRANSLATIONS=1
|
||||
script/build_frontend
|
||||
rm -rf dist home_assistant_frontend.egg-info
|
||||
python3 -m build
|
||||
|
||||
# Not gated on the restore steps: a transient restore failure (they are
|
||||
# continue-on-error) must not stop us persisting a freshly built cache.
|
||||
- name: Save compression cache
|
||||
if: success()
|
||||
continue-on-error: true
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .compress-cache
|
||||
key: compress-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
||||
- name: Save rspack cache
|
||||
if: success()
|
||||
continue-on-error: true
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .rspack-cache
|
||||
key: rspack-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: wheels
|
||||
path: dist/home_assistant_frontend*.whl
|
||||
if-no-files-found: error
|
||||
|
||||
# The full translations (including the slow backend/core export) are only
|
||||
# needed for the uploaded artifact, not the wheel, so they are downloaded in
|
||||
# parallel here instead of blocking the build above.
|
||||
translations:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
name: Translations
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
immutable: false
|
||||
|
||||
- name: Download translations
|
||||
run: ./script/translations_download
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
|
||||
- name: Archive translations
|
||||
run: tar -czvf translations.tar.gz translations
|
||||
|
||||
- name: Upload translations
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: translations
|
||||
path: translations.tar.gz
|
||||
if-no-files-found: error
|
||||
@@ -1,38 +0,0 @@
|
||||
name: Pull request standards
|
||||
|
||||
on:
|
||||
pull_request_target: # zizmor: ignore[dangerous-triggers] -- safe: reads PR metadata from event payload only, checks out base repo scripts only, never PR head code
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- ready_for_review
|
||||
branches:
|
||||
- dev
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check pull request follows contribution standards
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write # To label and comment on pull requests
|
||||
steps:
|
||||
- name: Check out workflow scripts
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: .github/scripts
|
||||
- name: Check pull request standards
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const { default: checkStandards } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-pull-request-standards.mts`
|
||||
);
|
||||
await checkStandards({ github, context, core });
|
||||
@@ -1,39 +0,0 @@
|
||||
name: RelativeCI
|
||||
|
||||
on:
|
||||
# zizmor: ignore[dangerous-triggers] -- safe: only downloads artifacts, no PR code checkout
|
||||
workflow_run:
|
||||
workflows: [CI]
|
||||
types:
|
||||
- completed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
upload-frontend-modern:
|
||||
name: Upload stats (frontend/modern)
|
||||
if: ${{ github.repository == 'home-assistant/frontend' && github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send bundle stats and build information to RelativeCI
|
||||
uses: relative-ci/agent-action@711f3a8fa1b928e6afde280011110c9b0a224a60 # v3.2.4
|
||||
with:
|
||||
key: ${{ secrets.RELATIVE_CI_KEY_frontend_modern }}
|
||||
token: ${{ github.token }}
|
||||
artifactName: frontend-bundle-stats
|
||||
webpackStatsFile: frontend-modern.json
|
||||
|
||||
upload-frontend-legacy:
|
||||
name: Upload stats (frontend/legacy)
|
||||
if: ${{ github.repository == 'home-assistant/frontend' && github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send bundle stats and build information to RelativeCI
|
||||
uses: relative-ci/agent-action@711f3a8fa1b928e6afde280011110c9b0a224a60 # v3.2.4
|
||||
with:
|
||||
key: ${{ secrets.RELATIVE_CI_KEY_frontend_legacy }}
|
||||
token: ${{ github.token }}
|
||||
artifactName: frontend-bundle-stats
|
||||
webpackStatsFile: frontend-legacy.json
|
||||
@@ -5,20 +5,10 @@ on:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
permissions:
|
||||
# write permission for contents is required to create a github release
|
||||
contents: write
|
||||
# write permission for pull-requests is required for autolabeler
|
||||
# otherwise, read permission is required at least
|
||||
pull-requests: read
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@72967cdc98ddd3160f1fc3dff619de365e137dd0 # v7.9.0
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
+45
-123
@@ -6,164 +6,86 @@ on:
|
||||
- published
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.14"
|
||||
PYTHON_VERSION: 3.8
|
||||
NODE_VERSION: 14
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
# Set default workflow permissions
|
||||
# All scopes not mentioned here are set to no access
|
||||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
|
||||
permissions:
|
||||
actions: none
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
environment: pypi
|
||||
permissions:
|
||||
contents: write # Required to upload release assets
|
||||
id-token: write # For "Trusted Publisher" to PyPi
|
||||
if: github.repository_owner == 'home-assistant'
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Verify version
|
||||
uses: home-assistant/actions/helpers/verify-version@master
|
||||
|
||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Verify version
|
||||
uses: home-assistant/actions/helpers/verify-version@06749dd8c0b54f350bc69c8752456cee498808a3 # master
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
immutable: false
|
||||
cache: false
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: yarn
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: Download Translations
|
||||
run: ./script/translations_download
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
# The app fetches core (backend) translations live from HA, so the
|
||||
# release build does not need Lokalise's backend project.
|
||||
SKIP_BACKEND_TRANSLATIONS: "1"
|
||||
|
||||
# Restore the content-addressed compression cache. Unchanged chunks and
|
||||
# static assets are then reused instead of re-run through brotli/zopfli.
|
||||
- name: Restore compression cache
|
||||
id: compress-cache
|
||||
continue-on-error: true
|
||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .compress-cache
|
||||
key: compress-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
restore-keys: |
|
||||
compress-cache-${{ runner.os }}-
|
||||
|
||||
- name: Build and release package
|
||||
env:
|
||||
COMPRESS_CACHE_DIR: ${{ github.workspace }}/.compress-cache
|
||||
run: |
|
||||
python3 -m pip install build
|
||||
export SKIP_FETCH_NIGHTLY_TRANSLATIONS=1
|
||||
python3 -m pip install twine
|
||||
export TWINE_USERNAME="__token__"
|
||||
export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}"
|
||||
|
||||
script/release
|
||||
|
||||
# The build keeps the cache under its size budget, so saving stays bounded.
|
||||
# A unique key always writes; restore-keys picks the newest on the next
|
||||
# run. Not gated on the restore step: a transient restore failure (it is
|
||||
# continue-on-error) must not stop us persisting a freshly built cache.
|
||||
- name: Save compression cache
|
||||
if: success()
|
||||
continue-on-error: true
|
||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: .compress-cache
|
||||
key: compress-cache-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
||||
with:
|
||||
skip-existing: true
|
||||
|
||||
- name: Upload release assets
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
run: gh release upload "$TAG_NAME" dist/*.whl dist/*.tar.gz --clobber
|
||||
|
||||
wheels-init:
|
||||
name: Init wheels build
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Generate requirements.txt
|
||||
env:
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
run: |
|
||||
version=$(echo "$GITHUB_REF" | awk -F"/" '{print $NF}' )
|
||||
# Wait for the exact wheel to appear on the simple index (the surface
|
||||
# the wheels build's pip uses). The JSON API can report a version as
|
||||
# available before it propagates here, which fails the wheels build.
|
||||
wheel="home_assistant_frontend-${version}-py3-none-any.whl"
|
||||
echo "Waiting for $wheel to appear on the PyPI simple index..."
|
||||
for i in $(seq 1 30); do
|
||||
if curl -sf "https://pypi.org/simple/home-assistant-frontend/" | grep -qF "$wheel"; then
|
||||
echo "Package is available on the PyPI simple index!"
|
||||
break
|
||||
fi
|
||||
if [ "$i" = "30" ]; then
|
||||
echo "Timed out waiting for package to appear on PyPI"
|
||||
exit 1
|
||||
fi
|
||||
echo "Not available yet, retrying in 30 seconds... ($i/30)"
|
||||
sleep 30
|
||||
done
|
||||
# Sleep to give pypi time to populate the new version across mirrors
|
||||
sleep 240
|
||||
version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}' )
|
||||
echo "home-assistant-frontend==$version" > ./requirements.txt
|
||||
|
||||
# home-assistant/wheels doesn't support SHA pinning
|
||||
- name: Build wheels
|
||||
uses: home-assistant/wheels@9e17ab1ed5c4c79d8b61e29fa63de25ca2710716 # 2026.07.0
|
||||
- name: Upload requirements.txt
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
abi: cp314
|
||||
tag: musllinux_1_2
|
||||
arch: amd64
|
||||
wheels-key: ${{ secrets.WHEELS_KEY }}
|
||||
requirements: "requirements.txt"
|
||||
name: requirements
|
||||
path: ./requirements.txt
|
||||
|
||||
release-landing-page:
|
||||
name: Release landing-page frontend
|
||||
if: github.repository == 'home-assistant/frontend' && github.event.release.prerelease == false
|
||||
build-wheels:
|
||||
name: Build wheels for ${{ matrix.arch }}
|
||||
needs: wheels-init
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # Required to upload release assets
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["aarch64", "armhf", "armv7", "amd64", "i386"]
|
||||
tag:
|
||||
- "3.9-alpine3.14"
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Download requirements.txt
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
name: requirements
|
||||
|
||||
- name: Build wheels
|
||||
uses: home-assistant/wheels@master
|
||||
with:
|
||||
immutable: false
|
||||
cache: false
|
||||
- name: Download Translations
|
||||
run: ./script/translations_download
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
# The landing-page build does not merge backend translations.
|
||||
SKIP_BACKEND_TRANSLATIONS: "1"
|
||||
- name: Build landing-page
|
||||
run: landing-page/script/build_landing_page
|
||||
- name: Tar folder
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
run: tar -czf "landing-page/home_assistant_frontend_landingpage-${TAG_NAME}.tar.gz" -C landing-page/dist .
|
||||
- name: Upload release asset
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG_NAME: ${{ github.event.release.tag_name }}
|
||||
run: gh release upload "$TAG_NAME" "landing-page/home_assistant_frontend_landingpage-${TAG_NAME}.tar.gz" --clobber
|
||||
tag: ${{ matrix.tag }}
|
||||
arch: ${{ matrix.arch }}
|
||||
wheels-host: ${{ secrets.WHEELS_HOST }}
|
||||
wheels-key: ${{ secrets.WHEELS_KEY }}
|
||||
wheels-user: wheels
|
||||
requirements: "requirements.txt"
|
||||
@@ -1,67 +0,0 @@
|
||||
name: Restrict task creation
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
|
||||
permissions: {}
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.issue.number }}
|
||||
|
||||
jobs:
|
||||
add-no-stale:
|
||||
name: Add no-stale label
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read # To check out workflow scripts
|
||||
issues: write # To add labels to issues
|
||||
if: >-
|
||||
github.event.issue.type.name == 'Task'
|
||||
|| github.event.issue.type.name == 'Epic'
|
||||
|| github.event.issue.type.name == 'Opportunity'
|
||||
steps:
|
||||
- name: Check out workflow scripts
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: .github/scripts
|
||||
- name: Add no-stale label
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const { withRetry } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/.github/scripts/github-retry.mts`
|
||||
);
|
||||
await withRetry("no-stale label", () =>
|
||||
github.rest.issues.addLabels({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
labels: ['no-stale']
|
||||
})
|
||||
);
|
||||
|
||||
check-authorization:
|
||||
name: Check authorization
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read # To check out workflow scripts
|
||||
issues: write # To comment on, label, and close issues
|
||||
# Only run if this is a Task issue type (from the issue form)
|
||||
if: github.event.issue.type.name == 'Task'
|
||||
steps:
|
||||
- name: Check out workflow scripts
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
sparse-checkout: .github/scripts
|
||||
- name: Check if user is authorized
|
||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
||||
with:
|
||||
script: |
|
||||
const { default: checkTaskAuthorization } = await import(
|
||||
`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-task-authorization.mts`
|
||||
);
|
||||
await checkTaskAuthorization({ github, context, core });
|
||||
@@ -1,49 +0,0 @@
|
||||
name: Stale
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 * * * *"
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Stale policy
|
||||
uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-issue-stale: 90
|
||||
days-before-pr-stale: 60
|
||||
days-before-close: 7
|
||||
operations-per-run: 25
|
||||
remove-stale-when-updated: true
|
||||
stale-issue-label: "stale"
|
||||
exempt-issue-labels: "no-stale,Help%20wanted,help-wanted,feature-request,feature%20request"
|
||||
stale-issue-message: >
|
||||
There hasn't been any activity on this issue recently. Due to the
|
||||
high number of incoming GitHub notifications, we have to clean some
|
||||
of the old issues, as many of them have already been resolved with
|
||||
the latest updates.
|
||||
|
||||
Please make sure to update to the latest Home Assistant version and
|
||||
check if that solves the issue. Let us know if that works for you by
|
||||
adding a comment 👍
|
||||
|
||||
This issue has now been marked as stale and will be closed if no
|
||||
further activity occurs. Thank you for your contributions.
|
||||
|
||||
stale-pr-label: "stale"
|
||||
exempt-pr-labels: "no-stale"
|
||||
stale-pr-message: >
|
||||
There hasn't been any activity on this pull request recently. This
|
||||
pull request has been automatically marked as stale because of that
|
||||
and will be closed if no further activity occurs within 7 days.
|
||||
|
||||
Thank you for your contributions.
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Stale
|
||||
|
||||
# yamllint disable-line rule:truthy
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 * * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 90 days stale policy
|
||||
uses: actions/[email protected]
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 90
|
||||
days-before-close: 7
|
||||
operations-per-run: 25
|
||||
remove-stale-when-updated: true
|
||||
stale-issue-label: "stale"
|
||||
exempt-issue-labels: "no-stale,Help%20wanted,help-wanted,feature-request,feature%20request"
|
||||
stale-issue-message: >
|
||||
There hasn't been any activity on this issue recently. Due to the
|
||||
high number of incoming GitHub notifications, we have to clean some
|
||||
of the old issues, as many of them have already been resolved with
|
||||
the latest updates.
|
||||
|
||||
Please make sure to update to the latest Home Assistant version and
|
||||
check if that solves the issue. Let us know if that works for you by
|
||||
adding a comment 👍
|
||||
|
||||
This issue has now been marked as stale and will be closed if no
|
||||
further activity occurs. Thank you for your contributions.
|
||||
|
||||
stale-pr-label: "stale"
|
||||
exempt-pr-labels: "no-stale"
|
||||
stale-pr-message: >
|
||||
There hasn't been any activity on this pull request recently. This
|
||||
pull request has been automatically marked as stale because of that
|
||||
and will be closed if no further activity occurs within 7 days.
|
||||
|
||||
Thank you for your contributions.
|
||||
@@ -1,48 +0,0 @@
|
||||
name: Sync device class constants
|
||||
|
||||
# Mirrors the device class constants for Home Assistant Core's into the
|
||||
# build-time default in src/data/device_classes.ts and opens a PR
|
||||
# when it drifts. Reads homeassistant/generated/device_classes.json from core.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 4 * * *" # Daily, 04:00 UTC
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
name: Sync
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Regenerate device class constants
|
||||
run: ./script/gen_device_classes
|
||||
|
||||
- name: Format
|
||||
run: pnpm exec prettier --write src/data/device_classes.ts
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
branch: chore/sync-device-classes
|
||||
commit-message: Update device class constants
|
||||
title: Update device class constants
|
||||
body: |
|
||||
Regenerated `DOMAIN_DEVICE_CLASSES` from Home Assistant Core's
|
||||
`homeassistant/generated/device_classes.json`.
|
||||
|
||||
Automated by `.github/workflows/sync-device-classes.yaml`.
|
||||
@@ -1,49 +0,0 @@
|
||||
name: Sync sensor entity constants
|
||||
|
||||
# Mirrors Home Assistant Core's numeric `SensorDeviceClass`, `SensorStateClass`,
|
||||
# units and related device and state classes arrays into the
|
||||
# build-time default in src/data/sensor_entity_constants.ts and opens a PR
|
||||
# when it drifts. Reads homeassistant/generated/sensor.json from core.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 4 * * *" # Daily, 04:00 UTC
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
name: Sync
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Node and install
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Regenerate sensor entity constants
|
||||
run: ./script/gen_sensor_entity_constants
|
||||
|
||||
- name: Format
|
||||
run: pnpm exec prettier --write src/data/sensor_entity_constants.ts
|
||||
|
||||
- name: Create pull request
|
||||
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
||||
with:
|
||||
branch: chore/sync-sensor-entity-constants
|
||||
commit-message: Update sensor entity constants
|
||||
title: Update sensor entity constants
|
||||
body: |
|
||||
Regenerated the sensor entity constants from Home Assistant Core's
|
||||
`homeassistant/generated/sensor.json`.
|
||||
|
||||
Automated by `.github/workflows/sync-sensor-entity-constants.yaml`.
|
||||
@@ -1,29 +1,25 @@
|
||||
name: Translations
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- .github/workflows/translations.yaml
|
||||
- src/translations/en.json
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
NODE_VERSION: 14
|
||||
|
||||
jobs:
|
||||
upload:
|
||||
name: Upload
|
||||
if: github.repository == 'home-assistant/frontend'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Upload Translations
|
||||
run: ./script/translations_upload_base
|
||||
env:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
run: |
|
||||
export LOKALISE_TOKEN="${{ secrets.LOKALISE_TOKEN }}"
|
||||
|
||||
./script/translations_upload_base
|
||||
+16
-37
@@ -2,19 +2,22 @@
|
||||
.reify-cache
|
||||
|
||||
# build
|
||||
build/
|
||||
dist/
|
||||
/hass_frontend/
|
||||
/translations/
|
||||
/.compress-cache/
|
||||
/.rspack-cache/
|
||||
# Composite action source, not build output
|
||||
!/.github/actions/build/
|
||||
build
|
||||
build-translations/*
|
||||
hass_frontend/*
|
||||
dist
|
||||
|
||||
# Node
|
||||
node_modules/
|
||||
# yarn
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/releases
|
||||
!.yarn/plugins
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
.pnp.*
|
||||
node_modules/*
|
||||
yarn-error.log
|
||||
npm-debug.log
|
||||
.pnpm-store/
|
||||
|
||||
# Python stuff
|
||||
*.py[cod]
|
||||
@@ -24,7 +27,7 @@ npm-debug.log
|
||||
# venv stuff
|
||||
pyvenv.cfg
|
||||
pip-selfcheck.json
|
||||
/venv/
|
||||
venv/*
|
||||
.venv
|
||||
|
||||
# vscode
|
||||
@@ -43,28 +46,4 @@ src/cast/dev_const.ts
|
||||
.tool-versions
|
||||
|
||||
# Home Assistant config
|
||||
/config/
|
||||
|
||||
# Jetbrains
|
||||
/.idea/
|
||||
|
||||
# test coverage
|
||||
test/coverage/
|
||||
|
||||
# Playwright e2e output
|
||||
test/e2e/reports/
|
||||
test/e2e/test-results/
|
||||
# E2E test app build output
|
||||
test/e2e/app/dist/
|
||||
# MCP server
|
||||
.playwright-mcp/
|
||||
|
||||
# AI tooling
|
||||
.claude/*
|
||||
!.claude/skills
|
||||
.cursor
|
||||
.opencode
|
||||
.serena
|
||||
|
||||
test/benchmarks/results/
|
||||
|
||||
/config
|
||||
@@ -1 +0,0 @@
|
||||
pnpm exec lint-staged --relative
|
||||
+10
-6
@@ -1,6 +1,10 @@
|
||||
CLA.md
|
||||
CODE_OF_CONDUCT.md
|
||||
LICENSE.md
|
||||
PULL_REQUEST_TEMPLATE.md
|
||||
public/static/map/sprites/*.json
|
||||
pnpm-lock.yaml
|
||||
build
|
||||
build-translations/*
|
||||
translations/*
|
||||
node_modules/*
|
||||
hass_frontend/*
|
||||
pip-selfcheck.json
|
||||
|
||||
# vscode
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
Vendored
+2
-5
@@ -2,10 +2,7 @@
|
||||
"recommendations": [
|
||||
"dbaeumer.vscode-eslint",
|
||||
"esbenp.prettier-vscode",
|
||||
"runem.lit-plugin",
|
||||
"github.vscode-pull-request-github",
|
||||
"eamodio.gitlens",
|
||||
"vitest.explorer",
|
||||
"yeion7.styled-global-variables-autocomplete"
|
||||
"bierner.lit-html",
|
||||
"runem.lit-plugin"
|
||||
]
|
||||
}
|
||||
Vendored
+4
-2
@@ -9,7 +9,9 @@
|
||||
"webRoot": "${workspaceFolder}/hass_frontend",
|
||||
"disableNetworkCache": true,
|
||||
"preLaunchTask": "Develop Frontend",
|
||||
"outFiles": ["${workspaceFolder}/hass_frontend/frontend_latest/*.js"]
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/hass_frontend/frontend_latest/*.js"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Debug Gallery",
|
||||
@@ -37,6 +39,6 @@
|
||||
"webRoot": "${workspaceFolder}/cast/dist",
|
||||
"disableNetworkCache": true,
|
||||
"preLaunchTask": "Develop Cast"
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
Vendored
+23
-48
@@ -1,42 +1,6 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Develop and serve Frontend",
|
||||
"type": "shell",
|
||||
"command": "script/develop_and_serve -c ${input:coreUrl}",
|
||||
// Sync changes here to other tasks until issue resolved
|
||||
// https://github.com/Microsoft/vscode/issues/61497
|
||||
"problemMatcher": {
|
||||
"owner": "ha-build",
|
||||
"source": "ha-build",
|
||||
"fileLocation": "absolute",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
|
||||
"severity": 1,
|
||||
"file": 2,
|
||||
"message": 3,
|
||||
"line": 4,
|
||||
"column": 5
|
||||
}
|
||||
],
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": "Changes detected. Starting compilation",
|
||||
"endsPattern": "Build done @"
|
||||
}
|
||||
},
|
||||
"isBackground": true,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"runOptions": {
|
||||
"instanceLimit": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Develop Frontend",
|
||||
"type": "gulp",
|
||||
@@ -74,9 +38,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Develop Gallery",
|
||||
"label": "Develop Supervisor panel",
|
||||
"type": "gulp",
|
||||
"task": "develop-gallery",
|
||||
"task": "develop-hassio",
|
||||
"problemMatcher": {
|
||||
"owner": "ha-build",
|
||||
"source": "ha-build",
|
||||
@@ -98,7 +62,6 @@
|
||||
"endsPattern": "Build done @"
|
||||
}
|
||||
},
|
||||
|
||||
"isBackground": true,
|
||||
"group": "build",
|
||||
"runOptions": {
|
||||
@@ -106,9 +69,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Develop Landing Page",
|
||||
"label": "Develop Gallery",
|
||||
"type": "gulp",
|
||||
"task": "develop-landing-page",
|
||||
"task": "develop-gallery",
|
||||
"problemMatcher": {
|
||||
"owner": "ha-build",
|
||||
"source": "ha-build",
|
||||
@@ -216,18 +179,30 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Setup and fetch nightly translations",
|
||||
"type": "gulp",
|
||||
"task": "setup-and-fetch-nightly-translations",
|
||||
"problemMatcher": []
|
||||
"label": "Run HA Core for Supervisor in devcontainer",
|
||||
"type": "shell",
|
||||
"command": "HASSIO=${input:supervisorHost} HASSIO_TOKEN=${input:supervisorToken} script/core",
|
||||
"isBackground": true,
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [],
|
||||
"runOptions": {
|
||||
"instanceLimit": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
"id": "coreUrl",
|
||||
"id": "supervisorHost",
|
||||
"type": "promptString",
|
||||
"description": "The URL of the Home Assistant Core instance",
|
||||
"default": "http://127.0.0.1:8123"
|
||||
"description": "The IP of the Supervisor host running the Remote API proxy add-on"
|
||||
},
|
||||
{
|
||||
"id": "supervisorToken",
|
||||
"type": "promptString",
|
||||
"description": "The token for the Remote API proxy add-on"
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
|
||||
index d92179f7fd5315203f870a6963e871dc8ddf6c0c..362e284121b97e0fba0925225777aebc32e26b8d 100644
|
||||
--- a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
|
||||
+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
|
||||
@@ -1,14 +1,15 @@
|
||||
-let _ET, ET;
|
||||
+let _ET;
|
||||
+let ET;
|
||||
export default async function EventTarget() {
|
||||
- return ET || init();
|
||||
+ return ET || init();
|
||||
}
|
||||
async function init() {
|
||||
- _ET = window.EventTarget;
|
||||
- try {
|
||||
- new _ET();
|
||||
- }
|
||||
- catch (_a) {
|
||||
- _ET = (await import('event-target-shim')).EventTarget;
|
||||
- }
|
||||
- return (ET = _ET);
|
||||
+ _ET = window.EventTarget;
|
||||
+ try {
|
||||
+ new _ET();
|
||||
+ } catch (_a) {
|
||||
+ _ET = (await import("event-target-shim")).default.EventTarget;
|
||||
+ }
|
||||
+ return (ET = _ET);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
diff --git a/lib/legacy/class.js b/lib/legacy/class.js
|
||||
index aee2511be1cd9bf900ee552bc98190c1631c57c0..f2f499d68bf52034cac9c28307c99e8ce6b8417d 100644
|
||||
--- a/lib/legacy/class.js
|
||||
+++ b/lib/legacy/class.js
|
||||
@@ -304,17 +304,23 @@ function GenerateClassFromInfo(info, Base, behaviors) {
|
||||
// only proceed if the generated class' prototype has not been registered.
|
||||
const generatedProto = PolymerGenerated.prototype;
|
||||
if (!generatedProto.hasOwnProperty(JSCompiler_renameProperty('__hasRegisterFinished', generatedProto))) {
|
||||
- generatedProto.__hasRegisterFinished = true;
|
||||
+ // make sure legacy lifecycle is called on the *element*'s prototype
|
||||
+ // and not the generated class prototype; if the element has been
|
||||
+ // extended, these are *not* the same.
|
||||
+ const proto = Object.getPrototypeOf(this);
|
||||
+ // Only set flag when generated prototype itself is registered,
|
||||
+ // as this element may be extended from, and needs to run `registered`
|
||||
+ // on all behaviors on the subclass as well.
|
||||
+ if (proto === generatedProto) {
|
||||
+ generatedProto.__hasRegisterFinished = true;
|
||||
+ }
|
||||
// ensure superclass is registered first.
|
||||
super._registered();
|
||||
// copy properties onto the generated class lazily if we're optimizing,
|
||||
- if (legacyOptimizations) {
|
||||
+ if (legacyOptimizations && !Object.hasOwnProperty(generatedProto, '__hasCopiedProperties')) {
|
||||
+ generatedProto.__hasCopiedProperties = true;
|
||||
copyPropertiesToProto(generatedProto);
|
||||
}
|
||||
- // make sure legacy lifecycle is called on the *element*'s prototype
|
||||
- // and not the generated class prototype; if the element has been
|
||||
- // extended, these are *not* the same.
|
||||
- const proto = Object.getPrototypeOf(this);
|
||||
let list = lifecycle.beforeRegister;
|
||||
if (list) {
|
||||
for (let i=0; i < list.length; i++) {
|
||||
@@ -0,0 +1,77 @@
|
||||
/* eslint-disable */
|
||||
module.exports = {
|
||||
name: "@yarnpkg/plugin-interactive-tools",
|
||||
factory: function (require) {
|
||||
var plugin;plugin=(()=>{var __webpack_modules__={7560:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>K});function r(e,t,n,r){var i,o=arguments.length,u=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(u=(o<3?i(u):o>3?i(t,n,u):i(t,n))||u);return o>3&&u&&Object.defineProperty(t,n,u),u}const i=require("@yarnpkg/cli"),o=require("@yarnpkg/core");var u=n(9245),a=n(7382);const l=(0,a.memo)(({active:e})=>{const t=(0,a.useMemo)(()=>e?"◉":"◯",[e]),n=(0,a.useMemo)(()=>e?"green":"yellow",[e]);return a.createElement(u.Text,{color:n},t)});function s({active:e},t,n){const{stdin:r}=(0,u.useStdin)(),i=(0,a.useCallback)((e,n)=>t(e,n),n);(0,a.useEffect)(()=>{if(e&&r)return r.on("keypress",i),()=>{r.off("keypress",i)}},[e,i,r])}var c;!function(e){e.BEFORE="before",e.AFTER="after"}(c||(c={}));const f=function(e,t,{active:n,minus:r,plus:i,set:o,loop:u=!0}){s({active:n},(n,a)=>{const l=t.indexOf(e);switch(a.name){case r:{const e=l-1;if(u)return void o(t[(t.length+e)%t.length]);if(e<0)return;o(t[e])}break;case i:{const e=l+1;if(u)return void o(t[e%t.length]);if(e>=t.length)return;o(t[e])}}},[t,e,i,o,u])},d=({active:e=!0,children:t=[],radius:n=10,size:r=1,loop:i=!0,onFocusRequest:o,willReachEnd:l})=>{const d=a.Children.map(t,e=>(e=>{if(null===e.key)throw new Error("Expected all children to have a key");return e.key})(e)),p=d[0],[h,v]=(0,a.useState)(p),m=d.indexOf(h);(0,a.useEffect)(()=>{d.includes(h)||v(p)},[t]),(0,a.useEffect)(()=>{l&&m>=d.length-2&&l()},[m]),function({active:e},t,n){s({active:e},(e,n)=>{"tab"===n.name&&(n.shift?t(c.BEFORE):t(c.AFTER))},n)}({active:e&&!!o},e=>{null==o||o(e)},[o]),f(h,d,{active:e,minus:"up",plus:"down",set:v,loop:i});let g=m-n,y=m+n;y>d.length&&(g-=y-d.length,y=d.length),g<0&&(y+=-g,g=0),y>=d.length&&(y=d.length-1);const _=[];for(let n=g;n<=y;++n){const i=d[n],o=e&&i===h;_.push(a.createElement(u.Box,{key:i,height:r},a.createElement(u.Box,{marginLeft:1,marginRight:1},a.createElement(u.Text,null,o?a.createElement(u.Text,{color:"cyan",bold:!0},">"):" ")),a.createElement(u.Box,null,a.cloneElement(t[n],{active:o}))))}return a.createElement(u.Box,{flexDirection:"column",width:"100%"},_)},p=require("readline"),h=a.createContext(null),v=({children:e})=>{const{stdin:t,setRawMode:n}=(0,u.useStdin)();(0,a.useEffect)(()=>{n&&n(!0),t&&(0,p.emitKeypressEvents)(t)},[t,n]);const[r,i]=(0,a.useState)(new Map),o=(0,a.useMemo)(()=>({getAll:()=>r,get:e=>r.get(e),set:(e,t)=>i(new Map([...r,[e,t]]))}),[r,i]);return a.createElement(h.Provider,{value:o,children:e})};function m(e,t){const n=(0,a.useContext)(h);if(null===n)throw new Error("Expected this hook to run with a ministore context attached");if(void 0===e)return n.getAll();const r=(0,a.useCallback)(t=>{n.set(e,t)},[e,n.set]);let i=n.get(e);return void 0===i&&(i=t),[i,r]}async function g(e,t){let n;const{waitUntilExit:r}=(0,u.render)(a.createElement(v,null,a.createElement(e,Object.assign({},t,{useSubmit:e=>{const{exit:t}=(0,u.useApp)();s({active:!0},(r,i)=>{"return"===i.name&&(n=e,t())},[t,e])}}))));return await r(),n}const y=require("clipanion");var _=n(7840),b=n(4410);const w={appId:"OFCNCOG2CU",apiKey:"6fe4476ee5a1832882e326b506d14126",indexName:"npm-search"},E=n.n(b)()(w.appId,w.apiKey).initIndex(w.indexName),D=async(e,t=0)=>await E.search(e,{analyticsTags:["yarn-plugin-interactive-tools"],attributesToRetrieve:["name","version","owner","repository","humanDownloadsLast30Days"],page:t,hitsPerPage:10}),S=["regular","dev","peer"];class C extends i.BaseCommand{async execute(){const e=await o.Configuration.find(this.context.cwd,this.context.plugins),t=()=>a.createElement(u.Box,{flexDirection:"row"},a.createElement(u.Box,{flexDirection:"column",width:48},a.createElement(u.Box,null,a.createElement(u.Text,null,"Press ",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<up>"),"/",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<down>")," to move between packages.")),a.createElement(u.Box,null,a.createElement(u.Text,null,"Press ",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<space>")," to select a package.")),a.createElement(u.Box,null,a.createElement(u.Text,null,"Press ",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<space>")," again to change the target."))),a.createElement(u.Box,{flexDirection:"column"},a.createElement(u.Box,{marginLeft:1},a.createElement(u.Text,null,"Press ",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<enter>")," to install the selected packages.")),a.createElement(u.Box,{marginLeft:1},a.createElement(u.Text,null,"Press ",a.createElement(u.Text,{bold:!0,color:"cyanBright"},"<ctrl+c>")," to abort.")))),n=()=>a.createElement(a.Fragment,null,a.createElement(u.Box,{width:15},a.createElement(u.Text,{bold:!0,underline:!0,color:"gray"},"Owner")),a.createElement(u.Box,{width:11},a.createElement(u.Text,{bold:!0,underline:!0,color:"gray"},"Version")),a.createElement(u.Box,{width:10Line truncated
|
||||
/** @license React v0.24.0
|
||||
* react-reconciler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
e.exports=function t(r){"use strict";var i=n(9381),o=n(7382),u=n(7181);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;l.hasOwnProperty("ReactCurrentDispatcher")||(l.ReactCurrentDispatcher={current:null}),l.hasOwnProperty("ReactCurrentBatchConfig")||(l.ReactCurrentBatchConfig={suspense:null});var s="function"==typeof Symbol&&Symbol.for,c=s?Symbol.for("react.element"):60103,f=s?Symbol.for("react.portal"):60106,d=s?Symbol.for("react.fragment"):60107,p=s?Symbol.for("react.strict_mode"):60108,h=s?Symbol.for("react.profiler"):60114,v=s?Symbol.for("react.provider"):60109,m=s?Symbol.for("react.context"):60110,g=s?Symbol.for("react.concurrent_mode"):60111,y=s?Symbol.for("react.forward_ref"):60112,_=s?Symbol.for("react.suspense"):60113,b=s?Symbol.for("react.suspense_list"):60120,w=s?Symbol.for("react.memo"):60115,E=s?Symbol.for("react.lazy"):60116;s&&Symbol.for("react.fundamental"),s&&Symbol.for("react.responder"),s&&Symbol.for("react.scope");var D="function"==typeof Symbol&&Symbol.iterator;function S(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=D&&e[D]||e["@@iterator"])?e:null}function C(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case d:return"Fragment";case f:return"Portal";case h:return"Profiler";case p:return"StrictMode";case _:return"Suspense";case b:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case m:return"Context.Consumer";case v:return"Context.Provider";case y:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case w:return C(e.type);case E:if(e=1===e._status?e._result:null)return C(e)}return null}function k(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).effectTag)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function T(e){if(k(e)!==e)throw Error(a(188))}function x(e){var t=e.alternate;if(!t){if(null===(t=k(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(null===i)break;var o=i.alternate;if(null===o){if(null!==(r=i.return)){n=r;continue}break}if(i.child===o.child){for(o=i.child;o;){if(o===n)return T(i),e;if(o===r)return T(i),t;o=o.sibling}throw Error(a(188))}if(n.return!==r.return)n=i,r=o;else{for(var u=!1,l=i.child;l;){if(l===n){u=!0,n=i,r=o;break}if(l===r){u=!0,r=i,n=o;break}l=l.sibling}if(!u){for(l=o.child;l;){if(l===n){u=!0,n=o,r=i;break}if(l===r){u=!0,r=o,n=i;break}l=l.sibling}if(!u)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}function A(e){if(!(e=x(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}var O=r.getPublicInstance,P=r.getRootHostContext,I=r.getChildHostContext,N=r.prepareForCommit,M=r.resetAfterCommit,R=r.createInstance,F=r.appendInitialChild,L=r.finalizeInitialChildren,B=r.prepareUpdate,j=r.shouldSetTextContent,U=r.shouldDeprioritizeSubtree,z=r.createTextInstance,W=r.setTimeout,H=r.clearTimeout,V=r.noTimeout,q=r.isPrimaryRenderer,G=r.supportsMutation,$=r.supportsPersistence,Y=r.supportsHydration,K=r.appendChild,X=r.appendChildToContainer,Q=r.commitTextUpdate,J=r.commitMount,Z=r.commitUpdate,ee=r.insertBefore,te=r.insertInContainerBefore,ne=r.removeChild,re=r.removeChildFromContainer,ie=r.resetTextContent,oe=r.hideInstance,ue=r.hideTextInstance,ae=r.unhideInstance,le=r.unhideTextInstance,se=r.cloneInstance,ce=r.createContainerChildSet,fe=r.appendChildToContainerChildSet,de=r.finalizeContainerChildren,pe=r.replaceContainerChildren,he=r.cloneHiddenInstance,ve=r.cloneHiddenTextInstance,me=r.canHydrateInstance,ge=r.canHydrateTextInstance,ye=r.isSuspenseInstancePending,_e=r.isSuspenseInstanceFallback,be=r.getNextHydratableSibling,we=r.getFirstHydratableChild,Ee=r.hydrateInstance,De=r.hydrateTextInstance,Se=r.getNextHydratableInstanceAfterSuspenseInstance,Ce=r.commitHydratedContainer,ke=r.commitHydratedSuspenseInstance,Te=/^(.*)[\\\/]/;function xe(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e._debugOwner,i=e._debugSource,o=C(e.type);n=null,r&&(n=C(r.type)),r=o,o="",i?o=" (at "+i.fileName.replace(Te,"")+":"+i.lineNumber+")":n&&(o=" (created by "+n+")"),n="\n in "+(r||"Unknown")+o}t+=n,e=e.return}while(e);return t}new Set;var Ae=[],Oe=-1;function Pe(e){0>Oe||(e.current=Ae[Oe],Ae[Oe]=null,Oe--)}function Ie(e,t){Oe++,Ae[Oe]=e.current,e.current=t}var Ne={},Me={current:Ne},Re={current:!1},Fe=Ne;funcLine truncated
|
||||
/**
|
||||
* @license
|
||||
* Lodash <https://lodash.com/>
|
||||
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/e=n.nmd(e),function(){var i="Expected a function",o="__lodash_placeholder__",u=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],a="[object Arguments]",l="[object Array]",s="[object Boolean]",c="[object Date]",f="[object Error]",d="[object Function]",p="[object GeneratorFunction]",h="[object Map]",v="[object Number]",m="[object Object]",g="[object RegExp]",y="[object Set]",_="[object String]",b="[object Symbol]",w="[object WeakMap]",E="[object ArrayBuffer]",D="[object DataView]",S="[object Float32Array]",C="[object Float64Array]",k="[object Int8Array]",T="[object Int16Array]",x="[object Int32Array]",A="[object Uint8Array]",O="[object Uint16Array]",P="[object Uint32Array]",I=/\b__p \+= '';/g,N=/\b(__p \+=) '' \+/g,M=/(__e\(.*?\)|\b__t\)) \+\n'';/g,R=/&(?:amp|lt|gt|quot|#39);/g,F=/[&<>"']/g,L=RegExp(R.source),B=RegExp(F.source),j=/<%-([\s\S]+?)%>/g,U=/<%([\s\S]+?)%>/g,z=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H=/^\w*$/,V=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,q=/[\\^$.*+?()[\]{}|]/g,G=RegExp(q.source),$=/^\s+|\s+$/g,Y=/^\s+/,K=/\s+$/,X=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,Z=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ee=/\\(\\)?/g,te=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ne=/\w*$/,re=/^[-+]0x[0-9a-f]+$/i,ie=/^0b[01]+$/i,oe=/^\[object .+?Constructor\]$/,ue=/^0o[0-7]+$/i,ae=/^(?:0|[1-9]\d*)$/,le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,se=/($^)/,ce=/['\n\r\u2028\u2029\\]/g,fe="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="[\\ud800-\\udfff]",he="["+de+"]",ve="["+fe+"]",me="\\d+",ge="[\\u2700-\\u27bf]",ye="[a-z\\xdf-\\xf6\\xf8-\\xff]",_e="[^\\ud800-\\udfff"+de+me+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",be="\\ud83c[\\udffb-\\udfff]",we="[^\\ud800-\\udfff]",Ee="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",Se="[A-Z\\xc0-\\xd6\\xd8-\\xde]",Ce="(?:"+ye+"|"+_e+")",ke="(?:"+Se+"|"+_e+")",Te="(?:"+ve+"|"+be+")"+"?",xe="[\\ufe0e\\ufe0f]?"+Te+("(?:\\u200d(?:"+[we,Ee,De].join("|")+")[\\ufe0e\\ufe0f]?"+Te+")*"),Ae="(?:"+[ge,Ee,De].join("|")+")"+xe,Oe="(?:"+[we+ve+"?",ve,Ee,De,pe].join("|")+")",Pe=RegExp("['’]","g"),Ie=RegExp(ve,"g"),Ne=RegExp(be+"(?="+be+")|"+Oe+xe,"g"),Me=RegExp([Se+"?"+ye+"+(?:['’](?:d|ll|m|re|s|t|ve))?(?="+[he,Se,"$"].join("|")+")",ke+"+(?:['’](?:D|LL|M|RE|S|T|VE))?(?="+[he,Se+Ce,"$"].join("|")+")",Se+"?"+Ce+"+(?:['’](?:d|ll|m|re|s|t|ve))?",Se+"+(?:['’](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",me,Ae].join("|"),"g"),Re=RegExp("[\\u200d\\ud800-\\udfff"+fe+"\\ufe0e\\ufe0f]"),Fe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Le=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Be=-1,je={};je[S]=je[C]=je[k]=je[T]=je[x]=je[A]=je["[object Uint8ClampedArray]"]=je[O]=je[P]=!0,je[a]=je[l]=je[E]=je[s]=je[D]=je[c]=je[f]=je[d]=je[h]=je[v]=je[m]=je[g]=je[y]=je[_]=je[w]=!1;var Ue={};Ue[a]=Ue[l]=Ue[E]=Ue[D]=Ue[s]=Ue[c]=Ue[S]=Ue[C]=Ue[k]=Ue[T]=Ue[x]=Ue[h]=Ue[v]=Ue[m]=Ue[g]=Ue[y]=Ue[_]=Ue[b]=Ue[A]=Ue["[object Uint8ClampedArray]"]=Ue[O]=Ue[P]=!0,Ue[f]=Ue[d]=Ue[w]=!1;var ze={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},We=parseFloat,He=parseInt,Ve="object"==typeof global&&global&&global.Object===Object&&global,qe="object"==typeof self&&self&&self.Object===Object&&self,Ge=Ve||qe||Function("return this")(),$e=t&&!t.nodeType&&t,Ye=$e&&e&&!e.nodeType&&e,Ke=Ye&&Ye.exports===$e,Xe=Ke&&Ve.process,Qe=function(){try{var e=Ye&&Ye.require&&Ye.require("util").types;return e||Xe&&Xe.binding&&Xe.binding("util")}catch(e){}}(),Je=Qe&&Qe.isArrayBuffer,Ze=Qe&&Qe.isDate,et=Qe&&Qe.isMap,tt=Qe&&Qe.isRegExp,nt=Qe&&Qe.isSet,rt=Qe&&Qe.isTypedArray;function it(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function ot(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var u=e[i];t(r,u,n(u),e)}return r}function ut(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function at(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function lt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function st(e,t){for(var n=-1,r=null==e?Line truncated
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function i(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,o){for(var u,a,l=i(e),s=1;s<arguments.length;s++){for(var c in u=Object(arguments[s]))n.call(u,c)&&(l[c]=u[c]);if(t){a=t(u);for(var f=0;f<a.length;f++)r.call(u,a[f])&&(l[a[f]]=u[a[f]])}}return l}},834:(e,t,n)=>{"use strict";const r=n(1573),i=new WeakMap,o=(e,t={})=>{if("function"!=typeof e)throw new TypeError("Expected a function");let n,o=!1,u=0;const a=e.displayName||e.name||"<anonymous>",l=function(...r){if(i.set(l,++u),o){if(!0===t.throw)throw new Error(`Function \`${a}\` can only be called once`);return n}return o=!0,n=e.apply(this,r),e=null,n};return r(l,e),i.set(l,u),l};e.exports=o,e.exports.default=o,e.exports.callCount=e=>{if(!i.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return i.get(e)}},8070:(e,t,n)=>{"use strict";const r=n(2413),i=["assert","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"];let o={};e.exports=e=>{const t=new r.PassThrough,n=new r.PassThrough;t.write=t=>e("stdout",t),n.write=t=>e("stderr",t);const u=new console.Console(t,n);for(const e of i)o[e]=console[e],console[e]=u[e];return()=>{for(const e of i)console[e]=o[e];o={}}}},5187:e=>{window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t,n){"use strict";e.exports=n(12)},function(e,t,n){"use strict";
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@license MIT
|
||||
*/var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function u(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,l=u(e),s=1;s<arguments.length;s++){for(var c in n=Object(arguments[s]))i.call(n,c)&&(l[c]=n[c]);if(r){a=r(n);for(var f=0;f<a.length;f++)o.call(n,a[f])&&(l[a[f]]=n[a[f]])}}return l}},function(e,t,n){(function(t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,u=/^0o[0-7]+$/i,a=parseInt,l="object"==(void 0===t?"undefined":n(t))&&t&&t.Object===Object&&t,s="object"==("undefined"==typeof self?"undefined":n(self))&&self&&self.Object===Object&&self,c=l||s||Function("return this")(),f=Object.prototype.toString,d=Math.max,p=Math.min,h=function(){return c.Date.now()};function v(e){var t=n(e);return!!e&&("object"==t||"function"==t)}function m(e){return"symbol"==n(e)||function(e){return!!e&&"object"==n(e)}(e)&&"[object Symbol]"==f.call(e)}function g(e){if("number"==typeof e)return e;if(m(e))return NaN;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=o.test(e);return n||u.test(e)?a(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError("Expected a function");return v(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),function(e,t,n){var r,i,o,u,a,l,s=0,c=!1,f=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=r,o=i;return r=i=void 0,s=t,u=e.apply(o,n)}function _(e){return s=e,a=setTimeout(w,t),c?y(e):u}function b(e){var n=e-l;return void 0===l||n>=t||n<0||f&&e-s>=o}function w(){var e=h();if(b(e))return E(e);a=setTimeout(w,function(e){var n=t-(e-l);return f?p(n,o-(e-s)):n}(e))}function E(e){return a=void 0,m&&r?y(e):(r=i=void 0,u)}function D(){var e=h(),n=b(e);if(r=arguments,i=this,l=e,n){if(void 0===a)return _(l);if(f)return a=setTimeout(w,t),y(l)}return void 0===a&&(a=setTimeout(w,t)),u}return t=g(t)||0,v(n)&&(c=!!n.leading,o=(f="maxWait"in n)?d(g(n.maxWait)||0,t):o,m="trailing"in n?!!n.trailing:m),D.cancel=function(){void 0!==a&&clearTimeout(a),s=0,r=l=i=a=void 0},D.flush=function(){return void 0===a?u:E(h())},D}(e,t,{leading:r,maxWait:t,trailing:i})}}).call(this,n(4))},function(e,t,n){(function(n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i;t=e.exports=p,i="object"===(void 0===n?"undefined":r(n))&&n.env&&n.env.NODE_DEBUG&&/\bsemver\b/i.test(n.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var o=Number.MAX_SAFE_INTEGER||9007199254740991,u=t.re=[],a=t.src=[],l=t.tokens={},s=0;function c(e){l[e]=s++}c("NUMERICIDENTIFIER"),a[l.NUMERICIDENTIFIER]="0|[1-9]\\d*",c("NUMERICIDENTIFIERLOOSE"),a[l.NUMERICIDENTIFIERLOOSE]="[0-9]+",c("NONNUMERICIDENTIFIER"),a[l.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*",c("MAINVERSION"),a[l.MAINVERSION]="("+a[l.NUMERICIDENTIFIER]+")\\.("+a[l.NUMERICIDENTIFIER]+")\\.("+a[l.NUMERICIDENTIFIER]+")",c("MAINVERSIONLOOSE"),a[l.MAINVERSIONLOOSE]="("+a[l.NUMERICIDENTIFIERLOOSE]+")\\.("+a[l.NUMERICIDENTIFIERLOOSE]+")\\.("+a[l.NUMERICIDENTIFIERLOOSE]+")",c("PRERELEASEIDENTIFIER"),a[l.PRERELEASEIDENTIFIER]="(?:"+a[l.NUMERICIDENTIFIER]+"|"+a[l.NONNUMERICIDENTIFIER]+")",c("PRERELEASEIDENTIFIERLOOSE"),a[l.PRERELEASEIDENTIFIERLOOSE]="(?:"+a[l.NUMERICIDENTIFIERLOOSE]+"|"+a[l.NONNUMERICIDENTIFIER]+")",c("PRERELEASE"),a[l.PRERELEASE]="(?:-("+a[l.PRERELEASEIDENTIFIER]+"(?:\\."+a[l.PRERELEASEIDENTIFIER]+")*))",c("PRERELEASELOOSE"),a[l.PRERELEASELOOSE]="(?:-?("+a[l.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+a[l.PRERELEASEIDENTIFIERLOOSE]+")*))",c("BUILDIDENTIFIER"),a[l.BUILDIDENTIFIER]="[0-9A-Za-z-]+",c("BUILD"),a[l.BUILD]="(?:\\+("+a[l.BUILDIDENTIFIER]+"(?:\\."+a[l.BUILDIDENTIFIER]+")*))",c("FULL"),c("FULLPLAIN"),a[l.FULLPLAIN]="v?"+a[l.MAINVERSION]+a[l.PRERELEASE]+"?"+a[l.BUILD]+"?",a[l.FULL]="^"+a[l.FULLPLAIN]+"$",c("LOOSEPLAIN"),a[l.LOOSEPLAIN]="[v=\Line truncated
|
||||
/*! promise-polyfill 2.0.1 */
|
||||
function(r){function i(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!=n(this))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(e,i(a,this),i(l,this))}function u(e){var t=this;return null===this._state?void this._deferreds.push(e):void d((function(){var n=t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void e.reject(t)}e.resolve(r)}else(t._state?e.resolve:e.reject)(t._value)}))}function a(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==n(e)||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void f(i(t,e),i(a,this),i(l,this))}this._state=!0,this._value=e,s.call(this)}catch(e){l.call(this,e)}}function l(e){this._state=!1,this._value=e,s.call(this)}function s(){for(var e=0,t=this._deferreds.length;t>e;e++)u.call(this,this._deferreds[e]);this._deferreds=null}function c(e,t,n,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r}function f(e,t,n){var r=!1;try{e((function(e){r||(r=!0,t(e))}),(function(e){r||(r=!0,n(e))}))}catch(e){if(r)return;r=!0,n(e)}}var d=o.immediateFn||"function"==typeof t&&t||function(e){setTimeout(e,1)},p=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=this;return new o((function(r,i){u.call(n,new c(e,t,r,i))}))},o.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&p(arguments[0])?arguments[0]:arguments);return new o((function(t,r){function i(u,a){try{if(a&&("object"==n(a)||"function"==typeof a)){var l=a.then;if("function"==typeof l)return void l.call(a,(function(e){i(u,e)}),r)}e[u]=a,0==--o&&t(e)}catch(e){r(e)}}if(0===e.length)return t([]);for(var o=e.length,u=0;u<e.length;u++)i(u,e[u])}))},o.resolve=function(e){return e&&"object"==n(e)&&e.constructor===o?e:new o((function(t){t(e)}))},o.reject=function(e){return new o((function(t,n){n(e)}))},o.race=function(e){return new o((function(t,n){for(var r=0,i=e.length;i>r;r++)e[r].then(t,n)}))},e.exports?e.exports=o:r.Promise||(r.Promise=o)}(this),u.copy=function(e){return new Promise((function(t,n){if("string"!=typeof e&&!("text/plain"in e))throw new Error("You must provide a text/plain type.");var r="string"==typeof e?e:e["text/plain"];window.clipboardData.setData("Text",r)?t():n(new Error("Copying was rejected."))}))},u.paste=function(){return new Promise((function(e,t){var n=window.clipboardData.getData("Text");n?e(n):t(new Error("Pasting was rejected."))}))}),u}()}).call(this,n(13).setImmediate)},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){"use strict";n.r(t),t.default=":root {\n /**\n * IMPORTANT: When new theme variables are added below– also add them to SettingsContext updateThemeVariables()\n */\n\n /* Light theme */\n --light-color-attribute-name: #ef6632;\n --light-color-attribute-name-not-editable: #23272f;\n --light-color-attribute-name-inverted: rgba(255, 255, 255, 0.7);\n --light-color-attribute-value: #1a1aa6;\n --light-color-attribute-value-inverted: #ffffff;\n --light-color-attribute-editable-value: #1a1aa6;\n --light-color-background: #ffffff;\n --light-color-background-hover: rgba(0, 136, 250, 0.1);\n --light-color-background-inactive: #e5e5e5;\n --light-color-background-invalid: #fff0f0;\n --light-color-background-selected: #0088fa;\n --light-color-button-background: #ffffff;\n --light-color-button-background-focus: #ededed;\n --light-color-button: #5f6673;\n --light-color-button-disabled: #cfd1d5;\n --light-color-button-active: #0088fa;\n --light-color-button-focus: #23272f;\n --light-color-button-hover: #23272f;\n --light-color-border: #eeeeee;\n --light-color-commit-did-not-render-fill: #cfd1d5;\n --light-color-commit-did-not-render-fill-text: #000000;\n --light-color-commit-did-not-render-pattern: #cfd1d5;\n --light-color-commit-did-not-render-pattern-text: #333333;\n --light-color-commit-gradient-0: #37afa9;\n --light-color-commit-gradient-1: #63b19e;\n --light-color-commit-gradient-2: #80b393;\n --light-color-commit-gradient-3: #97b488;\n --light-color-commit-gradient-4: #abb67d;\n --light-color-commit-gradient-5: #beb771;\n --light-color-commit-gradient-6: #cfb965;\n --light-color-commit-gradient-7: #dfba57;\n --light-color-commit-gradient-8: #efbb49;\n --light-color-commit-gradient-9: #febc38;\n --light-color-commit-gradient-text: #000000;\n --light-color-component-name: #6a51b2;\n --light-color-component-name-inverted: #ffffff;\n --light-color-component-badge-background: rgba(0, 0, 0, 0.1);\n --light-color-component-badge-background-inverted: rgba(255, 255, 255, 0.25);\n --light-color-component-badge-count: #777d88;\n --light-color-component-badge-count-inverted: rgba(255, 255, 2Line truncated
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react-is.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=60103,o=60106,u=60107,a=60108,l=60114,s=60109,c=60110,f=60112,d=60113,p=60120,h=60115,v=60116,m=60121,g=60122,y=60117,_=60129,b=60131;if("function"==typeof Symbol&&Symbol.for){var w=Symbol.for;i=w("react.element"),o=w("react.portal"),u=w("react.fragment"),a=w("react.strict_mode"),l=w("react.profiler"),s=w("react.provider"),c=w("react.context"),f=w("react.forward_ref"),d=w("react.suspense"),p=w("react.suspense_list"),h=w("react.memo"),v=w("react.lazy"),m=w("react.block"),g=w("react.server.block"),y=w("react.fundamental"),_=w("react.debug_trace_mode"),b=w("react.legacy_hidden")}function E(e){if("object"===r(e)&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case u:case l:case a:case d:case p:return e;default:switch(e=e&&e.$$typeof){case c:case f:case v:case h:case s:return e;default:return t}}case o:return t}}}var D=s,S=i,C=f,k=u,T=v,x=h,A=o,O=l,P=a,I=d;t.ContextConsumer=c,t.ContextProvider=D,t.Element=S,t.ForwardRef=C,t.Fragment=k,t.Lazy=T,t.Memo=x,t.Portal=A,t.Profiler=O,t.StrictMode=P,t.Suspense=I,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"===r(e)&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return E(e)===f},t.isFragment=function(e){return E(e)===u},t.isLazy=function(e){return E(e)===v},t.isMemo=function(e){return E(e)===h},t.isPortal=function(e){return E(e)===o},t.isProfiler=function(e){return E(e)===l},t.isStrictMode=function(e){return E(e)===a},t.isSuspense=function(e){return E(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===l||e===_||e===a||e===d||e===p||e===b||"object"===r(e)&&null!==e&&(e.$$typeof===v||e.$$typeof===h||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===y||e.$$typeof===m||e[0]===g)},t.typeOf=E},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(14),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(4))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i,o,u,a,l=1,s={},c=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){h(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(u="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(u)&&h(+t.data.slice(u.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(u+t,"*")}):e.MessageChannel?((o=new MessageChannel).port1.onmessage=function(e){h(e.data)},r=function(e){o.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(i=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):r=function(e){setTimeout(h,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return s[l]=i,r(l),l++},d.clearImmediate=p}function p(e){delete s[e]}function h(e){if(c)setTimeout(h,0,e);else{var t=s[e];if(t){c=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{p(e),c=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(4),n(5))},function(e,t,n){"use strict";
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react-debug-tools.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(1),o=n(16),u=n(18).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,a=60128;if("function"==typeof Symbol&&Symbol.for){var l=Symbol.for;a=l("react.opaque.id")}var s=[],c=null,f=null;function d(){if(null===c){var e=new Map;try{v.useContext({_currentValue:null}),v.useState(null),v.useReducer((function(e){return e}),null),v.useRef(null),v.useLayoutEffect((function(){})),v.useEffect((function(){})),v.useImperativeHandle(void 0,(function(){return null})),v.useDebugValue(null),v.useCallback((function(){})),v.useMemo((function(){return null}))}finally{var t=s;s=[]}for(var n=0;n<t.length;n++){var r=t[n];e.set(r.primitive,o.parse(r.stackError))}c=e}return c}var p=null;function h(){var e=p;return null!==e&&(p=e.next),e}var v={readContext:function(e){return e._currentValue},useCallback:function(e){var t=h();return s.push({primitive:"Callback",stackError:Error(),value:null!==t?t.memoizedState[0]:e}),e},useContext:function(e){return s.push({primitive:"Context",stackError:Error(),value:e._currentValue}),e._currentValue},useEffect:function(e){h(),s.push({primitive:"Effect",stackError:Error(),value:e})},useImperativeHandle:function(e){h();var t=void 0;null!==e&&"object"===r(e)&&(t=e.current),s.push({primitive:"ImperativeHandle",stackError:Error(),value:t})},useDebugValue:function(e,t){s.push({primitive:"DebugValue",stackError:Error(),value:"function"==typeof t?t(e):e})},useLayoutEffect:function(e){h(),s.push({primitive:"LayoutEffect",stackError:Error(),value:e})},useMemo:function(e){var t=h();return e=null!==t?t.memoizedState[0]:e(),s.push({primitive:"Memo",stackError:Error(),value:e}),e},useReducer:function(e,t,n){return t=null!==(e=h())?e.memoizedState:void 0!==n?n(t):t,s.push({primitive:"Reducer",stackError:Error(),value:t}),[t,function(){}]},useRef:function(e){var t=h();return e=null!==t?t.memoizedState:{current:e},s.push({primitive:"Ref",stackError:Error(),value:e.current}),e},useState:function(e){var t=h();return e=null!==t?t.memoizedState:"function"==typeof e?e():e,s.push({primitive:"State",stackError:Error(),value:e}),[e,function(){}]},useTransition:function(){return h(),h(),s.push({primitive:"Transition",stackError:Error(),value:void 0}),[function(){},!1]},useMutableSource:function(e,t){return h(),h(),h(),h(),e=t(e._source),s.push({primitive:"MutableSource",stackError:Error(),value:e}),e},useDeferredValue:function(e){return h(),h(),s.push({primitive:"DeferredValue",stackError:Error(),value:e}),e},useOpaqueIdentifier:function(){var e=h();return f&&0===f.mode&&h(),(e=null===e?void 0:e.memoizedState)&&e.$$typeof===a&&(e=void 0),s.push({primitive:"OpaqueIdentifier",stackError:Error(),value:e}),e}},m=0;function g(e,t,n){var r=t[n].source,i=0;e:for(;i<e.length;i++)if(e[i].source===r){for(var o=n+1,u=i+1;o<t.length&&u<e.length;o++,u++)if(e[u].source!==t[o].source)continue e;return i}return-1}function y(e,t){return!(!e||(t="use"+t,e.length<t.length||e.lastIndexOf(t)!==e.length-t.length))}function _(e){if(!e)return"";var t=e.lastIndexOf(".");return-1===t&&(t=0),"use"===e.substr(t,3)&&(t+=3),e.substr(t)}function b(e,t){for(var n=[],r=null,i=n,u=0,a=[],l=0;l<t.length;l++){var s=t[l],c=e,f=o.parse(s.stackError);e:{var p=f,h=g(p,c,m);if(-1!==h)c=h;else{for(var v=0;v<c.length&&5>v;v++)if(-1!==(h=g(p,c,v))){m=v,c=h;break e}c=-1}}e:{if(p=f,void 0!==(h=d().get(s.primitive)))for(v=0;v<h.length&&v<p.length;v++)if(h[v].source!==p[v].source){v<p.length-1&&y(p[v].functionName,s.primitive)&&v++,v<p.length-1&&y(p[v].functionName,s.primitive)&&v++,p=v;break e}p=-1}if(null!==(f=-1===c||-1===p||2>c-p?null:f.slice(p,c-1))){if(c=0,null!==r){for(;c<f.length&&c<r.length&&f[f.length-c-1].source===r[r.length-c-1].source;)c++;for(r=r.length-1;r>c;r--)i=a.pop()}for(r=f.length-c-1;1<=r;r--)c=[],i.push({id:null,isStateEditable:!1,name:_(f[r-1].functionName),value:void 0,subHooks:c}),a.push(i),i=c;r=f}c="Context"===(f=s.primitive)||"DebugValue"===f?null:u++,i.push({id:c,isStateEditable:"Reducer"===f||"State"===f,name:f,value:s.value,subHooks:[]})}return function e(t,n){for(var r=[],i=0;i<t.length;i++){var o=t[i];"DebugValue"===o.name&&0===o.subHooks.length?(t.splice(i,1),i--,r.push(o)):e(o.subHooks,o)}null!==n&&(1===r.length?n.value=r[0].value:1<r.length&&(n.value=r.map((function(e){return e.value}))))}(n,null),n}function w(e,t,n){null==n&&(n=u.ReactCurrentDispatcher);var r=n.current;n.current=v;try{var i=Error();e(t)}finally{e=s,s=[],n.current=r}return b(n=o.parse(i),e)}t.inspectHooks=w,t.inspectHooksOfFiber=function(e,t){if(null==t&&(t=u.ReactCurrentDispatcher),f=e,0!==e.tag&&15!==e.tag&&11!==e.tag&&22!==e.tag)throw Error("Unknown Fiber. Needs to be a function component to inspect hooks.");d();var n=e.type,r=e.memoizedProps;if(n!==e.elementType&&n&&n.defaultProps){r=i({},r);var a=n.defaultProps;for(l in a)void 0Line truncated
|
||||
/** @license React v0.0.0-experimental-51a3aa6af
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var i=n(1),o=60103,u=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var a=60109,l=60110,s=60112;t.Suspense=60113,t.unstable_SuspenseList=60120;var c=60115,f=60116,d=60121;if(t.unstable_DebugTracingMode=60129,t.unstable_LegacyHidden=60131,"function"==typeof Symbol&&Symbol.for){var p=Symbol.for;o=p("react.element"),u=p("react.portal"),t.Fragment=p("react.fragment"),t.StrictMode=p("react.strict_mode"),t.Profiler=p("react.profiler"),a=p("react.provider"),l=p("react.context"),s=p("react.forward_ref"),t.Suspense=p("react.suspense"),t.unstable_SuspenseList=p("react.suspense_list"),c=p("react.memo"),f=p("react.lazy"),d=p("react.block"),t.unstable_DebugTracingMode=p("react.debug_trace_mode"),t.unstable_LegacyHidden=p("react.legacy_hidden")}var h="function"==typeof Symbol&&Symbol.iterator;function v(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}function _(){}function b(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}y.prototype.isReactComponent={},y.prototype.setState=function(e,t){if("object"!==r(e)&&"function"!=typeof e&&null!=e)throw Error(v(85));this.updater.enqueueSetState(this,e,t,"setState")},y.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},_.prototype=y.prototype;var w=b.prototype=new _;w.constructor=b,i(w,y.prototype),w.isPureReactComponent=!0;var E={current:null},D=Object.prototype.hasOwnProperty,S={key:!0,ref:!0,__self:!0,__source:!0};function C(e,t,n){var r,i={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)D.call(t,r)&&!S.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(1===l)i.children=n;else if(1<l){for(var s=Array(l),c=0;c<l;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===i[r]&&(i[r]=l[r]);return{$$typeof:o,type:e,key:u,ref:a,props:i,_owner:E.current}}function k(e){return"object"===r(e)&&null!==e&&e.$$typeof===o}var T=/\/+/g;function x(e,t){return"object"===r(e)&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function A(e,t,n,i,a){var l=r(e);"undefined"!==l&&"boolean"!==l||(e=null);var s=!1;if(null===e)s=!0;else switch(l){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case o:case u:s=!0}}if(s)return a=a(s=e),e=""===i?"."+x(s,0):i,Array.isArray(a)?(n="",null!=e&&(n=e.replace(T,"$&/")+"/"),A(a,t,n,"",(function(e){return e}))):null!=a&&(k(a)&&(a=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(a,n+(!a.key||s&&s.key===a.key?"":(""+a.key).replace(T,"$&/")+"/")+e)),t.push(a)),1;if(s=0,i=""===i?".":i+":",Array.isArray(e))for(var c=0;c<e.length;c++){var f=i+x(l=e[c],c);s+=A(l,t,n,f,a)}else if("function"==typeof(f=function(e){return null===e||"object"!==r(e)?null:"function"==typeof(e=h&&e[h]||e["@@iterator"])?e:null}(e)))for(e=f.call(e),c=0;!(l=e.next()).done;)s+=A(l=l.value,t,n,f=i+x(l,c++),a);else if("object"===l)throw t=""+e,Error(v(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return s}function O(e,t,n){if(null==e)return e;var r=[],i=0;return A(e,r,"","",(function(e){return t.call(n,e,i++)})),r}function P(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}function I(e){return{$$typeof:d,_data:e.load.apply(null,e.args),_render:e.render}}var N={current:null};function M(){var e=N.current;if(null===e)throw Error(v(321));return e}var R={transition:0},F={ReactCurrentDispatcher:N,ReactCurrentBatchConfig:R,ReactCurrentOwner:E,IsSomeRendererActing:{current:!1},assign:i};t.Children={map:O,forEach:function(e,t,n){O(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;return O(e,(function(){t++})),t},toArray:function(e){return O(e,(function(e){return e}))||[]},only:function(e){if(!k(e))throw Error(v(143));return e}},t.Component=y,t.PureComponent=b,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=F,t.cloneElement=function(e,t,n){if(null==e)throw Error(v(267,e));var r=i({},e.props),u=e.key,a=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,l=E.cuLine truncated
|
||||
/** @license React v16.13.1
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var r=n(9381),i="function"==typeof Symbol&&Symbol.for,o=i?Symbol.for("react.element"):60103,u=i?Symbol.for("react.portal"):60106,a=i?Symbol.for("react.fragment"):60107,l=i?Symbol.for("react.strict_mode"):60108,s=i?Symbol.for("react.profiler"):60114,c=i?Symbol.for("react.provider"):60109,f=i?Symbol.for("react.context"):60110,d=i?Symbol.for("react.forward_ref"):60112,p=i?Symbol.for("react.suspense"):60113,h=i?Symbol.for("react.memo"):60115,v=i?Symbol.for("react.lazy"):60116,m="function"==typeof Symbol&&Symbol.iterator;function g(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_={};function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||y}function w(){}function E(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||y}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(g(85));this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},w.prototype=b.prototype;var D=E.prototype=new w;D.constructor=E,r(D,b.prototype),D.isPureReactComponent=!0;var S={current:null},C=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function T(e,t,n){var r,i={},u=null,a=null;if(null!=t)for(r in void 0!==t.ref&&(a=t.ref),void 0!==t.key&&(u=""+t.key),t)C.call(t,r)&&!k.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(1===l)i.children=n;else if(1<l){for(var s=Array(l),c=0;c<l;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===i[r]&&(i[r]=l[r]);return{$$typeof:o,type:e,key:u,ref:a,props:i,_owner:S.current}}function x(e){return"object"==typeof e&&null!==e&&e.$$typeof===o}var A=/\/+/g,O=[];function P(e,t,n,r){if(O.length){var i=O.pop();return i.result=e,i.keyPrefix=t,i.func=n,i.context=r,i.count=0,i}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function I(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>O.length&&O.push(e)}function N(e,t,n){return null==e?0:function e(t,n,r,i){var a=typeof t;"undefined"!==a&&"boolean"!==a||(t=null);var l=!1;if(null===t)l=!0;else switch(a){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case o:case u:l=!0}}if(l)return r(i,t,""===n?"."+M(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var s=0;s<t.length;s++){var c=n+M(a=t[s],s);l+=e(a,c,r,i)}else if(null===t||"object"!=typeof t?c=null:c="function"==typeof(c=m&&t[m]||t["@@iterator"])?c:null,"function"==typeof c)for(t=c.call(t),s=0;!(a=t.next()).done;)l+=e(a=a.value,c=n+M(a,s++),r,i);else if("object"===a)throw r=""+t,Error(g(31,"[object Object]"===r?"object with keys {"+Object.keys(t).join(", ")+"}":r,""));return l}(e,"",t,n)}function M(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,(function(e){return t[e]}))}(e.key):t.toString(36)}function R(e,t){e.func.call(e.context,t,e.count++)}function F(e,t,n){var r=e.result,i=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?L(e,r,n,(function(e){return e})):null!=e&&(x(e)&&(e=function(e,t){return{$$typeof:o,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,i+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(A,"$&/")+"/")+n)),r.push(e))}function L(e,t,n,r,i){var o="";null!=n&&(o=(""+n).replace(A,"$&/")+"/"),N(e,F,t=P(t,o,r,i)),I(t)}var B={current:null};function j(){var e=B.current;if(null===e)throw Error(g(321));return e}var U={ReactCurrentDispatcher:B,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:S,IsSomeRendererActing:{current:!1},assign:r};t.Children={map:function(e,t,n){if(null==e)return e;var r=[];return L(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;N(e,R,t=P(null,null,t,n)),I(t)},count:function(e){return N(e,(function(){return null}),null)},toArray:function(e){var t=[];return L(e,t,null,(function(e){return e})),t},only:function(e){if(!x(e))throw Error(g(143));return e}},t.Component=b,t.Fragment=a,t.Profiler=s,t.PureComponent=E,t.StrictMode=l,t.Suspense=p,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U,t.cloneElement=function(e,t,n){if(null==e)throw Error(g(267,e));var i=r({},e.props),u=e.key,a=e.ref,l=e._owner;if(null!=t){if(void 0!==t.ref&&(a=t.ref,l=S.current),void 0!==t.key&&(u=""+t.key),e.type&&e.type.defaultProps)var s=e.type.defaultProps;for(c in t)C.call(t,c)&&!k.hasOwnProperty(c)&&(i[c]=void 0===t[c]&&void 0!==s?s[c]:t[c])}var c=arguments.length-2;if(1===c)i.children=n;else if(1<c){s=Array(c);for(var f=0;f<c;f++)s[f]=arguments[f+2];i.children=s}return{$$typeof:o,Line truncated
|
||||
/** @license React v0.18.0
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var n,r,i,o,u;if(Object.defineProperty(t,"__esModule",{value:!0}),"undefined"==typeof window||"function"!=typeof MessageChannel){var a=null,l=null,s=function(){if(null!==a)try{var e=t.unstable_now();a(!0,e),a=null}catch(e){throw setTimeout(s,0),e}},c=Date.now();t.unstable_now=function(){return Date.now()-c},n=function(e){null!==a?setTimeout(n,0,e):(a=e,setTimeout(s,0))},r=function(e,t){l=setTimeout(e,t)},i=function(){clearTimeout(l)},o=function(){return!1},u=t.unstable_forceFrameRate=function(){}}else{var f=window.performance,d=window.Date,p=window.setTimeout,h=window.clearTimeout;if("undefined"!=typeof console){var v=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof v&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills")}if("object"==typeof f&&"function"==typeof f.now)t.unstable_now=function(){return f.now()};else{var m=d.now();t.unstable_now=function(){return d.now()-m}}var g=!1,y=null,_=-1,b=5,w=0;o=function(){return t.unstable_now()>=w},u=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing framerates higher than 125 fps is not unsupported"):b=0<e?Math.floor(1e3/e):5};var E=new MessageChannel,D=E.port2;E.port1.onmessage=function(){if(null!==y){var e=t.unstable_now();w=e+b;try{y(!0,e)?D.postMessage(null):(g=!1,y=null)}catch(e){throw D.postMessage(null),e}}else g=!1},n=function(e){y=e,g||(g=!0,D.postMessage(null))},r=function(e,n){_=p((function(){e(t.unstable_now())}),n)},i=function(){h(_),_=-1}}function S(e,t){var n=e.length;e.push(t);e:for(;;){var r=Math.floor((n-1)/2),i=e[r];if(!(void 0!==i&&0<T(i,t)))break e;e[r]=t,e[n]=i,n=r}}function C(e){return void 0===(e=e[0])?null:e}function k(e){var t=e[0];if(void 0!==t){var n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,i=e.length;r<i;){var o=2*(r+1)-1,u=e[o],a=o+1,l=e[a];if(void 0!==u&&0>T(u,n))void 0!==l&&0>T(l,u)?(e[r]=l,e[a]=n,r=a):(e[r]=u,e[o]=n,r=o);else{if(!(void 0!==l&&0>T(l,n)))break e;e[r]=l,e[a]=n,r=a}}}return t}return null}function T(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var x=[],A=[],O=1,P=null,I=3,N=!1,M=!1,R=!1;function F(e){for(var t=C(A);null!==t;){if(null===t.callback)k(A);else{if(!(t.startTime<=e))break;k(A),t.sortIndex=t.expirationTime,S(x,t)}t=C(A)}}function L(e){if(R=!1,F(e),!M)if(null!==C(x))M=!0,n(B);else{var t=C(A);null!==t&&r(L,t.startTime-e)}}function B(e,n){M=!1,R&&(R=!1,i()),N=!0;var u=I;try{for(F(n),P=C(x);null!==P&&(!(P.expirationTime>n)||e&&!o());){var a=P.callback;if(null!==a){P.callback=null,I=P.priorityLevel;var l=a(P.expirationTime<=n);n=t.unstable_now(),"function"==typeof l?P.callback=l:P===C(x)&&k(x),F(n)}else k(x);P=C(x)}if(null!==P)var s=!0;else{var c=C(A);null!==c&&r(L,c.startTime-n),s=!1}return s}finally{P=null,I=u,N=!1}}function j(e){switch(e){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1e4;default:return 5e3}}var U=u;t.unstable_ImmediatePriority=1,t.unstable_UserBlockingPriority=2,t.unstable_NormalPriority=3,t.unstable_IdlePriority=5,t.unstable_LowPriority=4,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=I;I=e;try{return t()}finally{I=n}},t.unstable_next=function(e){switch(I){case 1:case 2:case 3:var t=3;break;default:t=I}var n=I;I=t;try{return e()}finally{I=n}},t.unstable_scheduleCallback=function(e,o,u){var a=t.unstable_now();if("object"==typeof u&&null!==u){var l=u.delay;l="number"==typeof l&&0<l?a+l:a,u="number"==typeof u.timeout?u.timeout:j(e)}else u=j(e),l=a;return e={id:O++,callback:o,priorityLevel:e,startTime:l,expirationTime:u=l+u,sortIndex:-1},l>a?(e.sortIndex=l,S(A,e),null===C(x)&&e===C(A)&&(R?i():R=!0,r(L,l-a))):(e.sortIndex=u,S(x,e),M||N||(M=!0,n(B))),e},t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_wrapCallback=function(e){var t=I;return function(){var n=I;I=t;try{return e.apply(this,arguments)}finally{I=n}}},t.unstable_getCurrentPriorityLevel=function(){return I},t.unstable_shouldYield=function(){var e=t.unstable_now();F(e);var n=C(x);return n!==P&&null!==P&&null!==n&&null!==n.callback&&n.startTime<=e&&n.expirationTime<P.expirationTime||o()},t.unstable_requestPaint=U,t.unstable_continueExecution=function(){M||N||(M=!0,n(B))},t.unstable_pauseExecution=function(){},t.unstable_getFirstCallbackNode=function(){return C(x)},t.unstable_Profiling=null},7181:(e,t,n)=>{"use strict";e.exports=n(706)},6458:(e,t,n)=>{var r,i=n(2357),o=n(8082),u=n(8614);function a(){c&&(c=!1,o.forEach((function(e){try{process.removeListener(e,s[e])}catch(e){}})),process.emit=h,process.reallyExit=d,r.count-=1)}function l(e,t,n){r.emitted[e]||(r.emitted[e]=!0,r.emit(e,t,n))}"function"!=typeof u&&(u=u.EventEmitter),process.__sig
Line truncated
|
||||
return plugin;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
/* eslint-disable */
|
||||
module.exports = {
|
||||
name: "@yarnpkg/plugin-typescript",
|
||||
factory: function (require) {
|
||||
var plugin;plugin=(()=>{var e={958:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});const s=require("@yarnpkg/core"),a=require("@yarnpkg/plugin-essentials"),o=require("semver");var n=r.n(o),i=r(410),c=r.n(i);const d=e=>{const t={async send(t){try{const r=await s.httpUtils.request(t.url,t.data||null,{configuration:e,headers:t.headers});return{content:r.body,isTimedOut:!1,status:r.statusCode}}catch(e){return{content:e.response.body,isTimedOut:!1,status:e.response.statusCode}}}};return c()("OFCNCOG2CU","e8e1bd300d860104bb8c58453ffa1eb4",{requester:t})},l=e=>e.scope?`${e.scope}__${e.name}`:""+e.name,u={hooks:{afterWorkspaceDependencyAddition:async(e,t,r,o)=>{if("types"===r.scope)return;const{project:i}=e,{configuration:c}=i,u=c.makeResolver(),p={project:i,resolver:u,report:new s.ThrowReport};if(!await(async(e,t)=>{var r;const a=s.structUtils.stringifyIdent(e),o=d(t).initIndex("npm-search");try{return"definitely-typed"===(null===(r=(await o.getObject(a,{attributesToRetrieve:["types"]})).types)||void 0===r?void 0:r.ts)}catch(e){return!1}})(r,c))return;const m=l(r);let h=s.structUtils.parseRange(r.range).selector;if(!n().validRange(h)){const e=await u.getCandidates(r,new Map,p);h=s.structUtils.parseRange(e[0].reference).selector}const y=n().coerce(h);if(null===y)return;const g=`${a.suggestUtils.Modifier.CARET}${y.major}`,b=s.structUtils.makeDescriptor(s.structUtils.makeIdent("types",m),g),f=s.miscUtils.mapAndFind(i.workspaces,e=>{var t,a;const o=null===(t=e.manifest.dependencies.get(r.identHash))||void 0===t?void 0:t.descriptorHash,n=null===(a=e.manifest.devDependencies.get(r.identHash))||void 0===a?void 0:a.descriptorHash;if(o!==r.descriptorHash&&n!==r.descriptorHash)return s.miscUtils.mapAndFind.skip;const i=[];for(const t of s.Manifest.allDependencies){const r=e.manifest[t].get(b.identHash);void 0!==r&&i.push([t,r])}return 0===i.length?s.miscUtils.mapAndFind.skip:i});if(void 0!==f)for(const[t,r]of f)e.manifest[t].set(r.identHash,r);else{try{if(0===(await u.getCandidates(b,new Map,p)).length)return}catch(e){return}e.manifest[a.suggestUtils.Target.DEVELOPMENT].set(b.identHash,b)}},afterWorkspaceDependencyRemoval:async(e,t,r)=>{if("types"===r.scope)return;const a=l(r),o=s.structUtils.makeIdent("types",a);for(const t of s.Manifest.allDependencies){void 0!==e.manifest[t].get(o.identHash)&&e.manifest[t].delete(o.identHash)}},beforeWorkspacePacking:(e,t)=>{t.publishConfig&&t.publishConfig.typings&&(t.typings=t.publishConfig.typings),t.publishConfig&&t.publishConfig.types&&(t.types=t.publishConfig.types)}}}},469:(e,t,r)=>{"use strict";function s(e){const t=[...e.caches],r=t.shift();return void 0===r?a():{get:(e,a,o={miss:()=>Promise.resolve()})=>r.get(e,a,o).catch(()=>s({caches:t}).get(e,a,o)),set:(e,a)=>r.set(e,a).catch(()=>s({caches:t}).set(e,a)),delete:e=>r.delete(e).catch(()=>s({caches:t}).delete(e)),clear:()=>r.clear().catch(()=>s({caches:t}).clear())}}function a(){return{get:(e,t,r={miss:()=>Promise.resolve()})=>t().then(e=>Promise.all([e,r.miss(e)])).then(([e])=>e),set:(e,t)=>Promise.resolve(t),delete:e=>Promise.resolve(),clear:()=>Promise.resolve()}}r.r(t),r.d(t,{createFallbackableCache:()=>s,createNullCache:()=>a})},712:(e,t,r)=>{"use strict";function s(e={serializable:!0}){let t={};return{get(r,s,a={miss:()=>Promise.resolve()}){const o=JSON.stringify(r);if(o in t)return Promise.resolve(e.serializable?JSON.parse(t[o]):t[o]);const n=s(),i=a&&a.miss||(()=>Promise.resolve());return n.then(e=>i(e)).then(()=>n)},set:(r,s)=>(t[JSON.stringify(r)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)),delete:e=>(delete t[JSON.stringify(e)],Promise.resolve()),clear:()=>(t={},Promise.resolve())}}r.r(t),r.d(t,{createInMemoryCache:()=>s})},223:(e,t,r)=>{"use strict";r.r(t),r.d(t,{addABTest:()=>i,createAnalyticsClient:()=>n,deleteABTest:()=>c,getABTest:()=>d,getABTests:()=>l,stopABTest:()=>u});var s=r(757),a=r(858),o=r(541);const n=e=>{const t=e.region||"us",r=(0,s.createAuth)(s.AuthMode.WithinHeaders,e.appId,e.apiKey),o=(0,a.createTransporter)({hosts:[{url:`analytics.${t}.algolia.com`}],...e,headers:{...r.headers(),"content-type":"application/json",...e.headers},queryParameters:{...r.queryParameters(),...e.queryParameters}}),n=e.appId;return(0,s.addMethods)({appId:n,transporter:o},e.methods)},i=e=>(t,r)=>e.transporter.write({method:o.N.Post,path:"2/abtests",data:t},r),c=e=>(t,r)=>e.transporter.write({method:o.N.Delete,path:(0,s.encode)("2/abtests/%s",t)},r),d=e=>(t,r)=>e.transporter.read({method:o.N.Get,path:(0,s.encode)("2/abtests/%s",t)},r),l=e=>t=>e.transporter.read({method:o.N.Get,path:"2/abtests"},t),u=e=>(t,r)=>e.transporter.write({method:o.N.Post,path:(0,s.encode)("2/abtests/%s/stop",t)},r)},757:(e,t,r)=>{"use strict";function s(e,t,r){const s={"x-algolia-api-key":r,"x-algolia-application-id":t};return{headers:()=>e===u.WithinHeaders?s:{},queryParameters:()=>e===u.WithinQueryParameters?s:{}}}function a(e){let t=0;const r=()=>(t++,new Promise(s=>{setTimeout(()=>{s(e(r))},Math.min(100*t,1e3))}));return e(r)}funcLine truncated
|
||||
return plugin;
|
||||
}
|
||||
};
|
||||
+631
@@ -0,0 +1,631 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable */
|
||||
//prettier-ignore
|
||||
(()=>{var Loe=Object.create,pg=Object.defineProperty,Moe=Object.defineProperties,Toe=Object.getOwnPropertyDescriptor,Ooe=Object.getOwnPropertyDescriptors,Koe=Object.getOwnPropertyNames,gC=Object.getOwnPropertySymbols,Uoe=Object.getPrototypeOf,uw=Object.prototype.hasOwnProperty,IN=Object.prototype.propertyIsEnumerable;var EN=(t,e,r)=>e in t?pg(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e)=>{for(var r in e||(e={}))uw.call(e,r)&&EN(t,r,e[r]);if(gC)for(var r of gC(e))IN.call(e,r)&&EN(t,r,e[r]);return t},V=(t,e)=>Moe(t,Ooe(e)),Hoe=t=>pg(t,"__esModule",{value:!0});var Rr=(t,e)=>{var r={};for(var i in t)uw.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&gC)for(var i of gC(t))e.indexOf(i)<0&&IN.call(t,i)&&(r[i]=t[i]);return r},Yoe=(t,e)=>()=>(t&&(e=t(t=0)),e),C=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),et=(t,e)=>{for(var r in e)pg(t,r,{get:e[r],enumerable:!0})},joe=(t,e,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Koe(e))!uw.call(t,i)&&i!=="default"&&pg(t,i,{get:()=>e[i],enumerable:!(r=Toe(e,i))||r.enumerable});return t},te=t=>joe(Hoe(pg(t!=null?Loe(Uoe(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var XN=C((J8e,JN)=>{JN.exports=WN;WN.sync=iae;var zN=require("fs");function nae(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var i=0;i<r.length;i++){var n=r[i].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}function VN(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:nae(e,r)}function WN(t,e,r){zN.stat(t,function(i,n){r(i,i?!1:VN(n,t,e))})}function iae(t,e){return VN(zN.statSync(t),t,e)}});var tL=C((W8e,ZN)=>{ZN.exports=_N;_N.sync=sae;var $N=require("fs");function _N(t,e,r){$N.stat(t,function(i,n){r(i,i?!1:eL(n,e))})}function sae(t,e){return eL($N.statSync(t),e)}function eL(t,e){return t.isFile()&&oae(t,e)}function oae(t,e){var r=t.mode,i=t.uid,n=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=r&c||r&l&&n===o||r&a&&i===s||r&u&&s===0;return g}});var iL=C((V8e,rL)=>{var z8e=require("fs"),bC;process.platform==="win32"||global.TESTING_WINDOWS?bC=XN():bC=tL();rL.exports=Sw;Sw.sync=aae;function Sw(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){Sw(t,e||{},function(s,o){s?n(s):i(o)})})}bC(t,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),r(i,n)})}function aae(t,e){try{return bC.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var cL=C((X8e,nL)=>{var xl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",sL=require("path"),Aae=xl?";":":",oL=iL(),aL=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),AL=(t,e)=>{let r=e.colon||Aae,i=t.match(/\//)||xl&&t.match(/\\/)?[""]:[...xl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=xl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=xl?n.split(r):[""];return xl&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},lL=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=AL(t,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(aL(t));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=sL.join(h,t),m=!h&&/^\.[\\\/]/.test(t)?t.slice(0,2)+p:p;u(l(m,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];oL(c+p,{pathExt:s},(m,I)=>{if(!m&&I)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return r?a(0).then(c=>r(null,c),r):a(0)},lae=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:i,pathExtExe:n}=AL(t,e),s=[];for(let o=0;o<r.length;o++){let a=r[o],l=/^".*"$/.test(a)?a.slice(1,-1):a,c=sL.join(l,t),u=!l&&/^\.[\\\/]/.test(t)?t.slice(0,2)+c:c;for(let g=0;g<i.length;g++){let f=u+i[g];try{if(oL.sync(f,{pathExt:n}))if(e.all)s.push(f);else return f}catch(h){}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw aL(t)};nL.exports=lL;lL.sync=lae});var gL=C((Z8e,xw)=>{"use strict";var uL=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};xw.exports=uL;xw.exports.default=uL});var dL=C((_8e,fL)=>{"use strict";var hL=require("path"),cae=cL(),uae=gL();function pL(t,e){let r=t.options.env||process.env,i=process.cwd(),n=t.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch(a){}let o;try{o=cae.sync(t.command,{path:r[uae({env:r})],pathExt:e?hL.delimiter:void 0})}catch(a){}finally{s&&process.chdir(i)}return o&&(o=hL.resolve(n?t.options.cwd:"",o)),o}function gae(t){return pL(t)||pL(t,!0)}fL.exports=gae});var CL=C(($8e,kw)=>{"Line truncated
|
||||
`:`
|
||||
`)+r,n=i+1,i=t.indexOf(`
|
||||
`,n)}while(i!==-1);return s+=t.substr(n),s};_L.exports={stringReplaceAll:jae,stringEncaseCRLFWithFirstIndex:Gae}});var nM=C((m4e,eM)=>{"use strict";var qae=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,tM=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,Jae=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Wae=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,zae=new Map([["n",`
|
||||
`],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a","\x07"]]);function rM(t){let e=t[0]==="u",r=t[1]==="{";return e&&!r&&t.length===5||t[0]==="x"&&t.length===3?String.fromCharCode(parseInt(t.slice(1),16)):e&&r?String.fromCodePoint(parseInt(t.slice(2,-1),16)):zae.get(t)||t}function Vae(t,e){let r=[],i=e.trim().split(/\s*,\s*/g),n;for(let s of i){let o=Number(s);if(!Number.isNaN(o))r.push(o);else if(n=s.match(Jae))r.push(n[2].replace(Wae,(a,l,c)=>l?rM(l):c));else throw new Error(`Invalid Chalk template style argument: ${s} (in style '${t}')`)}return r}function Xae(t){tM.lastIndex=0;let e=[],r;for(;(r=tM.exec(t))!==null;){let i=r[1];if(r[2]){let n=Vae(i,r[2]);e.push([i].concat(n))}else e.push([i])}return e}function iM(t,e){let r={};for(let n of e)for(let s of n.styles)r[s[0]]=n.inverse?null:s.slice(1);let i=t;for(let[n,s]of Object.entries(r))if(!!Array.isArray(s)){if(!(n in i))throw new Error(`Unknown Chalk style: ${n}`);i=s.length>0?i[n](...s):i[n]}return i}eM.exports=(t,e)=>{let r=[],i=[],n=[];if(e.replace(qae,(s,o,a,l,c,u)=>{if(o)n.push(rM(o));else if(l){let g=n.join("");n=[],i.push(r.length===0?g:iM(t,r)(g)),r.push({inverse:a,styles:Xae(l)})}else if(c){if(r.length===0)throw new Error("Found extraneous } in Chalk template literal");i.push(iM(t,r)(n.join(""))),n=[],r.pop()}else n.push(u)}),i.push(n.join("")),r.length>0){let s=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw new Error(s)}return i.join("")}});var eQ=C((I4e,sM)=>{"use strict";var Fg=JL(),{stdout:Xw,stderr:Zw}=ZL(),{stringReplaceAll:Zae,stringEncaseCRLFWithFirstIndex:_ae}=$L(),oM=["ansi","ansi","ansi256","ansi16m"],Rl=Object.create(null),$ae=(t,e={})=>{if(e.level>3||e.level<0)throw new Error("The `level` option should be an integer from 0 to 3");let r=Xw?Xw.level:0;t.level=e.level===void 0?r:e.level},aM=class{constructor(e){return AM(e)}},AM=t=>{let e={};return $ae(e,t),e.template=(...r)=>eAe(e.template,...r),Object.setPrototypeOf(e,xC.prototype),Object.setPrototypeOf(e.template,e),e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},e.template.Instance=aM,e.template};function xC(t){return AM(t)}for(let[t,e]of Object.entries(Fg))Rl[t]={get(){let r=kC(this,_w(e.open,e.close,this._styler),this._isEmpty);return Object.defineProperty(this,t,{value:r}),r}};Rl.visible={get(){let t=kC(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:t}),t}};var lM=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let t of lM)Rl[t]={get(){let{level:e}=this;return function(...r){let i=_w(Fg.color[oM[e]][t](...r),Fg.color.close,this._styler);return kC(this,i,this._isEmpty)}}};for(let t of lM){let e="bg"+t[0].toUpperCase()+t.slice(1);Rl[e]={get(){let{level:r}=this;return function(...i){let n=_w(Fg.bgColor[oM[r]][t](...i),Fg.bgColor.close,this._styler);return kC(this,n,this._isEmpty)}}}}var tAe=Object.defineProperties(()=>{},V(v({},Rl),{level:{enumerable:!0,get(){return this._generator.level},set(t){this._generator.level=t}}})),_w=(t,e,r)=>{let i,n;return r===void 0?(i=t,n=e):(i=r.openAll+t,n=e+r.closeAll),{open:t,close:e,openAll:i,closeAll:n,parent:r}},kC=(t,e,r)=>{let i=(...n)=>rAe(i,n.length===1?""+n[0]:n.join(" "));return i.__proto__=tAe,i._generator=t,i._styler=e,i._isEmpty=r,i},rAe=(t,e)=>{if(t.level<=0||!e)return t._isEmpty?"":e;let r=t._styler;if(r===void 0)return e;let{openAll:i,closeAll:n}=r;if(e.indexOf("")!==-1)for(;r!==void 0;)e=Zae(e,r.close,r.open),r=r.parent;let s=e.indexOf(`
|
||||
`);return s!==-1&&(e=_ae(e,n,i,s)),i+e+n},$w,eAe=(t,...e)=>{let[r]=e;if(!Array.isArray(r))return e.join(" ");let i=e.slice(1),n=[r.raw[0]];for(let s=1;s<r.length;s++)n.push(String(i[s-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[s]));return $w===void 0&&($w=nM()),$w(t,n.join(""))};Object.defineProperties(xC.prototype,Rl);var Rg=xC();Rg.supportsColor=Xw;Rg.stderr=xC({level:Zw?Zw.level:0});Rg.stderr.supportsColor=Zw;Rg.Level={None:0,Basic:1,Ansi256:2,TrueColor:3,0:"None",1:"Basic",2:"Ansi256",3:"TrueColor"};sM.exports=Rg});var uM=C((E4e,cM)=>{cM.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY_BUILD_BASE",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}}]});var Ng=C(Ki=>{"use strict";var gM=uM(),Zn=process.env;Object.defineProperty(Ki,"_vendors",{value:gM.map(function(t){return t.constant})});Ki.name=null;Ki.isPR=null;gM.forEach(function(t){var e=Array.isArray(t.env)?t.env:[t.env],r=e.every(function(i){return fM(i)});if(Ki[t.constant]=r,r)switch(Ki.name=t.name,typeof t.pr){case"string":Ki.isPR=!!Zn[t.pr];break;case"object":"env"in t.pr?Ki.isPR=t.pr.env in Zn&&Zn[t.pr.env]!==t.pr.ne:"any"in t.pr?Ki.isPR=t.pr.any.some(function(i){return!!Zn[i]}):Ki.isPR=fM(t.pr);break;default:Ki.isPR=null}});Ki.isCI=!!(Zn.CI||Zn.CONTINUOUS_INTEGRATION||Zn.BUILD_NUMBER||Zn.RUN_ID||Ki.name);function fM(t){return typeof t=="string"?!!Zn[t]:Object.keys(t).every(function(e){return Zn[e]===t[e]})}});var vC=C(an=>{"use strict";an.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;an.find=(t,e)=>t.nodes.find(r=>r.type===e);an.exceedsLimit=(t,e,r=1,i)=>i===!1||!an.isInteger(t)||!an.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=i;an.escapeNode=(t,e=0,r)=>{let i=t.nodes[e];!i||(r&&i.type===r||i.type==="open"||i.type==="close")&&i.escaped!==!0&&(i.value="\\"+i.value,i.escaped=!0)};an.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0==0?(t.invalid=!0,!0):!1;an.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0==0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;an.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;an.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);an.flatten=(...t)=>{let e=[],r=i=>{for(let n=0;n<i.length;n++){let s=i[n];Array.isArray(s)?r(s,e):s!==void 0&&e.push(s)}return e};return r(t),e}});var PC=C((w4e,hM)=>{"use strict";var pM=vC();hM.exports=(t,e={})=>{let r=(i,n={})=>{let s=e.escapeInvalid&&pM.isInvalidBrace(n),o=i.invalid===!0&&e.escapeInvalid===!0,a="";if(i.value)return(s||o)&&pM.isOpenOrClose(i)?"\\"+i.value:i.value;if(i.value)return i.value;if(i.nodes)for(let l of i.nodes)a+=r(l);return a};return r(t)}});var CM=C((Q4e,dM)=>{"use strict";dM.exports=function(t){return typeof t=="number"?t-t==0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var DM=C((b4e,mM)=>{"use strict";var IM=CM(),Va=(t,e,r)=>{if(IM(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a n
Line truncated
|
||||
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var WM=C((v4e,jM)=>{"use strict";var BAe=PC(),{MAX_LENGTH:GM,CHAR_BACKSLASH:sQ,CHAR_BACKTICK:wAe,CHAR_COMMA:QAe,CHAR_DOT:bAe,CHAR_LEFT_PARENTHESES:DAe,CHAR_RIGHT_PARENTHESES:SAe,CHAR_LEFT_CURLY_BRACE:xAe,CHAR_RIGHT_CURLY_BRACE:kAe,CHAR_LEFT_SQUARE_BRACKET:qM,CHAR_RIGHT_SQUARE_BRACKET:JM,CHAR_DOUBLE_QUOTE:vAe,CHAR_SINGLE_QUOTE:PAe,CHAR_NO_BREAK_SPACE:FAe,CHAR_ZERO_WIDTH_NOBREAK_SPACE:RAe}=YM(),NAe=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},i=typeof r.maxLength=="number"?Math.min(GM,r.maxLength):GM;if(t.length>i)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${i})`);let n={type:"root",input:t,nodes:[]},s=[n],o=n,a=n,l=0,c=t.length,u=0,g=0,f,h={},p=()=>t[u++],m=I=>{if(I.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&I.type==="text"){a.value+=I.value;return}return o.nodes.push(I),I.parent=o,I.prev=a,a=I,I};for(m({type:"bos"});u<c;)if(o=s[s.length-1],f=p(),!(f===RAe||f===FAe)){if(f===sQ){m({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===JM){m({type:"text",value:"\\"+f});continue}if(f===qM){l++;let I=!0,y;for(;u<c&&(y=p());){if(f+=y,y===qM){l++;continue}if(y===sQ){f+=p();continue}if(y===JM&&(l--,l===0))break}m({type:"text",value:f});continue}if(f===DAe){o=m({type:"paren",nodes:[]}),s.push(o),m({type:"text",value:f});continue}if(f===SAe){if(o.type!=="paren"){m({type:"text",value:f});continue}o=s.pop(),m({type:"text",value:f}),o=s[s.length-1];continue}if(f===vAe||f===PAe||f===wAe){let I=f,y;for(e.keepQuotes!==!0&&(f="");u<c&&(y=p());){if(y===sQ){f+=y+p();continue}if(y===I){e.keepQuotes===!0&&(f+=y);break}f+=y}m({type:"text",value:f});continue}if(f===xAe){g++;let I=a.value&&a.value.slice(-1)==="$"||o.dollar===!0;o=m({type:"brace",open:!0,close:!1,dollar:I,depth:g,commas:0,ranges:0,nodes:[]}),s.push(o),m({type:"open",value:f});continue}if(f===kAe){if(o.type!=="brace"){m({type:"text",value:f});continue}let I="close";o=s.pop(),o.close=!0,m({type:I,value:f}),g--,o=s[s.length-1];continue}if(f===QAe&&g>0){if(o.ranges>0){o.ranges=0;let I=o.nodes.shift();o.nodes=[I,{type:"text",value:BAe(o)}]}m({type:"comma",value:f}),o.commas++;continue}if(f===bAe&&g>0&&o.commas===0){let I=o.nodes;if(g===0||I.length===0){m({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){I.pop();let y=I[I.length-1];y.value+=a.value+f,a=y,o.ranges--;continue}m({type:"dot",value:f});continue}m({type:"text",value:f})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(B=>{B.nodes||(B.type==="open"&&(B.isOpen=!0),B.type==="close"&&(B.isClose=!0),B.nodes||(B.type="text"),B.invalid=!0)});let I=s[s.length-1],y=I.nodes.indexOf(o);I.nodes.splice(y,1,...o.nodes)}while(s.length>0);return m({type:"eos"}),n};jM.exports=NAe});var XM=C((P4e,zM)=>{"use strict";var VM=PC(),LAe=TM(),MAe=UM(),TAe=WM(),Ui=(t,e={})=>{let r=[];if(Array.isArray(t))for(let i of t){let n=Ui.create(i,e);Array.isArray(n)?r.push(...n):r.push(n)}else r=[].concat(Ui.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Ui.parse=(t,e={})=>TAe(t,e);Ui.stringify=(t,e={})=>typeof t=="string"?VM(Ui.parse(t,e),e):VM(t,e);Ui.compile=(t,e={})=>(typeof t=="string"&&(t=Ui.parse(t,e)),LAe(t,e));Ui.expand=(t,e={})=>{typeof t=="string"&&(t=Ui.parse(t,e));let r=MAe(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Ui.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Ui.compile(t,e):Ui.expand(t,e);zM.exports=Ui});var Mg=C((F4e,ZM)=>{"use strict";var OAe=require("path"),_n="\\\\/",_M=`[^${_n}]`,Os="\\.",KAe="\\+",UAe="\\?",RC="\\/",HAe="(?=.)",$M="[^/]",oQ=`(?:${RC}|$)`,eT=`(?:^|${RC})`,aQ=`${Os}{1,2}${oQ}`,YAe=`(?!${Os})`,jAe=`(?!${eT}${aQ})`,GAe=`(?!${Os}{0,1}${oQ})`,qAe=`(?!${aQ})`,JAe=`[^.${RC}]`,WAe=`${$M}*?`,tT={DOT_LITERAL:Os,PLUS_LITERAL:KAe,QMARK_LITERAL:UAe,SLASH_LITERAL:RC,ONE_CHAR:HAe,QMARK:$M,END_ANCHOR:oQ,DOTS_SLASH:aQ,NO_DOT:YAe,NO_DOTS:jAe,NO_DOT_SLASH:GAe,NO_DOTS_SLASH:qAe,QMARK_NO_DOT:JAe,STAR:WAe,START_ANCHOR:eT},zAe=V(v({},tT),{SLASH_LITERAL:`[${_n}]`,QMARK:_M,STAR:`${_M}*?`,DOTS_SLASH:`${Os}{1,2}(?:[${_n}]|$)`,NO_DOT:`(?!${Os})`,NO_DOTS:`(?!(?:^|[${_n}])${Os}{1,2}(?:[${_n}]|$))`,NO_DOT_SLASH:`(?!${Os}{0,1}(?:[${_n}]|$))`,NO_DOTS_SLASH:`(?!${Os}{1,2}(?:[${_n}]|$))`,QMARK_NO_DOT:`[^.${_n}]`,START_ANCHOR:`(?:^|[${_n}])`,END_ANCHOR:`(?:[${_n}]|$)`}),VAe={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@
Line truncated
|
||||
Please report this to https://github.com/szmarczak/http2-wrapper/`);p(m)}return}i[0].resolve(h);return}}if(o in this.queue){if(a in this.queue[o]){this.queue[o][a].listeners.push(...i),this._tryToCreateNewSession(o,a);return}}else this.queue[o]={};let l=()=>{o in this.queue&&this.queue[o][a]===c&&(delete this.queue[o][a],Object.keys(this.queue[o]).length===0&&delete this.queue[o])},c=()=>{let u=`${a}:${o}`,g=!1;try{let f=hCe.connect(e,v({createConnection:this.createConnection,settings:this.settings,session:this.tlsSessionCache.get(u)},r));f[li]=0,f[oc]=!1;let h=()=>f[li]<f.remoteSettings.maxConcurrentStreams,p=!0;f.socket.once("session",I=>{this.tlsSessionCache.set(u,I)}),f.once("error",I=>{for(let{reject:y}of i)y(I);this.tlsSessionCache.delete(u)}),f.setTimeout(this.timeout,()=>{f.destroy()}),f.once("close",()=>{if(g){p&&this._freeSessionsCount--,this._sessionsCount--;let I=this.sessions[o];I.splice(I.indexOf(f),1),I.length===0&&delete this.sessions[o]}else{let I=new Error("Session closed without receiving a SETTINGS frame");I.code="HTTP2WRAPPER_NOSETTINGS";for(let{reject:y}of i)y(I);l()}this._tryToCreateNewSession(o,a)});let m=()=>{if(!(!(o in this.queue)||!h())){for(let I of f[fn])if(I in this.queue[o]){let{listeners:y}=this.queue[o][I];for(;y.length!==0&&h();)y.shift().resolve(f);let B=this.queue[o];if(B[I].listeners.length===0&&(delete B[I],Object.keys(B).length===0)){delete this.queue[o];break}if(!h())break}}};f.on("origin",()=>{f[fn]=f.originSet,!!h()&&(m(),Kb(this.sessions[o],f))}),f.once("remoteSettings",()=>{if(f.ref(),f.unref(),this._sessionsCount++,c.destroyed){let I=new Error("Agent has been destroyed");for(let y of i)y.reject(I);f.destroy();return}f[fn]=f.originSet;{let I=this.sessions;if(o in I){let y=I[o];y.splice(CCe(y,f,mCe),0,f)}else I[o]=[f]}this._freeSessionsCount+=1,g=!0,this.emit("session",f),m(),l(),f[li]===0&&this._freeSessionsCount>this.maxFreeSessions&&f.close(),i.length!==0&&(this.getSession(a,r,i),i.length=0),f.on("remoteSettings",()=>{m(),Kb(this.sessions[o],f)})}),f[jH]=f.request,f.request=(I,y)=>{if(f[oc])throw new Error("The session is gracefully closing. No new streams are allowed.");let B=f[jH](I,y);return f.ref(),++f[li],f[li]===f.remoteSettings.maxConcurrentStreams&&this._freeSessionsCount--,B.once("close",()=>{if(p=h(),--f[li],!f.destroyed&&!f.closed&&(ICe(this.sessions[o],f),h()&&!f.closed)){p||(this._freeSessionsCount++,p=!0);let x=f[li]===0;x&&f.unref(),x&&(this._freeSessionsCount>this.maxFreeSessions||f[oc])?f.close():(Kb(this.sessions[o],f),m())}}),B}}catch(f){for(let h of i)h.reject(f);l()}};c.listeners=i,c.completed=!1,c.destroyed=!1,this.queue[o][a]=c,this._tryToCreateNewSession(o,a)})}request(e,r,i,n){return new Promise((s,o)=>{this.getSession(e,r,[{reject:o,resolve:a=>{try{s(a.request(i,n))}catch(l){o(l)}}}])})}createConnection(e,r){return Xs.connect(e,r)}static connect(e,r){r.ALPNProtocols=["h2"];let i=e.port||443,n=e.hostname||e.host;return typeof r.servername=="undefined"&&(r.servername=n),fCe.connect(i,n,r)}closeFreeSessions(){for(let e of Object.values(this.sessions))for(let r of e)r[li]===0&&r.close()}destroy(e){for(let r of Object.values(this.sessions))for(let i of r)i.destroy(e);for(let r of Object.values(this.queue))for(let i of Object.values(r))i.destroyed=!0;this.queue={}}get freeSessions(){return qH({agent:this,isFree:!0})}get busySessions(){return qH({agent:this,isFree:!1})}};Xs.kCurrentStreamsCount=li;Xs.kGracefullyClosing=oc;YH.exports={Agent:Xs,globalAgent:new Xs}});var Hb=C((F6e,JH)=>{"use strict";var{Readable:ECe}=require("stream"),WH=class extends ECe{constructor(e,r){super({highWaterMark:r,autoDestroy:!1});this.statusCode=null,this.statusMessage="",this.httpVersion="2.0",this.httpVersionMajor=2,this.httpVersionMinor=0,this.headers={},this.trailers={},this.req=null,this.aborted=!1,this.complete=!1,this.upgrade=null,this.rawHeaders=[],this.rawTrailers=[],this.socket=e,this.connection=e,this._dumped=!1}_destroy(e){this.req._request.destroy(e)}setTimeout(e,r){return this.req.setTimeout(e,r),this}_dump(){this._dumped||(this._dumped=!0,this.removeAllListeners("data"),this.resume())}_read(){this.req&&this.req._request.resume()}};JH.exports=WH});var Yb=C((R6e,zH)=>{"use strict";zH.exports=t=>{let e={protocol:t.protocol,hostname:typeof t.hostname=="string"&&t.hostname.startsWith("[")?t.hostname.slice(1,-1):t.hostname,host:t.host,hash:t.hash,search:t.search,pathname:t.pathname,href:t.href,path:`${t.pathname||""}${t.search||""}`};return typeof t.port=="string"&&t.port.length!==0&&(e.port=Number(t.port)),(t.username||t.password)&&(e.auth=`${t.username||""}:${t.password||""}`),e}});var XH=C((N6e,VH)=>{"use strict";VH.exports=(t,e,r)=>{for(let i of r)t.on(i,(...n)=>e.emit(i,...n))}});var _H=C((L6e,ZH)=>{"use strict";ZH.exports=t=>{switch(t){case":method":case":scheme":case":authority":case":path":return!0;default:return!1}}});var eY=C((T6e,$H)=>{"use strict";var ac=(t,e,r)=>{$H.exports[e]=class extends t{constructor(...n){super(typeof r=="string"?r:r(n)
Line truncated
|
||||
`).reverse(),a=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(`
|
||||
`).reverse();for(;a.length!==0&&a[0]===o[0];)o.shift();this.stack=`${this.stack.slice(0,s)}${o.reverse().join(`
|
||||
`)}${a.reverse().join(`
|
||||
`)}`}}};Et.RequestError=mr;var pD=class extends mr{constructor(e){super(`Redirected ${e.options.maxRedirects} times. Aborting.`,{},e);this.name="MaxRedirectsError"}};Et.MaxRedirectsError=pD;var dD=class extends mr{constructor(e){super(`Response code ${e.statusCode} (${e.statusMessage})`,{},e.request);this.name="HTTPError"}};Et.HTTPError=dD;var CD=class extends mr{constructor(e,r){super(e.message,e,r);this.name="CacheError"}};Et.CacheError=CD;var mD=class extends mr{constructor(e,r){super(e.message,e,r);this.name="UploadError"}};Et.UploadError=mD;var ID=class extends mr{constructor(e,r,i){super(e.message,e,i);this.name="TimeoutError",this.event=e.event,this.timings=r}};Et.TimeoutError=ID;var eI=class extends mr{constructor(e,r){super(e.message,e,r);this.name="ReadError"}};Et.ReadError=eI;var ED=class extends mr{constructor(e){super(`Unsupported protocol "${e.url.protocol}"`,{},e);this.name="UnsupportedProtocolError"}};Et.UnsupportedProtocolError=ED;var xme=["socket","connect","continue","information","upgrade","timeout"],hD=class extends OY.Duplex{constructor(e,r={},i){super({autoDestroy:!1,highWaterMark:0});this[lc]=0,this[uc]=0,this.requestInitialized=!1,this[_m]=new Set,this.redirects=[],this[gc]=!1,this[$m]=!1,this[vf]=[],this.retryCount=0,this._progressCallbacks=[];let n=()=>this._unlockWrite(),s=()=>this._lockWrite();this.on("pipe",c=>{c.prependListener("data",n),c.on("data",s),c.prependListener("end",n),c.on("end",s)}),this.on("unpipe",c=>{c.off("data",n),c.off("data",s),c.off("end",n),c.off("end",s)}),this.on("pipe",c=>{c instanceof uD.IncomingMessage&&(this.options.headers=v(v({},c.headers),this.options.headers))});let{json:o,body:a,form:l}=r;if((o||a||l)&&this._lockWrite(),Et.kIsNormalizedAlready in r)this.options=r;else try{this.options=this.constructor.normalizeArguments(e,r,i)}catch(c){se.default.nodeStream(r.body)&&r.body.destroy(),this.destroy(c);return}(async()=>{var c;try{this.options.body instanceof ome.ReadStream&&await bme(this.options.body);let{url:u}=this.options;if(!u)throw new TypeError("Missing `url` property");if(this.requestUrl=u.toString(),decodeURI(this.requestUrl),await this._finalizeBody(),await this._makeRequest(),this.destroyed){(c=this[Sr])===null||c===void 0||c.destroy();return}for(let g of this[vf])g();this[vf].length=0,this.requestInitialized=!0}catch(u){if(u instanceof mr){this._beforeError(u);return}this.destroyed||this.destroy(u)}})()}static normalizeArguments(e,r,i){var n,s,o,a,l;let c=r;if(se.default.object(e)&&!se.default.urlInstance(e))r=v(v(v({},i),e),r);else{if(e&&r&&r.url!==void 0)throw new TypeError("The `url` option is mutually exclusive with the `input` argument");r=v(v({},i),r),e!==void 0&&(r.url=e),se.default.urlInstance(r.url)&&(r.url=new Wo.URL(r.url.toString()))}if(r.cache===!1&&(r.cache=void 0),r.dnsCache===!1&&(r.dnsCache=void 0),se.assert.any([se.default.string,se.default.undefined],r.method),se.assert.any([se.default.object,se.default.undefined],r.headers),se.assert.any([se.default.string,se.default.urlInstance,se.default.undefined],r.prefixUrl),se.assert.any([se.default.object,se.default.undefined],r.cookieJar),se.assert.any([se.default.object,se.default.string,se.default.undefined],r.searchParams),se.assert.any([se.default.object,se.default.string,se.default.undefined],r.cache),se.assert.any([se.default.object,se.default.number,se.default.undefined],r.timeout),se.assert.any([se.default.object,se.default.undefined],r.context),se.assert.any([se.default.object,se.default.undefined],r.hooks),se.assert.any([se.default.boolean,se.default.undefined],r.decompress),se.assert.any([se.default.boolean,se.default.undefined],r.ignoreInvalidCookies),se.assert.any([se.default.boolean,se.default.undefined],r.followRedirect),se.assert.any([se.default.number,se.default.undefined],r.maxRedirects),se.assert.any([se.default.boolean,se.default.undefined],r.throwHttpErrors),se.assert.any([se.default.boolean,se.default.undefined],r.http2),se.assert.any([se.default.boolean,se.default.undefined],r.allowGetBody),se.assert.any([se.default.string,se.default.undefined],r.localAddress),se.assert.any([GY.isDnsLookupIpVersion,se.default.undefined],r.dnsLookupIpVersion),se.assert.any([se.default.object,se.default.undefined],r.https),se.assert.any([se.default.boolean,se.default.undefined],r.rejectUnauthorized),r.https&&(se.assert.any([se.default.boolean,se.default.undefined],r.https.rejectUnauthorized),se.assert.any([se.default.function_,se.default.undefined],r.https.checkServerIdentity),se.assert.any([se.default.string,se.default.object,se.default.array,se.default.undefined],r.https.certificateAuthority),se.assert.any([se.default.string,se.default.object,se.default.array,se.default.undefined],r.https.key),se.assert.any([se.default.string,se.default.object,se.default.array,se.default.undefined],r.https.certificate),se.assert.any([se.default.string,se.default.undefined],r.https.passphrase),se.assert.any([se.default.string,se.default.buffer,se.default.array,se.default.undefined],r.httLine truncated
|
||||
`,g.message,g.stack);var f=new Error("tunneling socket could not be established, cause="+g.message);f.code="ECONNRESET",e.request.emit("error",f),i.removeSocket(n)}};_s.prototype.removeSocket=function(e){var r=this.sockets.indexOf(e);if(r!==-1){this.sockets.splice(r,1);var i=this.requests.shift();i&&this.createSocket(i,function(n){i.request.onSocket(n)})}};function mj(t,e){var r=this;_s.prototype.createSocket.call(r,t,function(i){var n=t.request.getHeader("host"),s=xD({},r.options,{socket:i,servername:n?n.replace(/:.*$/,""):t.host}),o=eIe.connect(0,s);r.sockets[r.sockets.indexOf(i)]=o,e(o)})}function Ij(t,e,r){return typeof t=="string"?{host:t,port:e,localAddress:r}:t}function xD(t){for(var e=1,r=arguments.length;e<r;++e){var i=arguments[e];if(typeof i=="object")for(var n=Object.keys(i),s=0,o=n.length;s<o;++s){var a=n[s];i[a]!==void 0&&(t[a]=i[a])}}return t}var Zo;process.env.NODE_DEBUG&&/\btunnel\b/.test(process.env.NODE_DEBUG)?Zo=function(){var t=Array.prototype.slice.call(arguments);typeof t[0]=="string"?t[0]="TUNNEL: "+t[0]:t.unshift("TUNNEL:"),console.error.apply(console,t)}:Zo=function(){};fc.debug=Zo});var Bj=C((h7e,yj)=>{yj.exports=Ej()});var sG=C((DVe,RD)=>{var Nj=Object.assign({},require("fs")),ne=typeof ne!="undefined"?ne:{},Nf={},$o;for($o in ne)ne.hasOwnProperty($o)&&(Nf[$o]=ne[$o]);var ND=[],Lj="./this.program",Mj=function(t,e){throw e},Tj=!1,EA=!0,Lf="";function pIe(t){return ne.locateFile?ne.locateFile(t,Lf):Lf+t}var AI,LD,lI,MD;EA&&(Tj?Lf=require("path").dirname(Lf)+"/":Lf=__dirname+"/",AI=function(e,r){var i=Kj(e);return i?r?i:i.toString():(lI||(lI=Nj),MD||(MD=require("path")),e=MD.normalize(e),lI.readFileSync(e,r?null:"utf8"))},LD=function(e){var r=AI(e,!0);return r.buffer||(r=new Uint8Array(r)),Oj(r.buffer),r},process.argv.length>1&&(Lj=process.argv[1].replace(/\\/g,"/")),ND=process.argv.slice(2),typeof RD!="undefined"&&(RD.exports=ne),Mj=function(t){process.exit(t)},ne.inspect=function(){return"[Emscripten Module object]"});var cI=ne.print||console.log.bind(console),Wr=ne.printErr||console.warn.bind(console);for($o in Nf)Nf.hasOwnProperty($o)&&(ne[$o]=Nf[$o]);Nf=null;ne.arguments&&(ND=ne.arguments);ne.thisProgram&&(Lj=ne.thisProgram);ne.quit&&(Mj=ne.quit);var dIe=16;function CIe(t,e){return e||(e=dIe),Math.ceil(t/e)*e}var mIe=0,IIe=function(t){mIe=t},TD;ne.wasmBinary&&(TD=ne.wasmBinary);var x7e=ne.noExitRuntime||!0;typeof WebAssembly!="object"&&gr("no native wasm support detected");function EIe(t,e,r){switch(e=e||"i8",e.charAt(e.length-1)==="*"&&(e="i32"),e){case"i1":return ui[t>>0];case"i8":return ui[t>>0];case"i16":return OD[t>>1];case"i32":return je[t>>2];case"i64":return je[t>>2];case"float":return Uj[t>>2];case"double":return Hj[t>>3];default:gr("invalid type for getValue: "+e)}return null}var uI,Yj=!1,yIe;function Oj(t,e){t||gr("Assertion failed: "+e)}function jj(t){var e=ne["_"+t];return Oj(e,"Cannot call unknown function "+t+", make sure it is exported"),e}function bIe(t,e,r,i,n){var s={string:function(h){var p=0;if(h!=null&&h!==0){var m=(h.length<<2)+1;p=Jj(m),qj(h,p,m)}return p},array:function(h){var p=Jj(h.length);return BIe(h,p),p}};function o(h){return e==="string"?Gj(h):e==="boolean"?Boolean(h):h}var a=jj(t),l=[],c=0;if(i)for(var u=0;u<i.length;u++){var g=s[r[u]];g?(c===0&&(c=wIe()),l[u]=g(i[u])):l[u]=i[u]}var f=a.apply(null,l);return f=o(f),c!==0&&QIe(c),f}function DIe(t,e,r,i){r=r||[];var n=r.every(function(o){return o==="number"}),s=e!=="string";return s&&n&&!i?jj(t):function(){return bIe(t,e,r,arguments,i)}}var Wj=typeof TextDecoder!="undefined"?new TextDecoder("utf8"):void 0;function hc(t,e,r){for(var i=e+r,n=e;t[n]&&!(n>=i);)++n;if(n-e>16&&t.subarray&&Wj)return Wj.decode(t.subarray(e,n));for(var s="";e<n;){var o=t[e++];if(!(o&128)){s+=String.fromCharCode(o);continue}var a=t[e++]&63;if((o&224)==192){s+=String.fromCharCode((o&31)<<6|a);continue}var l=t[e++]&63;if((o&240)==224?o=(o&15)<<12|a<<6|l:o=(o&7)<<18|a<<12|l<<6|t[e++]&63,o<65536)s+=String.fromCharCode(o);else{var c=o-65536;s+=String.fromCharCode(55296|c>>10,56320|c&1023)}}return s}function Gj(t,e){return t?hc(pc,t,e):""}function gI(t,e,r,i){if(!(i>0))return 0;for(var n=r,s=r+i-1,o=0;o<t.length;++o){var a=t.charCodeAt(o);if(a>=55296&&a<=57343){var l=t.charCodeAt(++o);a=65536+((a&1023)<<10)|l&1023}if(a<=127){if(r>=s)break;e[r++]=a}else if(a<=2047){if(r+1>=s)break;e[r++]=192|a>>6,e[r++]=128|a&63}else if(a<=65535){if(r+2>=s)break;e[r++]=224|a>>12,e[r++]=128|a>>6&63,e[r++]=128|a&63}else{if(r+3>=s)break;e[r++]=240|a>>18,e[r++]=128|a>>12&63,e[r++]=128|a>>6&63,e[r++]=128|a&63}}return e[r]=0,r-n}function qj(t,e,r){return gI(t,pc,e,r)}function fI(t){for(var e=0,r=0;r<t.length;++r){var i=t.charCodeAt(r);i>=55296&&i<=57343&&(i=65536+((i&1023)<<10)|t.charCodeAt(++r)&1023),i<=127?++e:i<=2047?e+=2:i<=65535?e+=3:e+=4}return e}function KD(t){var e=fI(t)+1,r=zj(e);return r&&gI(t,ui,r,e),r}function BIe(t,e){ui.set(t,e)}function SIe(t,e){return t%e>0&&(t+=e-t%e),t}var UD,ui,pc,OD,xIe,je,kIe,Uj,Hj;function Vj(t){UD=t,ne.HEAP8=ui=ne
Line truncated
|
||||
`)):typeof readline=="function"&&(e=readline(),e!==null&&(e+=`
|
||||
`));if(!e)return null;t.input=qD(e,!0)}return t.input.shift()},put_char:function(t,e){e===null||e===10?(cI(hc(t.output,0)),t.output=[]):e!=0&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(cI(hc(t.output,0)),t.output=[])}},default_tty1_ops:{put_char:function(t,e){e===null||e===10?(Wr(hc(t.output,0)),t.output=[]):e!=0&&t.output.push(e)},flush:function(t){t.output&&t.output.length>0&&(Wr(hc(t.output,0)),t.output=[])}}};function JD(t){for(var e=CIe(t,65536),r=zj(e);t<e;)ui[r+t++]=0;return r}var ot={ops_table:null,mount:function(t){return ot.createNode(null,"/",16384|511,0)},createNode:function(t,e,r,i){if(E.isBlkdev(r)||E.isFIFO(r))throw new E.ErrnoError(63);ot.ops_table||(ot.ops_table={dir:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr,lookup:ot.node_ops.lookup,mknod:ot.node_ops.mknod,rename:ot.node_ops.rename,unlink:ot.node_ops.unlink,rmdir:ot.node_ops.rmdir,readdir:ot.node_ops.readdir,symlink:ot.node_ops.symlink},stream:{llseek:ot.stream_ops.llseek}},file:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr},stream:{llseek:ot.stream_ops.llseek,read:ot.stream_ops.read,write:ot.stream_ops.write,allocate:ot.stream_ops.allocate,mmap:ot.stream_ops.mmap,msync:ot.stream_ops.msync}},link:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr,readlink:ot.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ot.node_ops.getattr,setattr:ot.node_ops.setattr},stream:E.chrdev_stream_ops}});var n=E.createNode(t,e,r,i);return E.isDir(n.mode)?(n.node_ops=ot.ops_table.dir.node,n.stream_ops=ot.ops_table.dir.stream,n.contents={}):E.isFile(n.mode)?(n.node_ops=ot.ops_table.file.node,n.stream_ops=ot.ops_table.file.stream,n.usedBytes=0,n.contents=null):E.isLink(n.mode)?(n.node_ops=ot.ops_table.link.node,n.stream_ops=ot.ops_table.link.stream):E.isChrdev(n.mode)&&(n.node_ops=ot.ops_table.chrdev.node,n.stream_ops=ot.ops_table.chrdev.stream),n.timestamp=Date.now(),t&&(t.contents[e]=n,t.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(t){return t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0)},expandFileStorage:function(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){var i=1024*1024;e=Math.max(e,r*(r<i?2:1.125)>>>0),r!=0&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage:function(t,e){if(t.usedBytes!=e)if(e==0)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr:function(t){var e={};return e.dev=E.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,E.isDir(t.mode)?e.size=4096:E.isFile(t.mode)?e.size=t.usedBytes:E.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr:function(t,e){e.mode!==void 0&&(t.mode=e.mode),e.timestamp!==void 0&&(t.timestamp=e.timestamp),e.size!==void 0&&ot.resizeFileStorage(t,e.size)},lookup:function(t,e){throw E.genericErrors[44]},mknod:function(t,e,r,i){return ot.createNode(t,e,r,i)},rename:function(t,e,r){if(E.isDir(t.mode)){var i;try{i=E.lookupNode(e,r)}catch(s){}if(i)for(var n in i.contents)throw new E.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink:function(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir:function(t,e){var r=E.lookupNode(t,e);for(var i in r.contents)throw new E.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir:function(t){var e=[".",".."];for(var r in t.contents)!t.contents.hasOwnProperty(r)||e.push(r);return e},symlink:function(t,e,r){var i=ot.createNode(t,e,511|40960,0);return i.link=r,i},readlink:function(t){if(!E.isLink(t.mode))throw new E.ErrnoError(28);return t.link}},stream_ops:{read:function(t,e,r,i,n){var s=t.node.contents;if(n>=t.node.usedBytes)return 0;var o=Math.min(t.node.usedBytes-n,i);if(o>8&&s.subarray)e.set(s.subarray(n,n+o),r);else for(var a=0;a<o;a++)e[r+a]=s[n+a];return o},write:function(t,e,r,i,n,s){if(e.buffer===ui.buffer&&(s=!1),!i)return 0;var o=t.node;if(o.timestamp=Date.now(),e.subarray&&(!o.contents||o.contents.subarray)){if(s)return o.contents=e.subarray(r,r+i),o.usedBytes=i,i;if(o.usedBytes===0&&n===0)return o.contents=e.slice(r,r+i),o.usedBytes=i,i;if(n+i<=o.usedBytes)return o.contents.set(e.subarray(r,r+i),n),i}if(ot.expandFileStorage(o,n+i),o.contents.subarray&&e.subarray)o.contents.set(e.subarray(r,r+i),n);else for(var a=0;a<i;a++)o.contents[n+a]=e[r+a];return o.usedBytes=Math.max(o.usedBytes,n+i),i},llseek:function(t,e,r){var i=e;if(r===1?i+=t.position:r===2&&E.isFile(t.node.mode)&&(i+=t.node.usedBytes),i<0)throw new E.ErrnoError(28);return i},allocate:function(t,e,r){ot.expandFileStorage(t.node,e+r),t.node.usedByt
Line truncated
|
||||
\x85\u2028\u2029`.indexOf(this.buffer.charAt(n-1))===-1;)if(n-=1,this.position-n>r/2-1){i=" ... ",n+=5;break}for(s="",o=this.position;o<this.buffer.length&&`\0\r
|
||||
\x85\u2028\u2029`.indexOf(this.buffer.charAt(o))===-1;)if(o+=1,o-this.position>r/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),dG.repeat(" ",e)+i+a+s+`
|
||||
`+dG.repeat(" ",e+this.position-n+i.length)+"^"};iS.prototype.toString=function(e){var r,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(r=this.getSnippet(),r&&(i+=`:
|
||||
`+r)),i};pG.exports=iS});var Ir=C((zVe,mG)=>{"use strict";var IG=Ec(),bEe=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],DEe=["scalar","sequence","mapping"];function SEe(t){var e={};return t!==null&&Object.keys(t).forEach(function(r){t[r].forEach(function(i){e[String(i)]=r})}),e}function xEe(t,e){if(e=e||{},Object.keys(e).forEach(function(r){if(bEe.indexOf(r)===-1)throw new IG('Unknown option "'+r+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(r){return r},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=SEe(e.styleAliases||null),DEe.indexOf(this.kind)===-1)throw new IG('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}mG.exports=xEe});var SA=C((VVe,EG)=>{"use strict";var yG=DA(),bI=Ec(),kEe=Ir();function nS(t,e,r){var i=[];return t.include.forEach(function(n){r=nS(n,e,r)}),t[e].forEach(function(n){r.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&i.push(o)}),r.push(n)}),r.filter(function(n,s){return i.indexOf(s)===-1})}function vEe(){var t={scalar:{},sequence:{},mapping:{},fallback:{}},e,r;function i(n){t[n.kind][n.tag]=t.fallback[n.tag]=n}for(e=0,r=arguments.length;e<r;e+=1)arguments[e].forEach(i);return t}function yc(t){this.include=t.include||[],this.implicit=t.implicit||[],this.explicit=t.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&e.loadKind!=="scalar")throw new bI("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=nS(this,"implicit",[]),this.compiledExplicit=nS(this,"explicit",[]),this.compiledTypeMap=vEe(this.compiledImplicit,this.compiledExplicit)}yc.DEFAULT=null;yc.create=function(){var e,r;switch(arguments.length){case 1:e=yc.DEFAULT,r=arguments[0];break;case 2:e=arguments[0],r=arguments[1];break;default:throw new bI("Wrong number of arguments for Schema.create function")}if(e=yG.toArray(e),r=yG.toArray(r),!e.every(function(i){return i instanceof yc}))throw new bI("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!r.every(function(i){return i instanceof kEe}))throw new bI("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new yc({include:e,explicit:r})};EG.exports=yc});var wG=C((XVe,BG)=>{"use strict";var PEe=Ir();BG.exports=new PEe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return t!==null?t:""}})});var bG=C((ZVe,QG)=>{"use strict";var FEe=Ir();QG.exports=new FEe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return t!==null?t:[]}})});var SG=C((_Ve,DG)=>{"use strict";var REe=Ir();DG.exports=new REe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return t!==null?t:{}}})});var DI=C(($Ve,xG)=>{"use strict";var NEe=SA();xG.exports=new NEe({explicit:[wG(),bG(),SG()]})});var vG=C((eXe,kG)=>{"use strict";var LEe=Ir();function MEe(t){if(t===null)return!0;var e=t.length;return e===1&&t==="~"||e===4&&(t==="null"||t==="Null"||t==="NULL")}function TEe(){return null}function OEe(t){return t===null}kG.exports=new LEe("tag:yaml.org,2002:null",{kind:"scalar",resolve:MEe,construct:TEe,predicate:OEe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var FG=C((tXe,PG)=>{"use strict";var KEe=Ir();function UEe(t){if(t===null)return!1;var e=t.length;return e===4&&(t==="true"||t==="True"||t==="TRUE")||e===5&&(t==="false"||t==="False"||t==="FALSE")}function HEe(t){return t==="true"||t==="True"||t==="TRUE"}function YEe(t){return Object.prototype.toString.call(t)==="[object Boolean]"}PG.exports=new KEe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:UEe,construct:HEe,predicate:YEe,represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"})});var NG=C((rXe,RG)=>{"use strict";var jEe=DA(),GEe=Ir();function qEe(t){return 48<=t&&t<=57||65<=t&&t<=70||97<=t&&t<=102}function JEe(t){return 48<=t&&t<=55}function WEe(t){return 48<=t&&t<=57}function zEe(t){if(t===null)return!1;var e=t.length,r=0,i=!1,n;if(!e)return!1;if(n=t[r],(n==="-"||n==="+")&&(n=t[++r]),n==="0"){if(r+1===e)return!0;if(n=t[++r],n==="b"){for(r++;r<e;r++)if(n=t[r],n!=="_"){if(n!=="0"&&n!=="1")return!1;i=!0}return i&&n!=="_"}if(n==="x"){for(r++;r<e;r++)if(n=t[r],n!=="_"){if(!qEe(t.charCodeAt(r)))return!1;i=!0}return i&&n!=="_"}for(;r<e;r++)if(n=t[r],n!=="_"){if(!JEe(t.charCodeAt(r)))return!1;i=!0}return i&&n!=="_"}if(n==="_")return!1;for(;r<e;r++)if(n=t[r],n!=="_"){if(n===":")break;if(!WEe(t.charCodeAt(r)))return!1;i=!0}return!i||n==="_"?!1:n!==":"?!0:/^(:[0-5]?[0-9])+$/.test(t.slice(r))
Line truncated
|
||||
\r`;function fye(t){if(t===null)return!1;var e,r,i=0,n=t.length,s=aS;for(r=0;r<n;r++)if(e=s.indexOf(t.charAt(r)),!(e>64)){if(e<0)return!1;i+=6}return i%8==0}function hye(t){var e,r,i=t.replace(/[\r\n=]/g,""),n=i.length,s=aS,o=0,a=[];for(e=0;e<n;e++)e%4==0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(i.charAt(e));return r=n%4*6,r===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):r===18?(a.push(o>>10&255),a.push(o>>2&255)):r===12&&a.push(o>>4&255),xA?xA.from?xA.from(a):new xA(a):a}function pye(t){var e="",r=0,i,n,s=t.length,o=aS;for(i=0;i<s;i++)i%3==0&&i&&(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]),r=(r<<8)+t[i];return n=s%3,n===0?(e+=o[r>>18&63],e+=o[r>>12&63],e+=o[r>>6&63],e+=o[r&63]):n===2?(e+=o[r>>10&63],e+=o[r>>4&63],e+=o[r<<2&63],e+=o[64]):n===1&&(e+=o[r>>2&63],e+=o[r<<4&63],e+=o[64],e+=o[64]),e}function dye(t){return xA&&xA.isBuffer(t)}JG.exports=new gye("tag:yaml.org,2002:binary",{kind:"scalar",resolve:fye,construct:hye,predicate:dye,represent:pye})});var XG=C((lXe,VG)=>{"use strict";var Cye=Ir(),mye=Object.prototype.hasOwnProperty,Iye=Object.prototype.toString;function Eye(t){if(t===null)return!0;var e=[],r,i,n,s,o,a=t;for(r=0,i=a.length;r<i;r+=1){if(n=a[r],o=!1,Iye.call(n)!=="[object Object]")return!1;for(s in n)if(mye.call(n,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}function yye(t){return t!==null?t:[]}VG.exports=new Cye("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Eye,construct:yye})});var _G=C((cXe,ZG)=>{"use strict";var Bye=Ir(),wye=Object.prototype.toString;function Qye(t){if(t===null)return!0;var e,r,i,n,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1){if(i=o[e],wye.call(i)!=="[object Object]"||(n=Object.keys(i),n.length!==1))return!1;s[e]=[n[0],i[n[0]]]}return!0}function bye(t){if(t===null)return[];var e,r,i,n,s,o=t;for(s=new Array(o.length),e=0,r=o.length;e<r;e+=1)i=o[e],n=Object.keys(i),s[e]=[n[0],i[n[0]]];return s}ZG.exports=new Bye("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Qye,construct:bye})});var eq=C((uXe,$G)=>{"use strict";var Dye=Ir(),Sye=Object.prototype.hasOwnProperty;function xye(t){if(t===null)return!0;var e,r=t;for(e in r)if(Sye.call(r,e)&&r[e]!==null)return!1;return!0}function kye(t){return t!==null?t:{}}$G.exports=new Dye("tag:yaml.org,2002:set",{kind:"mapping",resolve:xye,construct:kye})});var Bc=C((gXe,tq)=>{"use strict";var vye=SA();tq.exports=new vye({include:[oS()],implicit:[jG(),qG()],explicit:[zG(),XG(),_G(),eq()]})});var iq=C((fXe,rq)=>{"use strict";var Pye=Ir();function Fye(){return!0}function Rye(){}function Nye(){return""}function Lye(t){return typeof t=="undefined"}rq.exports=new Pye("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:Fye,construct:Rye,predicate:Lye,represent:Nye})});var sq=C((hXe,nq)=>{"use strict";var Mye=Ir();function Tye(t){if(t===null||t.length===0)return!1;var e=t,r=/\/([gim]*)$/.exec(t),i="";return!(e[0]==="/"&&(r&&(i=r[1]),i.length>3||e[e.length-i.length-1]!=="/"))}function Oye(t){var e=t,r=/\/([gim]*)$/.exec(t),i="";return e[0]==="/"&&(r&&(i=r[1]),e=e.slice(1,e.length-i.length-1)),new RegExp(e,i)}function Kye(t){var e="/"+t.source+"/";return t.global&&(e+="g"),t.multiline&&(e+="m"),t.ignoreCase&&(e+="i"),e}function Uye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}nq.exports=new Mye("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:Tye,construct:Oye,predicate:Uye,represent:Kye})});var Aq=C((pXe,oq)=>{"use strict";var SI;try{aq=require,SI=aq("esprima")}catch(t){typeof window!="undefined"&&(SI=window.esprima)}var aq,Hye=Ir();function Yye(t){if(t===null)return!1;try{var e="("+t+")",r=SI.parse(e,{range:!0});return!(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")}catch(i){return!1}}function jye(t){var e="("+t+")",r=SI.parse(e,{range:!0}),i=[],n;if(r.type!=="Program"||r.body.length!==1||r.body[0].type!=="ExpressionStatement"||r.body[0].expression.type!=="ArrowFunctionExpression"&&r.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return r.body[0].expression.params.forEach(function(s){i.push(s.name)}),n=r.body[0].expression.body.range,r.body[0].expression.body.type==="BlockStatement"?new Function(i,e.slice(n[0]+1,n[1]-1)):new Function(i,"return "+e.slice(n[0],n[1]))}function Gye(t){return t.toString()}function qye(t){return Object.prototype.toString.call(t)==="[object Function]"}oq.exports=new Hye("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:Yye,construct:jye,predicate:qye,represent:Gye})});var Hf=C((dXe,lq)=>{"use strict";var cq=SA();lq.exports=cq.DEFAULT=new cq({include:[Bc()],explicit:[iq(),sq(),Aq()]})});var kq=C((CXe,Yf)=>{"use strict";var to=DA(),uq=Ec(),Jye=CG(),gq=Bc(),Wye=Hf(),ta=Object.prototype.hasOwnProperty,xI=1,fq=2,hq=3,kI=4,AS=1,zye=2,pq=3,Vye=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFF
Line truncated
|
||||
`:t===118?"\v":t===102?"\f":t===114?"\r":t===101?"":t===32?" ":t===34?'"':t===47?"/":t===92?"\\":t===78?"\x85":t===95?"\xA0":t===76?"\u2028":t===80?"\u2029":""}function tBe(t){return t<=65535?String.fromCharCode(t):String.fromCharCode((t-65536>>10)+55296,(t-65536&1023)+56320)}var Eq=new Array(256),yq=new Array(256);for(var Qc=0;Qc<256;Qc++)Eq[Qc]=Iq(Qc)?1:0,yq[Qc]=Iq(Qc);function rBe(t,e){this.input=t,this.filename=e.filename||null,this.schema=e.schema||Wye,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function Bq(t,e){return new uq(e,new Jye(t.filename,t.input,t.position,t.line,t.position-t.lineStart))}function $e(t,e){throw Bq(t,e)}function vI(t,e){t.onWarning&&t.onWarning.call(null,Bq(t,e))}var wq={YAML:function(e,r,i){var n,s,o;e.version!==null&&$e(e,"duplication of %YAML directive"),i.length!==1&&$e(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&$e(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),o=parseInt(n[2],10),s!==1&&$e(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&vI(e,"unsupported YAML version of the document")},TAG:function(e,r,i){var n,s;i.length!==2&&$e(e,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],dq.test(n)||$e(e,"ill-formed tag handle (first argument) of the TAG directive"),ta.call(e.tagMap,n)&&$e(e,'there is a previously declared suffix for "'+n+'" tag handle'),Cq.test(s)||$e(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=s}};function ra(t,e,r,i){var n,s,o,a;if(e<r){if(a=t.input.slice(e,r),i)for(n=0,s=a.length;n<s;n+=1)o=a.charCodeAt(n),o===9||32<=o&&o<=1114111||$e(t,"expected valid JSON character");else Vye.test(a)&&$e(t,"the stream contains non-printable characters");t.result+=a}}function Qq(t,e,r,i){var n,s,o,a;for(to.isObject(r)||$e(t,"cannot merge mappings; the provided source object is unacceptable"),n=Object.keys(r),o=0,a=n.length;o<a;o+=1)s=n[o],ta.call(e,s)||(e[s]=r[s],i[s]=!0)}function bc(t,e,r,i,n,s,o,a){var l,c;if(Array.isArray(n))for(n=Array.prototype.slice.call(n),l=0,c=n.length;l<c;l+=1)Array.isArray(n[l])&&$e(t,"nested arrays are not supported inside keys"),typeof n=="object"&&mq(n[l])==="[object Object]"&&(n[l]="[object Object]");if(typeof n=="object"&&mq(n)==="[object Object]"&&(n="[object Object]"),n=String(n),e===null&&(e={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(l=0,c=s.length;l<c;l+=1)Qq(t,e,s[l],r);else Qq(t,e,s,r);else!t.json&&!ta.call(r,n)&&ta.call(e,n)&&(t.line=o||t.line,t.position=a||t.position,$e(t,"duplicated mapping key")),e[n]=s,delete r[n];return e}function lS(t){var e;e=t.input.charCodeAt(t.position),e===10?t.position++:e===13?(t.position++,t.input.charCodeAt(t.position)===10&&t.position++):$e(t,"a line break is expected"),t.line+=1,t.lineStart=t.position}function fr(t,e,r){for(var i=0,n=t.input.charCodeAt(t.position);n!==0;){for(;kA(n);)n=t.input.charCodeAt(++t.position);if(e&&n===35)do n=t.input.charCodeAt(++t.position);while(n!==10&&n!==13&&n!==0);if(as(n))for(lS(t),n=t.input.charCodeAt(t.position),i++,t.lineIndent=0;n===32;)t.lineIndent++,n=t.input.charCodeAt(++t.position);else break}return r!==-1&&i!==0&&t.lineIndent<r&&vI(t,"deficient indentation"),i}function PI(t){var e=t.position,r;return r=t.input.charCodeAt(e),!!((r===45||r===46)&&r===t.input.charCodeAt(e+1)&&r===t.input.charCodeAt(e+2)&&(e+=3,r=t.input.charCodeAt(e),r===0||ki(r)))}function cS(t,e){e===1?t.result+=" ":e>1&&(t.result+=to.repeat(`
|
||||
`,e-1))}function iBe(t,e,r){var i,n,s,o,a,l,c,u,g=t.kind,f=t.result,h;if(h=t.input.charCodeAt(t.position),ki(h)||wc(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(n=t.input.charCodeAt(t.position+1),ki(n)||r&&wc(n)))return!1;for(t.kind="scalar",t.result="",s=o=t.position,a=!1;h!==0;){if(h===58){if(n=t.input.charCodeAt(t.position+1),ki(n)||r&&wc(n))break}else if(h===35){if(i=t.input.charCodeAt(t.position-1),ki(i))break}else{if(t.position===t.lineStart&&PI(t)||r&&wc(h))break;if(as(h))if(l=t.line,c=t.lineStart,u=t.lineIndent,fr(t,!1,-1),t.lineIndent>=e){a=!0,h=t.input.charCodeAt(t.position);continue}else{t.position=o,t.line=l,t.lineStart=c,t.lineIndent=u;break}}a&&(ra(t,s,o,!1),cS(t,t.line-l),s=o=t.position,a=!1),kA(h)||(o=t.position+1),h=t.input.charCodeAt(++t.position)}return ra(t,s,o,!1),t.result?!0:(t.kind=g,t.result=f,!1)}function nBe(t,e){var r,i,n;if(r=t.input.charCodeAt(t.position),r!==39)return!1;for(t.kind="scalar",t.result="",t.position++,i=n=t.position;(r=t.input.charCodeAt(t.position))!==0;)if(r===39)if(ra(t,i,t.position,!0),r=t.input.charCodeAt(++t.position),r===39)i=t.position,t.position++,n=t.position;else return!0;else as(r)?(ra(t,i,n,!0),cS(t,fr(t,!1,e)),i=n=t.position):t.position===t.lineStart&&PI(t)?$e(t,"unexpected end of the document within a single quoted scalar"):(t.position++,n=t.position);$e(t,"unexpected end of the stream within a single quoted scalar")}function sBe(t,e){var r,i,n,s,o,a;if(a=t.input.charCodeAt(t.position),a!==34)return!1;for(t.kind="scalar",t.result="",t.position++,r=i=t.position;(a=t.input.charCodeAt(t.position))!==0;){if(a===34)return ra(t,r,t.position,!0),t.position++,!0;if(a===92){if(ra(t,r,t.position,!0),a=t.input.charCodeAt(++t.position),as(a))fr(t,!1,e);else if(a<256&&Eq[a])t.result+=yq[a],t.position++;else if((o=$ye(a))>0){for(n=o,s=0;n>0;n--)a=t.input.charCodeAt(++t.position),(o=_ye(a))>=0?s=(s<<4)+o:$e(t,"expected hexadecimal character");t.result+=tBe(s),t.position++}else $e(t,"unknown escape sequence");r=i=t.position}else as(a)?(ra(t,r,i,!0),cS(t,fr(t,!1,e)),r=i=t.position):t.position===t.lineStart&&PI(t)?$e(t,"unexpected end of the document within a double quoted scalar"):(t.position++,i=t.position)}$e(t,"unexpected end of the stream within a double quoted scalar")}function oBe(t,e){var r=!0,i,n=t.tag,s,o=t.anchor,a,l,c,u,g,f={},h,p,m,I;if(I=t.input.charCodeAt(t.position),I===91)l=93,g=!1,s=[];else if(I===123)l=125,g=!0,s={};else return!1;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),I=t.input.charCodeAt(++t.position);I!==0;){if(fr(t,!0,e),I=t.input.charCodeAt(t.position),I===l)return t.position++,t.tag=n,t.anchor=o,t.kind=g?"mapping":"sequence",t.result=s,!0;r||$e(t,"missed comma between flow collection entries"),p=h=m=null,c=u=!1,I===63&&(a=t.input.charCodeAt(t.position+1),ki(a)&&(c=u=!0,t.position++,fr(t,!0,e))),i=t.line,Dc(t,e,xI,!1,!0),p=t.tag,h=t.result,fr(t,!0,e),I=t.input.charCodeAt(t.position),(u||t.line===i)&&I===58&&(c=!0,I=t.input.charCodeAt(++t.position),fr(t,!0,e),Dc(t,e,xI,!1,!0),m=t.result),g?bc(t,s,f,p,h,m):c?s.push(bc(t,null,f,p,h,m)):s.push(h),fr(t,!0,e),I=t.input.charCodeAt(t.position),I===44?(r=!0,I=t.input.charCodeAt(++t.position)):r=!1}$e(t,"unexpected end of the stream within a flow collection")}function aBe(t,e){var r,i,n=AS,s=!1,o=!1,a=e,l=0,c=!1,u,g;if(g=t.input.charCodeAt(t.position),g===124)i=!1;else if(g===62)i=!0;else return!1;for(t.kind="scalar",t.result="";g!==0;)if(g=t.input.charCodeAt(++t.position),g===43||g===45)AS===n?n=g===43?pq:zye:$e(t,"repeat of a chomping mode identifier");else if((u=eBe(g))>=0)u===0?$e(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?$e(t,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(kA(g)){do g=t.input.charCodeAt(++t.position);while(kA(g));if(g===35)do g=t.input.charCodeAt(++t.position);while(!as(g)&&g!==0)}for(;g!==0;){for(lS(t),t.lineIndent=0,g=t.input.charCodeAt(t.position);(!o||t.lineIndent<a)&&g===32;)t.lineIndent++,g=t.input.charCodeAt(++t.position);if(!o&&t.lineIndent>a&&(a=t.lineIndent),as(g)){l++;continue}if(t.lineIndent<a){n===pq?t.result+=to.repeat(`
|
||||
`,s?1+l:l):n===AS&&s&&(t.result+=`
|
||||
`);break}for(i?kA(g)?(c=!0,t.result+=to.repeat(`
|
||||
`,s?1+l:l)):c?(c=!1,t.result+=to.repeat(`
|
||||
`,l+1)):l===0?s&&(t.result+=" "):t.result+=to.repeat(`
|
||||
`,l):t.result+=to.repeat(`
|
||||
`,s?1+l:l),s=!0,o=!0,l=0,r=t.position;!as(g)&&g!==0;)g=t.input.charCodeAt(++t.position);ra(t,r,t.position,!1)}return!0}function bq(t,e){var r,i=t.tag,n=t.anchor,s=[],o,a=!1,l;for(t.anchor!==null&&(t.anchorMap[t.anchor]=s),l=t.input.charCodeAt(t.position);l!==0&&!(l!==45||(o=t.input.charCodeAt(t.position+1),!ki(o)));){if(a=!0,t.position++,fr(t,!0,-1)&&t.lineIndent<=e){s.push(null),l=t.input.charCodeAt(t.position);continue}if(r=t.line,Dc(t,e,hq,!1,!0),s.push(t.result),fr(t,!0,-1),l=t.input.charCodeAt(t.position),(t.line===r||t.lineIndent>e)&&l!==0)$e(t,"bad indentation of a sequence entry");else if(t.lineIndent<e)break}return a?(t.tag=i,t.anchor=n,t.kind="sequence",t.result=s,!0):!1}function ABe(t,e,r){var i,n,s,o,a=t.tag,l=t.anchor,c={},u={},g=null,f=null,h=null,p=!1,m=!1,I;for(t.anchor!==null&&(t.anchorMap[t.anchor]=c),I=t.input.charCodeAt(t.position);I!==0;){if(i=t.input.charCodeAt(t.position+1),s=t.line,o=t.position,(I===63||I===58)&&ki(i))I===63?(p&&(bc(t,c,u,g,f,null),g=f=h=null),m=!0,p=!0,n=!0):p?(p=!1,n=!0):$e(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,I=i;else if(Dc(t,r,fq,!1,!0))if(t.line===s){for(I=t.input.charCodeAt(t.position);kA(I);)I=t.input.charCodeAt(++t.position);if(I===58)I=t.input.charCodeAt(++t.position),ki(I)||$e(t,"a whitespace character is expected after the key-value separator within a block mapping"),p&&(bc(t,c,u,g,f,null),g=f=h=null),m=!0,p=!1,n=!1,g=t.tag,f=t.result;else if(m)$e(t,"can not read an implicit mapping pair; a colon is missed");else return t.tag=a,t.anchor=l,!0}else if(m)$e(t,"can not read a block mapping entry; a multiline key may not be an implicit key");else return t.tag=a,t.anchor=l,!0;else break;if((t.line===s||t.lineIndent>e)&&(Dc(t,e,kI,!0,n)&&(p?f=t.result:h=t.result),p||(bc(t,c,u,g,f,h,s,o),g=f=h=null),fr(t,!0,-1),I=t.input.charCodeAt(t.position)),t.lineIndent>e&&I!==0)$e(t,"bad indentation of a mapping entry");else if(t.lineIndent<e)break}return p&&bc(t,c,u,g,f,null),m&&(t.tag=a,t.anchor=l,t.kind="mapping",t.result=c),m}function lBe(t){var e,r=!1,i=!1,n,s,o;if(o=t.input.charCodeAt(t.position),o!==33)return!1;if(t.tag!==null&&$e(t,"duplication of a tag property"),o=t.input.charCodeAt(++t.position),o===60?(r=!0,o=t.input.charCodeAt(++t.position)):o===33?(i=!0,n="!!",o=t.input.charCodeAt(++t.position)):n="!",e=t.position,r){do o=t.input.charCodeAt(++t.position);while(o!==0&&o!==62);t.position<t.length?(s=t.input.slice(e,t.position),o=t.input.charCodeAt(++t.position)):$e(t,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!ki(o);)o===33&&(i?$e(t,"tag suffix cannot contain exclamation marks"):(n=t.input.slice(e-1,t.position+1),dq.test(n)||$e(t,"named tag handle cannot contain such characters"),i=!0,e=t.position+1)),o=t.input.charCodeAt(++t.position);s=t.input.slice(e,t.position),Zye.test(s)&&$e(t,"tag suffix cannot contain flow indicator characters")}return s&&!Cq.test(s)&&$e(t,"tag name cannot contain such characters: "+s),r?t.tag=s:ta.call(t.tagMap,n)?t.tag=t.tagMap[n]+s:n==="!"?t.tag="!"+s:n==="!!"?t.tag="tag:yaml.org,2002:"+s:$e(t,'undeclared tag handle "'+n+'"'),!0}function cBe(t){var e,r;if(r=t.input.charCodeAt(t.position),r!==38)return!1;for(t.anchor!==null&&$e(t,"duplication of an anchor property"),r=t.input.charCodeAt(++t.position),e=t.position;r!==0&&!ki(r)&&!wc(r);)r=t.input.charCodeAt(++t.position);return t.position===e&&$e(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(e,t.position),!0}function uBe(t){var e,r,i;if(i=t.input.charCodeAt(t.position),i!==42)return!1;for(i=t.input.charCodeAt(++t.position),e=t.position;i!==0&&!ki(i)&&!wc(i);)i=t.input.charCodeAt(++t.position);return t.position===e&&$e(t,"name of an alias node must contain at least one character"),r=t.input.slice(e,t.position),ta.call(t.anchorMap,r)||$e(t,'unidentified alias "'+r+'"'),t.result=t.anchorMap[r],fr(t,!0,-1),!0}function Dc(t,e,r,i,n){var s,o,a,l=1,c=!1,u=!1,g,f,h,p,m;if(t.listener!==null&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,s=o=a=kI===r||hq===r,i&&fr(t,!0,-1)&&(c=!0,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)),l===1)for(;lBe(t)||cBe(t);)fr(t,!0,-1)?(c=!0,a=s,t.lineIndent>e?l=1:t.lineIndent===e?l=0:t.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||n),(l===1||kI===r)&&(xI===r||fq===r?p=e:p=e+1,m=t.position-t.lineStart,l===1?a&&(bq(t,m)||ABe(t,m,p))||oBe(t,p)?u=!0:(o&&aBe(t,p)||nBe(t,p)||sBe(t,p)?u=!0:uBe(t)?(u=!0,(t.tag!==null||t.anchor!==null)&&$e(t,"alias node should not have any properties")):iBe(t,p,xI===r)&&(u=!0,t.tag===null&&(t.tag="?")),t.anchor!==null&&(t.anchorMap[t.anchor]=t.result)):l===0&&(u=a&&bq(t,m))),t.tag!==null&&t.tag!=="!")if(t.tag==="?"){for(t.result!==null&&t.kind!=="scalar"&&$e(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),g=0,f=t.implicitTypes.length;g<f;g+=1)if(h=t.implicitTypes[g],h.resolve(t.result)){t.result=h.construct(t.result),t.tag=h.tag
Line truncated
|
||||
`),t.charCodeAt(0)===65279&&(t=t.slice(1)));var r=new rBe(t,e),i=t.indexOf("\0");for(i!==-1&&(r.position=i,$e(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)gBe(r);return r.documents}function Sq(t,e,r){e!==null&&typeof e=="object"&&typeof r=="undefined"&&(r=e,e=null);var i=Dq(t,r);if(typeof e!="function")return i;for(var n=0,s=i.length;n<s;n+=1)e(i[n])}function xq(t,e){var r=Dq(t,e);if(r.length!==0){if(r.length===1)return r[0];throw new uq("expected a single document in the stream, but found more")}}function fBe(t,e,r){return typeof e=="object"&&e!==null&&typeof r=="undefined"&&(r=e,e=null),Sq(t,e,to.extend({schema:gq},r))}function hBe(t,e){return xq(t,to.extend({schema:gq},e))}Yf.exports.loadAll=Sq;Yf.exports.load=xq;Yf.exports.safeLoadAll=fBe;Yf.exports.safeLoad=hBe});var _q=C((mXe,uS)=>{"use strict";var jf=DA(),Gf=Ec(),pBe=Hf(),dBe=Bc(),vq=Object.prototype.toString,Pq=Object.prototype.hasOwnProperty,CBe=9,qf=10,mBe=13,IBe=32,EBe=33,yBe=34,Fq=35,BBe=37,wBe=38,QBe=39,bBe=42,Rq=44,DBe=45,Nq=58,SBe=61,xBe=62,kBe=63,vBe=64,Lq=91,Mq=93,PBe=96,Tq=123,FBe=124,Oq=125,zr={};zr[0]="\\0";zr[7]="\\a";zr[8]="\\b";zr[9]="\\t";zr[10]="\\n";zr[11]="\\v";zr[12]="\\f";zr[13]="\\r";zr[27]="\\e";zr[34]='\\"';zr[92]="\\\\";zr[133]="\\N";zr[160]="\\_";zr[8232]="\\L";zr[8233]="\\P";var RBe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function NBe(t,e){var r,i,n,s,o,a,l;if(e===null)return{};for(r={},i=Object.keys(e),n=0,s=i.length;n<s;n+=1)o=i[n],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=t.compiledTypeMap.fallback[o],l&&Pq.call(l.styleAliases,a)&&(a=l.styleAliases[a]),r[o]=a;return r}function Kq(t){var e,r,i;if(e=t.toString(16).toUpperCase(),t<=255)r="x",i=2;else if(t<=65535)r="u",i=4;else if(t<=4294967295)r="U",i=8;else throw new Gf("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+jf.repeat("0",i-e.length)+e}function LBe(t){this.schema=t.schema||pBe,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=jf.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=NBe(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Uq(t,e){for(var r=jf.repeat(" ",e),i=0,n=-1,s="",o,a=t.length;i<a;)n=t.indexOf(`
|
||||
`,i),n===-1?(o=t.slice(i),i=a):(o=t.slice(i,n+1),i=n+1),o.length&&o!==`
|
||||
`&&(s+=r),s+=o;return s}function gS(t,e){return`
|
||||
`+jf.repeat(" ",t.indent*e)}function MBe(t,e){var r,i,n;for(r=0,i=t.implicitTypes.length;r<i;r+=1)if(n=t.implicitTypes[r],n.resolve(e))return!0;return!1}function fS(t){return t===IBe||t===CBe}function Sc(t){return 32<=t&&t<=126||161<=t&&t<=55295&&t!==8232&&t!==8233||57344<=t&&t<=65533&&t!==65279||65536<=t&&t<=1114111}function TBe(t){return Sc(t)&&!fS(t)&&t!==65279&&t!==mBe&&t!==qf}function Hq(t,e){return Sc(t)&&t!==65279&&t!==Rq&&t!==Lq&&t!==Mq&&t!==Tq&&t!==Oq&&t!==Nq&&(t!==Fq||e&&TBe(e))}function OBe(t){return Sc(t)&&t!==65279&&!fS(t)&&t!==DBe&&t!==kBe&&t!==Nq&&t!==Rq&&t!==Lq&&t!==Mq&&t!==Tq&&t!==Oq&&t!==Fq&&t!==wBe&&t!==bBe&&t!==EBe&&t!==FBe&&t!==SBe&&t!==xBe&&t!==QBe&&t!==yBe&&t!==BBe&&t!==vBe&&t!==PBe}function Yq(t){var e=/^\n* /;return e.test(t)}var jq=1,Gq=2,qq=3,Jq=4,FI=5;function KBe(t,e,r,i,n){var s,o,a,l=!1,c=!1,u=i!==-1,g=-1,f=OBe(t.charCodeAt(0))&&!fS(t.charCodeAt(t.length-1));if(e)for(s=0;s<t.length;s++){if(o=t.charCodeAt(s),!Sc(o))return FI;a=s>0?t.charCodeAt(s-1):null,f=f&&Hq(o,a)}else{for(s=0;s<t.length;s++){if(o=t.charCodeAt(s),o===qf)l=!0,u&&(c=c||s-g-1>i&&t[g+1]!==" ",g=s);else if(!Sc(o))return FI;a=s>0?t.charCodeAt(s-1):null,f=f&&Hq(o,a)}c=c||u&&s-g-1>i&&t[g+1]!==" "}return!l&&!c?f&&!n(t)?jq:Gq:r>9&&Yq(t)?FI:c?Jq:qq}function YBe(t,e,r,i){t.dump=function(){if(e.length===0)return"''";if(!t.noCompatMode&&RBe.indexOf(e)!==-1)return"'"+e+"'";var n=t.indent*Math.max(1,r),s=t.lineWidth===-1?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-n),o=i||t.flowLevel>-1&&r>=t.flowLevel;function a(l){return MBe(t,l)}switch(KBe(e,o,t.indent,s,a)){case jq:return e;case Gq:return"'"+e.replace(/'/g,"''")+"'";case qq:return"|"+Wq(e,t.indent)+zq(Uq(e,n));case Jq:return">"+Wq(e,t.indent)+zq(Uq(UBe(e,s),n));case FI:return'"'+HBe(e,s)+'"';default:throw new Gf("impossible error: invalid scalar style")}}()}function Wq(t,e){var r=Yq(t)?String(e):"",i=t[t.length-1]===`
|
||||
`,n=i&&(t[t.length-2]===`
|
||||
`||t===`
|
||||
`),s=n?"+":i?"":"-";return r+s+`
|
||||
`}function zq(t){return t[t.length-1]===`
|
||||
`?t.slice(0,-1):t}function UBe(t,e){for(var r=/(\n+)([^\n]*)/g,i=function(){var c=t.indexOf(`
|
||||
`);return c=c!==-1?c:t.length,r.lastIndex=c,Vq(t.slice(0,c),e)}(),n=t[0]===`
|
||||
`||t[0]===" ",s,o;o=r.exec(t);){var a=o[1],l=o[2];s=l[0]===" ",i+=a+(!n&&!s&&l!==""?`
|
||||
`:"")+Vq(l,e),n=s}return i}function Vq(t,e){if(t===""||t[0]===" ")return t;for(var r=/ [^ ]/g,i,n=0,s,o=0,a=0,l="";i=r.exec(t);)a=i.index,a-n>e&&(s=o>n?o:a,l+=`
|
||||
`+t.slice(n,s),n=s+1),o=a;return l+=`
|
||||
`,t.length-n>e&&o>n?l+=t.slice(n,o)+`
|
||||
`+t.slice(o+1):l+=t.slice(n),l.slice(1)}function HBe(t){for(var e="",r,i,n,s=0;s<t.length;s++){if(r=t.charCodeAt(s),r>=55296&&r<=56319&&(i=t.charCodeAt(s+1),i>=56320&&i<=57343)){e+=Kq((r-55296)*1024+i-56320+65536),s++;continue}n=zr[r],e+=!n&&Sc(r)?t[s]:n||Kq(r)}return e}function jBe(t,e,r){var i="",n=t.tag,s,o;for(s=0,o=r.length;s<o;s+=1)vA(t,e,r[s],!1,!1)&&(s!==0&&(i+=","+(t.condenseFlow?"":" ")),i+=t.dump);t.tag=n,t.dump="["+i+"]"}function GBe(t,e,r,i){var n="",s=t.tag,o,a;for(o=0,a=r.length;o<a;o+=1)vA(t,e+1,r[o],!0,!0)&&((!i||o!==0)&&(n+=gS(t,e)),t.dump&&qf===t.dump.charCodeAt(0)?n+="-":n+="- ",n+=t.dump);t.tag=s,t.dump=n||"[]"}function qBe(t,e,r){var i="",n=t.tag,s=Object.keys(r),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",o!==0&&(u+=", "),t.condenseFlow&&(u+='"'),l=s[o],c=r[l],!!vA(t,e,l,!1,!1)&&(t.dump.length>1024&&(u+="? "),u+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),!!vA(t,e,c,!1,!1)&&(u+=t.dump,i+=u));t.tag=n,t.dump="{"+i+"}"}function JBe(t,e,r,i){var n="",s=t.tag,o=Object.keys(r),a,l,c,u,g,f;if(t.sortKeys===!0)o.sort();else if(typeof t.sortKeys=="function")o.sort(t.sortKeys);else if(t.sortKeys)throw new Gf("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)f="",(!i||a!==0)&&(f+=gS(t,e)),c=o[a],u=r[c],!!vA(t,e+1,c,!0,!0,!0)&&(g=t.tag!==null&&t.tag!=="?"||t.dump&&t.dump.length>1024,g&&(t.dump&&qf===t.dump.charCodeAt(0)?f+="?":f+="? "),f+=t.dump,g&&(f+=gS(t,e)),!!vA(t,e+1,u,!0,g)&&(t.dump&&qf===t.dump.charCodeAt(0)?f+=":":f+=": ",f+=t.dump,n+=f));t.tag=s,t.dump=n||"{}"}function Xq(t,e,r){var i,n,s,o,a,l;for(n=r?t.explicitTypes:t.implicitTypes,s=0,o=n.length;s<o;s+=1)if(a=n[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(t.tag=r?a.tag:"?",a.represent){if(l=t.styleMap[a.tag]||a.defaultStyle,vq.call(a.represent)==="[object Function]")i=a.represent(e,l);else if(Pq.call(a.represent,l))i=a.represent[l](e,l);else throw new Gf("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');t.dump=i}return!0}return!1}function vA(t,e,r,i,n,s){t.tag=null,t.dump=r,Xq(t,r,!1)||Xq(t,r,!0);var o=vq.call(t.dump);i&&(i=t.flowLevel<0||t.flowLevel>e);var a=o==="[object Object]"||o==="[object Array]",l,c;if(a&&(l=t.duplicates.indexOf(r),c=l!==-1),(t.tag!==null&&t.tag!=="?"||c||t.indent!==2&&e>0)&&(n=!1),c&&t.usedDuplicates[l])t.dump="*ref_"+l;else{if(a&&c&&!t.usedDuplicates[l]&&(t.usedDuplicates[l]=!0),o==="[object Object]")i&&Object.keys(t.dump).length!==0?(JBe(t,e,t.dump,n),c&&(t.dump="&ref_"+l+t.dump)):(qBe(t,e,t.dump),c&&(t.dump="&ref_"+l+" "+t.dump));else if(o==="[object Array]"){var u=t.noArrayIndent&&e>0?e-1:e;i&&t.dump.length!==0?(GBe(t,u,t.dump,n),c&&(t.dump="&ref_"+l+t.dump)):(jBe(t,u,t.dump),c&&(t.dump="&ref_"+l+" "+t.dump))}else if(o==="[object String]")t.tag!=="?"&&YBe(t,t.dump,e,s);else{if(t.skipInvalid)return!1;throw new Gf("unacceptable kind of an object to dump "+o)}t.tag!==null&&t.tag!=="?"&&(t.dump="!<"+t.tag+"> "+t.dump)}return!0}function WBe(t,e){var r=[],i=[],n,s;for(hS(t,r,i),n=0,s=i.length;n<s;n+=1)e.duplicates.push(r[i[n]]);e.usedDuplicates=new Array(s)}function hS(t,e,r){var i,n,s;if(t!==null&&typeof t=="object")if(n=e.indexOf(t),n!==-1)r.indexOf(n)===-1&&r.push(n);else if(e.push(t),Array.isArray(t))for(n=0,s=t.length;n<s;n+=1)hS(t[n],e,r);else for(i=Object.keys(t),n=0,s=i.length;n<s;n+=1)hS(t[i[n]],e,r)}function Zq(t,e){e=e||{};var r=new LBe(e);return r.noRefs||WBe(t,r),vA(r,0,t,!0,!0)?r.dump+`
|
||||
`:""}function zBe(t,e){return Zq(t,jf.extend({schema:dBe},e))}uS.exports.dump=Zq;uS.exports.safeDump=zBe});var eJ=C((IXe,_t)=>{"use strict";var RI=kq(),$q=_q();function NI(t){return function(){throw new Error("Function "+t+" is deprecated and cannot be used.")}}_t.exports.Type=Ir();_t.exports.Schema=SA();_t.exports.FAILSAFE_SCHEMA=DI();_t.exports.JSON_SCHEMA=sS();_t.exports.CORE_SCHEMA=oS();_t.exports.DEFAULT_SAFE_SCHEMA=Bc();_t.exports.DEFAULT_FULL_SCHEMA=Hf();_t.exports.load=RI.load;_t.exports.loadAll=RI.loadAll;_t.exports.safeLoad=RI.safeLoad;_t.exports.safeLoadAll=RI.safeLoadAll;_t.exports.dump=$q.dump;_t.exports.safeDump=$q.safeDump;_t.exports.YAMLException=Ec();_t.exports.MINIMAL_SCHEMA=DI();_t.exports.SAFE_SCHEMA=Bc();_t.exports.DEFAULT_SCHEMA=Hf();_t.exports.scan=NI("scan");_t.exports.parse=NI("parse");_t.exports.compose=NI("compose");_t.exports.addConstructor=NI("addConstructor")});var rJ=C((EXe,tJ)=>{"use strict";var VBe=eJ();tJ.exports=VBe});var nJ=C((yXe,iJ)=>{"use strict";function XBe(t,e){function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r}function PA(t,e,r,i){this.message=t,this.expected=e,this.found=r,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,PA)}XBe(PA,Error);PA.buildMessage=function(t,e){var r={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g<c.parts.length;g++)u+=c.parts[g]instanceof Array?s(c.parts[g][0])+"-"+s(c.parts[g][1]):s(c.parts[g]);return"["+(c.inverted?"^":"")+u+"]"},any:function(c){return"any character"},end:function(c){return"end of input"},other:function(c){return c.description}};function i(c){return c.charCodeAt(0).toString(16).toUpperCase()}function n(c){return c.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+i(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+i(u)})}function s(c){return c.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(u){return"\\x0"+i(u)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(u){return"\\x"+i(u)})}function o(c){return r[c.type](c)}function a(c){var u=new Array(c.length),g,f;for(g=0;g<c.length;g++)u[g]=o(c[g]);if(u.sort(),u.length>0){for(g=1,f=1;g<u.length;g++)u[g-1]!==u[g]&&(u[f]=u[g],f++);u.length=f}switch(u.length){case 1:return u[0];case 2:return u[0]+" or "+u[1];default:return u.slice(0,-1).join(", ")+", or "+u[u.length-1]}}function l(c){return c?'"'+n(c)+'"':"end of input"}return"Expected "+a(t)+" but "+l(e)+" found."};function ZBe(t,e){e=e!==void 0?e:{};var r={},i={Start:iC},n=iC,s=function(S){return[].concat(...S)},o="-",a=Ot("-",!1),l=function(S){return S},c=function(S){return Object.assign({},...S)},u="#",g=Ot("#",!1),f=iw(),h=function(){return{}},p=":",m=Ot(":",!1),I=function(S,U){return{[S]:U}},y=",",B=Ot(",",!1),x=function(S,U){return U},F=function(S,U,G){return Object.assign({},...[S].concat(U).map(Ee=>({[Ee]:G})))},N=function(S){return S},O=function(S){return S},P=So("correct indentation"),J=" ",oe=Ot(" ",!1),K=function(S){return S.length===Ql*AC},A=function(S){return S.length===(Ql+1)*AC},W=function(){return Ql++,!0},ee=function(){return Ql--,!0},re=function(){return _d()},H=So("pseudostring"),R=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,ve=Vn(["\r",`
|
||||
`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),Ne=/^[^\r\n\t ,\][{}:#"']/,Je=Vn(["\r",`
|
||||
`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),Ke=function(){return _d().replace(/^ *| *$/g,"")},ie="--",ce=Ot("--",!1),Se=/^[a-zA-Z\/0-9]/,fe=Vn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),Ie=/^[^\r\n\t :,]/,pe=Vn(["\r",`
|
||||
`," "," ",":",","],!0,!1),Qe="null",Z=Ot("null",!1),X=function(){return null},ae="true",ue=Ot("true",!1),Be=function(){return!0},ct="false",mt=Ot("false",!1),St=function(){return!1},xn=So("string"),Ii='"',Xt=Ot('"',!1),_i=function(){return""},zn=function(S){return S},_u=function(S){return S.join("")},Kd=/^[^"\\\0-\x1F\x7F]/,xs=Vn(['"',"\\",["\0",""],"\x7F"],!0,!1),$u='\\"',Ud=Ot('\\"',!1),YB=function(){return'"'},eg="\\\\",Hd=Ot("\\\\",!1),Yd=function(){return"\\"},jd="\\/",jB=Ot("\\/",!1),GB=function(){return"/"},tg="\\b",qB=Ot("\\b",!1),JB=function(){return"\b"},Gd="\\f",WB=Ot("\\f",!1),_=function(){return"\f"},ks="\\n",$i=Ot("\\n",!1),en=function(){return`
|
||||
`},rg="\\r",qd=Ot("\\r",!1),El=function(){return"\r"},ig="\\t",Jd=Ot("\\t",!1),ng=function(){return" "},yl="\\u",sg=Ot("\\u",!1),og=function(S,U,G,Ee){return String.fromCharCode(parseInt(`0x${S}${U}${G}${Ee}`))},zB=/^[0-9a-fA-F]/,VB=Vn([["0","9"],["a","f"],["A","F"]],!1,!1),XB=So("blank space"),Wd=/^[ \t]/,zd=Vn([" "," "],!1,!1),ZB=So("white space"),Vd=/^[ \t\n\r]/,Xd=Vn([" "," ",`
|
||||
`,"\r"],!1,!1),Zd=`\r
|
||||
`,_B=Ot(`\r
|
||||
`,!1),$B=`
|
||||
`,ew=Ot(`
|
||||
`,!1),tw="\r",rw=Ot("\r",!1),M=0,it=0,Bl=[{line:1,column:1}],Oi=0,ag=[],Oe=0,Ta;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function _d(){return t.substring(it,M)}function aN(){return xo(it,M)}function Oa(S,U){throw U=U!==void 0?U:xo(it,M),rC([So(S)],t.substring(it,M),U)}function $d(S,U){throw U=U!==void 0?U:xo(it,M),nw(S,U)}function Ot(S,U){return{type:"literal",text:S,ignoreCase:U}}function Vn(S,U,G){return{type:"class",parts:S,inverted:U,ignoreCase:G}}function iw(){return{type:"any"}}function eC(){return{type:"end"}}function So(S){return{type:"other",description:S}}function tC(S){var U=Bl[S],G;if(U)return U;for(G=S-1;!Bl[G];)G--;for(U=Bl[G],U={line:U.line,column:U.column};G<S;)t.charCodeAt(G)===10?(U.line++,U.column=1):U.column++,G++;return Bl[S]=U,U}function xo(S,U){var G=tC(S),Ee=tC(U);return{start:{offset:S,line:G.line,column:G.column},end:{offset:U,line:Ee.line,column:Ee.column}}}function Ve(S){M<Oi||(M>Oi&&(Oi=M,ag=[]),ag.push(S))}function nw(S,U){return new PA(S,null,null,U)}function rC(S,U,G){return new PA(PA.buildMessage(S,U),S,U,G)}function iC(){var S;return S=lg(),S}function nC(){var S,U,G;for(S=M,U=[],G=Ag();G!==r;)U.push(G),G=Ag();return U!==r&&(it=S,U=s(U)),S=U,S}function Ag(){var S,U,G,Ee,Ce;return S=M,U=Ua(),U!==r?(t.charCodeAt(M)===45?(G=o,M++):(G=r,Oe===0&&Ve(a)),G!==r?(Ee=pr(),Ee!==r?(Ce=Ka(),Ce!==r?(it=S,U=l(Ce),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r),S}function lg(){var S,U,G;for(S=M,U=[],G=cg();G!==r;)U.push(G),G=cg();return U!==r&&(it=S,U=c(U)),S=U,S}function cg(){var S,U,G,Ee,Ce,Te,rt,Kt,Fs;if(S=M,U=pr(),U===r&&(U=null),U!==r){if(G=M,t.charCodeAt(M)===35?(Ee=u,M++):(Ee=r,Oe===0&&Ve(g)),Ee!==r){if(Ce=[],Te=M,rt=M,Oe++,Kt=Ps(),Oe--,Kt===r?rt=void 0:(M=rt,rt=r),rt!==r?(t.length>M?(Kt=t.charAt(M),M++):(Kt=r,Oe===0&&Ve(f)),Kt!==r?(rt=[rt,Kt],Te=rt):(M=Te,Te=r)):(M=Te,Te=r),Te!==r)for(;Te!==r;)Ce.push(Te),Te=M,rt=M,Oe++,Kt=Ps(),Oe--,Kt===r?rt=void 0:(M=rt,rt=r),rt!==r?(t.length>M?(Kt=t.charAt(M),M++):(Kt=r,Oe===0&&Ve(f)),Kt!==r?(rt=[rt,Kt],Te=rt):(M=Te,Te=r)):(M=Te,Te=r);else Ce=r;Ce!==r?(Ee=[Ee,Ce],G=Ee):(M=G,G=r)}else M=G,G=r;if(G===r&&(G=null),G!==r){if(Ee=[],Ce=Hr(),Ce!==r)for(;Ce!==r;)Ee.push(Ce),Ce=Hr();else Ee=r;Ee!==r?(it=S,U=h(),S=U):(M=S,S=r)}else M=S,S=r}else M=S,S=r;if(S===r&&(S=M,U=Ua(),U!==r?(G=aC(),G!==r?(Ee=pr(),Ee===r&&(Ee=null),Ee!==r?(t.charCodeAt(M)===58?(Ce=p,M++):(Ce=r,Oe===0&&Ve(m)),Ce!==r?(Te=pr(),Te===r&&(Te=null),Te!==r?(rt=Ka(),rt!==r?(it=S,U=I(G,rt),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r),S===r&&(S=M,U=Ua(),U!==r?(G=ko(),G!==r?(Ee=pr(),Ee===r&&(Ee=null),Ee!==r?(t.charCodeAt(M)===58?(Ce=p,M++):(Ce=r,Oe===0&&Ve(m)),Ce!==r?(Te=pr(),Te===r&&(Te=null),Te!==r?(rt=Ka(),rt!==r?(it=S,U=I(G,rt),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r),S===r))){if(S=M,U=Ua(),U!==r)if(G=ko(),G!==r)if(Ee=pr(),Ee!==r)if(Ce=Le(),Ce!==r){if(Te=[],rt=Hr(),rt!==r)for(;rt!==r;)Te.push(rt),rt=Hr();else Te=r;Te!==r?(it=S,U=I(G,Ce),S=U):(M=S,S=r)}else M=S,S=r;else M=S,S=r;else M=S,S=r;else M=S,S=r;if(S===r)if(S=M,U=Ua(),U!==r)if(G=ko(),G!==r){if(Ee=[],Ce=M,Te=pr(),Te===r&&(Te=null),Te!==r?(t.charCodeAt(M)===44?(rt=y,M++):(rt=r,Oe===0&&Ve(B)),rt!==r?(Kt=pr(),Kt===r&&(Kt=null),Kt!==r?(Fs=ko(),Fs!==r?(it=Ce,Te=x(G,Fs),Ce=Te):(M=Ce,Ce=r)):(M=Ce,Ce=r)):(M=Ce,Ce=r)):(M=Ce,Ce=r),Ce!==r)for(;Ce!==r;)Ee.push(Ce),Ce=M,Te=pr(),Te===r&&(Te=null),Te!==r?(t.charCodeAt(M)===44?(rt=y,M++):(rt=r,Oe===0&&Ve(B)),rt!==r?(Kt=pr(),Kt===r&&(Kt=null),Kt!==r?(Fs=ko(),Fs!==r?(it=Ce,Te=x(G,Fs),Ce=Te):(M=Ce,Ce=r)):(M=Ce,Ce=r)):(M=Ce,Ce=r)):(M=Ce,Ce=r);else Ee=r;Ee!==r?(Ce=pr(),Ce===r&&(Ce=null),Ce!==r?(t.charCodeAt(M)===58?(Te=p,M++):(Te=r,Oe===0&&Ve(m)),Te!==r?(rt=pr(),rt===r&&(rt=null),rt!==r?(Kt=Ka(),Kt!==r?(it=S,U=F(G,Ee,Kt),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)}else M=S,S=r;else M=S,S=r}return S}function Ka(){var S,U,G,Ee,Ce,Te,rt;if(S=M,U=M,Oe++,G=M,Ee=Ps(),Ee!==r?(Ce=sw(),Ce!==r?(t.charCodeAt(M)===45?(Te=o,M++):(Te=r,Oe===0&&Ve(a)),Te!==r?(rt=pr(),rt!==r?(Ee=[Ee,Ce,Te,rt],G=Ee):(M=G,G=r)):(M=G,G=r)):(M=G,G=r)):(M=G,G=r),Oe--,G!==r?(M=U,U=void 0):U=r,U!==r?(G=Hr(),G!==r?(Ee=sC(),Ee!==r?(Ce=nC(),Ce!==r?(Te=oC(),Te!==r?(it=S,U=N(Ce),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r),S===r&&(S=M,U=Ps(),U!==r?(G=sC(),G!==r?(Ee=lg(),Ee!==r?(Ce=oC(),Ce!==r?(it=S,U=N(Ee),S=U):(M=S,S=r)):(M=S,S=r)):(M=S,S=r)):(M=S,S=r),S===r))if(S=M,U=Q(),U!==r){if(G=[],Ee=Hr(),Ee!==r)for(;Ee!==r;)G.push(Ee),Ee=Hr();else G=r;G!==r?(it=S,U=O(U),S=U):(M=S,S=r)}else M=S,S=r;return S}function Ua(){var S,U,G;for(Oe++,S=M,U=[],t.charCodeAt(M)===32?(G=J,M++):(G=r,Oe===0&&Ve(oe));G!==r;)U.push(G),t.charCodeAt(M)===32?(G=J,M++):(G=r,Oe===0&&Ve(oe));return U!==r?(it=M,G=K(U),G?G=void 0:G=r,G!==r?(U=[U,G],S=U):(M=S,S=r)):(M=S,S=r),Oe--,S===r&&(U=r,Oe===0&&Ve(P)),S}function sw(){var S,U,G;for(S=M,U=[],t.charCodeAt(M)===32?(G=J,M++):(G=r,Oe===0&&Ve(oe));G!==r;)U.push(G),t.charCodLine truncated
|
||||
`,n=Buffer.byteLength(i),s=Math.floor(Math.log(n)/Math.log(10))+1;return n+s>=Math.pow(10,s)&&(s+=1),s+n+i}};rE.parse=(t,e,r)=>new rE(d0e(C0e(t),e),r);var d0e=(t,e)=>e?Object.keys(t).reduce((r,i)=>(r[i]=t[i],r),e):t,C0e=t=>t.replace(/\n$/,"").split(`
|
||||
`).reduce(m0e,Object.create(null)),m0e=(t,e)=>{let r=parseInt(e,10);if(r!==Buffer.byteLength(e)+1)return t;e=e.substr((r+" ").length);let i=e.split("="),n=i.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!n)return t;let s=i.join("=");return t[n]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(n)?new Date(s*1e3):/^[0-9]+$/.test(s)?+s:s,t};B3.exports=rE});var nE=C((p_e,w3)=>{"use strict";w3.exports=t=>class extends t{warn(e,r,i={}){this.file&&(i.file=this.file),this.cwd&&(i.cwd=this.cwd),i.code=r instanceof Error&&r.code||e,i.tarCode=e,!this.strict&&i.recoverable!==!1?(r instanceof Error&&(i=Object.assign(r,i),r=r.message),this.emit("warn",i.tarCode,r,i)):r instanceof Error?this.emit("error",Object.assign(r,i)):this.emit("error",Object.assign(new Error(`${e}: ${r}`),i))}}});var XS=C((d_e,Q3)=>{"use strict";var sE=["|","<",">","?",":"],VS=sE.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),I0e=new Map(sE.map((t,e)=>[t,VS[e]])),E0e=new Map(VS.map((t,e)=>[t,sE[e]]));Q3.exports={encode:t=>sE.reduce((e,r)=>e.split(r).join(I0e.get(r)),t),decode:t=>VS.reduce((e,r)=>e.split(r).join(E0e.get(r)),t)}});var D3=C((C_e,b3)=>{"use strict";b3.exports=(t,e,r)=>(t&=4095,r&&(t=(t|384)&~18),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t)});var ix=C((B_e,S3)=>{"use strict";var x3=Fc(),k3=iE(),v3=Lc(),m_e=ah(),us=require("fs"),Mc=require("path"),I_e=oh(),y0e=16*1024*1024,P3=Symbol("process"),F3=Symbol("file"),R3=Symbol("directory"),ZS=Symbol("symlink"),N3=Symbol("hardlink"),Ah=Symbol("header"),oE=Symbol("read"),_S=Symbol("lstat"),aE=Symbol("onlstat"),$S=Symbol("onread"),ex=Symbol("onreadlink"),tx=Symbol("openfile"),rx=Symbol("onopenfile"),UA=Symbol("close"),AE=Symbol("mode"),L3=nE(),B0e=XS(),M3=D3(),lE=L3(class extends x3{constructor(e,r){if(r=r||{},super(r),typeof e!="string")throw new TypeError("path is required");this.path=e,this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid(),this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||y0e,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=r.cwd||process.cwd(),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,typeof r.onwarn=="function"&&this.on("warn",r.onwarn);let i=!1;if(!this.preservePaths&&Mc.win32.isAbsolute(e)){let n=Mc.win32.parse(e);this.path=e.substr(n.root.length),i=n.root}this.win32=!!r.win32||process.platform==="win32",this.win32&&(this.path=B0e.decode(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=r.absolute||Mc.resolve(this.cwd,e),this.path===""&&(this.path="./"),i&&this.warn("TAR_ENTRY_INFO",`stripping ${i} from absolute path`,{entry:this,path:i+this.path}),this.statCache.has(this.absolute)?this[aE](this.statCache.get(this.absolute)):this[_S]()}[_S](){us.lstat(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[aE](r)})}[aE](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=w0e(e),this.emit("stat",e),this[P3]()}[P3](){switch(this.type){case"File":return this[F3]();case"Directory":return this[R3]();case"SymbolicLink":return this[ZS]();default:return this.end()}}[AE](e){return M3(e,this.type==="Directory",this.portable)}[Ah](){this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.header=new v3({path:this.path,linkpath:this.linkpath,mode:this[AE](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax&&this.write(new k3({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this.path,linkpath:this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode()),this.write(this.header.block)}[R3](){this.path.substr(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Ah](),this.end()}[ZS](){us.readlink(this.absolute,(e,r)=>{if(e)return this.emit("error",e);this[ex](r)})}[ex](e){this.linkpath=e.replace(/\\/g,"/"),this[Ah](),this.end()}[N3](e){this.type="Link",this.linkpath=Mc.relative(this.cwd,e).replace(/\\/g,"/"),this.stat.size=0,this[Ah](),this.end()}[F3](){if(this.stat.nlink>1){let e=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(e)){let r=this.linkCache.get(e);if(r.indexOf(this.cwd)===0)return this[N3](r)}this.linkCache.set(e,this.absolute)}if(this[Ah](),this.stat.size===0)return this.end();this[tx]()}[tx](){us.open(this.absolute,"r",(e,r)=>{if(e)return this.emit("error",e);this[rx](r)})}[rx](e){let r=512*Math.ceil(this.stat.size/512),i=Math.min(r,th
Line truncated
|
||||
`}),a},i})});var nz=C((M$e,ek)=>{"use strict";var pDe=t=>{let e=!1,r=!1,i=!1;for(let n=0;n<t.length;n++){let s=t[n];e&&/[a-zA-Z]/.test(s)&&s.toUpperCase()===s?(t=t.slice(0,n)+"-"+t.slice(n),e=!1,i=r,r=!0,n++):r&&i&&/[a-zA-Z]/.test(s)&&s.toLowerCase()===s?(t=t.slice(0,n-1)+"-"+t.slice(n-1),i=r,r=!1,e=!0):(e=s.toLowerCase()===s&&s.toUpperCase()!==s,i=r,r=s.toUpperCase()===s&&s.toLowerCase()!==s)}return t},iz=(t,e)=>{if(!(typeof t=="string"||Array.isArray(t)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let r=n=>e.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(t)?t=t.map(n=>n.trim()).filter(n=>n.length).join("-"):t=t.trim(),t.length===0?"":t.length===1?e.pascalCase?t.toUpperCase():t.toLowerCase():(t!==t.toLowerCase()&&(t=pDe(t)),t=t.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,s)=>s.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),r(t))};ek.exports=iz;ek.exports.default=iz});var go=C(uk=>{"use strict";Object.defineProperty(uk,"__esModule",{value:!0});uk.default=uz;function uz(){}uz.prototype={diff:function(e,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=i.callback;typeof i=="function"&&(n=i,i={}),this.options=i;var s=this;function o(m){return n?(setTimeout(function(){n(void 0,m)},0),!0):m}e=this.castInput(e),r=this.castInput(r),e=this.removeEmpty(this.tokenize(e)),r=this.removeEmpty(this.tokenize(r));var a=r.length,l=e.length,c=1,u=a+l,g=[{newPos:-1,components:[]}],f=this.extractCommon(g[0],r,e,0);if(g[0].newPos+1>=a&&f+1>=l)return o([{value:this.join(r),count:r.length}]);function h(){for(var m=-1*c;m<=c;m+=2){var I=void 0,y=g[m-1],B=g[m+1],x=(B?B.newPos:0)-m;y&&(g[m-1]=void 0);var F=y&&y.newPos+1<a,N=B&&0<=x&&x<l;if(!F&&!N){g[m]=void 0;continue}if(!F||N&&y.newPos<B.newPos?(I=BDe(B),s.pushComponent(I.components,void 0,!0)):(I=y,I.newPos++,s.pushComponent(I.components,!0,void 0)),x=s.extractCommon(I,r,e,m),I.newPos+1>=a&&x+1>=l)return o(yDe(s,I.components,r,e,s.useLongestToken));g[m]=I}c++}if(n)(function m(){setTimeout(function(){if(c>u)return n();h()||m()},0)})();else for(;c<=u;){var p=h();if(p)return p}},pushComponent:function(e,r,i){var n=e[e.length-1];n&&n.added===r&&n.removed===i?e[e.length-1]={count:n.count+1,added:r,removed:i}:e.push({count:1,added:r,removed:i})},extractCommon:function(e,r,i,n){for(var s=r.length,o=i.length,a=e.newPos,l=a-n,c=0;a+1<s&&l+1<o&&this.equals(r[a+1],i[l+1]);)a++,l++,c++;return c&&e.components.push({count:c}),e.newPos=a,l},equals:function(e,r){return this.options.comparator?this.options.comparator(e,r):e===r||this.options.ignoreCase&&e.toLowerCase()===r.toLowerCase()},removeEmpty:function(e){for(var r=[],i=0;i<e.length;i++)e[i]&&r.push(e[i]);return r},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function yDe(t,e,r,i,n){for(var s=0,o=e.length,a=0,l=0;s<o;s++){var c=e[s];if(c.removed){if(c.value=t.join(i.slice(l,l+c.count)),l+=c.count,s&&e[s-1].added){var g=e[s-1];e[s-1]=e[s],e[s]=g}}else{if(!c.added&&n){var u=r.slice(a,a+c.count);u=u.map(function(h,p){var m=i[l+p];return m.length>h.length?m:h}),c.value=t.join(u)}else c.value=t.join(r.slice(a,a+c.count));a+=c.count,c.added||(l+=c.count)}}var f=e[o-1];return o>1&&typeof f.value=="string"&&(f.added||f.removed)&&t.equals("",f.value)&&(e[o-2].value+=f.value,e.pop()),e}function BDe(t){return{newPos:t.newPos,components:t.components.slice(0)}}});var fz=C(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});yh.diffChars=wDe;yh.characterDiff=void 0;var bDe=QDe(go());function QDe(t){return t&&t.__esModule?t:{default:t}}var gz=new bDe.default;yh.characterDiff=gz;function wDe(t,e,r){return gz.diff(t,e,r)}});var fk=C(gk=>{"use strict";Object.defineProperty(gk,"__esModule",{value:!0});gk.generateOptions=DDe;function DDe(t,e){if(typeof t=="function")e.callback=t;else if(t)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}});var dz=C($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});$c.diffWords=SDe;$c.diffWordsWithSpace=xDe;$c.wordDiff=void 0;var vDe=kDe(go()),PDe=fk();function kDe(t){return t&&t.__esModule?t:{default:t}}var hz=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,pz=/\S/,Bh=new vDe.default;$c.wordDiff=Bh;Bh.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!pz.test(t)&&!pz.test(e)};Bh.tokenize=function(t){for(var e=t.split(/(\s+|[()[\]{}'"]|\b)/),r=0;r<e.length-1;r++)!e[r+1]&&e[r+2]&&hz.test(e[r])&&hz.test(e[r+2])&&(e[r]+=e[r+2],e.splice(r+1,2),r--);return e};function SDe(t,e,r){return r=(0,PDe.generateOptions)(r,{ignoreWhitespace:!0}),Bh.diff(t,e,r)}function xDe(t,e,r){return Bh.diff(t,e,r)}});var zE=C(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});eu.diffLines=FDe;eu.diffTrimmedLines=RDe;eu.lineDiff=void 0;var LDe=NDe(go()),MDe=fk();function NDe(t){return t&&t.__esModule?t:{default
Line truncated
|
||||
`),m==="+"?h++:m==="-"?p++:m===" "&&(h++,p++);else break}if(!h&&f.newLines===1&&(f.newLines=0),!p&&f.oldLines===1&&(f.oldLines=0),e.strict){if(h!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(c+1));if(p!==f.oldLines)throw new Error("Removed line count did not match for hunk at line "+(c+1))}return f}for(;s<r.length;)o();return n}});var Bz=C(Ck=>{"use strict";Object.defineProperty(Ck,"__esModule",{value:!0});Ck.default=ZDe;function ZDe(t,e,r){var i=!0,n=!1,s=!1,o=1;return function a(){if(i&&!s){if(n?o++:i=!1,t+o<=r)return o;s=!0}if(!n)return s||(i=!0),e<=t-o?-o++:(n=!0,a())}}});var bz=C(_E=>{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.applyPatch=wz;_E.applyPatches=_De;var Qz=ZE(),eSe=$De(Bz());function $De(t){return t&&t.__esModule?t:{default:t}}function wz(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string"&&(e=(0,Qz.parsePatch)(e)),Array.isArray(e)){if(e.length>1)throw new Error("applyPatch only works with a single input.");e=e[0]}var i=t.split(/\r\n|[\n\v\f\r\x85]/),n=t.match(/\r\n|[\n\v\f\r\x85]/g)||[],s=e.hunks,o=r.compareLine||function(H,R,ve,Ne){return R===Ne},a=0,l=r.fuzzFactor||0,c=0,u=0,g,f;function h(H,R){for(var ve=0;ve<H.lines.length;ve++){var Ne=H.lines[ve],Je=Ne.length>0?Ne[0]:" ",Ke=Ne.length>0?Ne.substr(1):Ne;if(Je===" "||Je==="-"){if(!o(R+1,i[R],Je,Ke)&&(a++,a>l))return!1;R++}}return!0}for(var p=0;p<s.length;p++){for(var m=s[p],I=i.length-m.oldLines,y=0,B=u+m.oldStart-1,x=(0,eSe.default)(B,c,I);y!==void 0;y=x())if(h(m,B+y)){m.offset=u+=y;break}if(y===void 0)return!1;c=m.offset+m.oldStart+m.oldLines}for(var F=0,N=0;N<s.length;N++){var O=s[N],P=O.oldStart+O.offset+F-1;F+=O.newLines-O.oldLines,P<0&&(P=0);for(var J=0;J<O.lines.length;J++){var oe=O.lines[J],K=oe.length>0?oe[0]:" ",A=oe.length>0?oe.substr(1):oe,W=O.linedelimiters[J];if(K===" ")P++;else if(K==="-")i.splice(P,1),n.splice(P,1);else if(K==="+")i.splice(P,0,A),n.splice(P,0,W),P++;else if(K==="\\"){var ee=O.lines[J-1]?O.lines[J-1][0]:null;ee==="+"?g=!0:ee==="-"&&(f=!0)}}}if(g)for(;!i[i.length-1];)i.pop(),n.pop();else f&&(i.push(""),n.push(`
|
||||
`));for(var re=0;re<i.length-1;re++)i[re]=i[re]+n[re];return i.join("")}function _De(t,e){typeof t=="string"&&(t=(0,Qz.parsePatch)(t));var r=0;function i(){var n=t[r++];if(!n)return e.complete();e.loadFile(n,function(s,o){if(s)return e.complete(s);var a=wz(o,n,e);e.patched(n,a,function(l){if(l)return e.complete(l);i()})})}i()}});var Ik=C(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});Sh.structuredPatch=Dz;Sh.createTwoFilesPatch=Sz;Sh.createPatch=tSe;var rSe=zE();function mk(t){return sSe(t)||nSe(t)||iSe()}function iSe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function nSe(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function sSe(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function Dz(t,e,r,i,n,s,o){o||(o={}),typeof o.context=="undefined"&&(o.context=4);var a=(0,rSe.diffLines)(r,i,o);a.push({value:"",lines:[]});function l(y){return y.map(function(B){return" "+B})}for(var c=[],u=0,g=0,f=[],h=1,p=1,m=function(B){var x=a[B],F=x.lines||x.value.replace(/\n$/,"").split(`
|
||||
`);if(x.lines=F,x.added||x.removed){var N;if(!u){var O=a[B-1];u=h,g=p,O&&(f=o.context>0?l(O.lines.slice(-o.context)):[],u-=f.length,g-=f.length)}(N=f).push.apply(N,mk(F.map(function(re){return(x.added?"+":"-")+re}))),x.added?p+=F.length:h+=F.length}else{if(u)if(F.length<=o.context*2&&B<a.length-2){var P;(P=f).push.apply(P,mk(l(F)))}else{var J,oe=Math.min(F.length,o.context);(J=f).push.apply(J,mk(l(F.slice(0,oe))));var K={oldStart:u,oldLines:h-u+oe,newStart:g,newLines:p-g+oe,lines:f};if(B>=a.length-2&&F.length<=o.context){var A=/\n$/.test(r),W=/\n$/.test(i),ee=F.length==0&&f.length>K.oldLines;!A&&ee&&f.splice(K.oldLines,0,"\\ No newline at end of file"),(!A&&!ee||!W)&&f.push("\\ No newline at end of file")}c.push(K),u=0,g=0,f=[]}h+=F.length,p+=F.length}},I=0;I<a.length;I++)m(I);return{oldFileName:t,newFileName:e,oldHeader:n,newHeader:s,hunks:c}}function Sz(t,e,r,i,n,s,o){var a=Dz(t,e,r,i,n,s,o),l=[];t==e&&l.push("Index: "+t),l.push("==================================================================="),l.push("--- "+a.oldFileName+(typeof a.oldHeader=="undefined"?"":" "+a.oldHeader)),l.push("+++ "+a.newFileName+(typeof a.newHeader=="undefined"?"":" "+a.newHeader));for(var c=0;c<a.hunks.length;c++){var u=a.hunks[c];l.push("@@ -"+u.oldStart+","+u.oldLines+" +"+u.newStart+","+u.newLines+" @@"),l.push.apply(l,u.lines)}return l.join(`
|
||||
`)+`
|
||||
`}function tSe(t,e,r,i,n,s){return Sz(t,t,e,r,i,n,s)}});var kz=C($E=>{"use strict";Object.defineProperty($E,"__esModule",{value:!0});$E.arrayEqual=oSe;$E.arrayStartsWith=xz;function oSe(t,e){return t.length!==e.length?!1:xz(t,e)}function xz(t,e){if(e.length>t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}});var Uz=C(ey=>{"use strict";Object.defineProperty(ey,"__esModule",{value:!0});ey.calcLineCount=vz;ey.merge=aSe;var ASe=Ik(),lSe=ZE(),Ek=kz();function ru(t){return gSe(t)||uSe(t)||cSe()}function cSe(){throw new TypeError("Invalid attempt to spread non-iterable instance")}function uSe(t){if(Symbol.iterator in Object(t)||Object.prototype.toString.call(t)==="[object Arguments]")return Array.from(t)}function gSe(t){if(Array.isArray(t)){for(var e=0,r=new Array(t.length);e<t.length;e++)r[e]=t[e];return r}}function vz(t){var e=yk(t.lines),r=e.oldLines,i=e.newLines;r!==void 0?t.oldLines=r:delete t.oldLines,i!==void 0?t.newLines=i:delete t.newLines}function aSe(t,e,r){t=Pz(t,r),e=Pz(e,r);var i={};(t.index||e.index)&&(i.index=t.index||e.index),(t.newFileName||e.newFileName)&&(Fz(t)?Fz(e)?(i.oldFileName=ty(i,t.oldFileName,e.oldFileName),i.newFileName=ty(i,t.newFileName,e.newFileName),i.oldHeader=ty(i,t.oldHeader,e.oldHeader),i.newHeader=ty(i,t.newHeader,e.newHeader)):(i.oldFileName=t.oldFileName,i.newFileName=t.newFileName,i.oldHeader=t.oldHeader,i.newHeader=t.newHeader):(i.oldFileName=e.oldFileName||t.oldFileName,i.newFileName=e.newFileName||t.newFileName,i.oldHeader=e.oldHeader||t.oldHeader,i.newHeader=e.newHeader||t.newHeader)),i.hunks=[];for(var n=0,s=0,o=0,a=0;n<t.hunks.length||s<e.hunks.length;){var l=t.hunks[n]||{oldStart:Infinity},c=e.hunks[s]||{oldStart:Infinity};if(Rz(l,c))i.hunks.push(Nz(l,o)),n++,a+=l.newLines-l.oldLines;else if(Rz(c,l))i.hunks.push(Nz(c,a)),s++,o+=c.newLines-c.oldLines;else{var u={oldStart:Math.min(l.oldStart,c.oldStart),oldLines:0,newStart:Math.min(l.newStart+o,c.oldStart+a),newLines:0,lines:[]};fSe(u,l.oldStart,l.lines,c.oldStart,c.lines),s++,n++,i.hunks.push(u)}}return i}function Pz(t,e){if(typeof t=="string"){if(/^@@/m.test(t)||/^Index:/m.test(t))return(0,lSe.parsePatch)(t)[0];if(!e)throw new Error("Must provide a base reference or pass in a patch");return(0,ASe.structuredPatch)(void 0,void 0,e,t)}return t}function Fz(t){return t.newFileName&&t.newFileName!==t.oldFileName}function ty(t,e,r){return e===r?e:(t.conflict=!0,{mine:e,theirs:r})}function Rz(t,e){return t.oldStart<e.oldStart&&t.oldStart+t.oldLines<e.oldStart}function Nz(t,e){return{oldStart:t.oldStart,oldLines:t.oldLines,newStart:t.newStart+e,newLines:t.newLines,lines:t.lines}}function fSe(t,e,r,i,n){var s={offset:e,lines:r,index:0},o={offset:i,lines:n,index:0};for(Mz(t,s,o),Mz(t,o,s);s.index<s.lines.length&&o.index<o.lines.length;){var a=s.lines[s.index],l=o.lines[o.index];if((a[0]==="-"||a[0]==="+")&&(l[0]==="-"||l[0]==="+"))hSe(t,s,o);else if(a[0]==="+"&&l[0]===" "){var c;(c=t.lines).push.apply(c,ru(ZA(s)))}else if(l[0]==="+"&&a[0]===" "){var u;(u=t.lines).push.apply(u,ru(ZA(o)))}else a[0]==="-"&&l[0]===" "?Lz(t,s,o):l[0]==="-"&&a[0]===" "?Lz(t,o,s,!0):a===l?(t.lines.push(a),s.index++,o.index++):Bk(t,ZA(s),ZA(o))}Tz(t,s),Tz(t,o),vz(t)}function hSe(t,e,r){var i=ZA(e),n=ZA(r);if(Oz(i)&&Oz(n)){if((0,Ek.arrayStartsWith)(i,n)&&Kz(r,i,i.length-n.length)){var s;(s=t.lines).push.apply(s,ru(i));return}else if((0,Ek.arrayStartsWith)(n,i)&&Kz(e,n,n.length-i.length)){var o;(o=t.lines).push.apply(o,ru(n));return}}else if((0,Ek.arrayEqual)(i,n)){var a;(a=t.lines).push.apply(a,ru(i));return}Bk(t,i,n)}function Lz(t,e,r,i){var n=ZA(e),s=pSe(r,n);if(s.merged){var o;(o=t.lines).push.apply(o,ru(s.merged))}else Bk(t,i?s:n,i?n:s)}function Bk(t,e,r){t.conflict=!0,t.lines.push({conflict:!0,mine:e,theirs:r})}function Mz(t,e,r){for(;e.offset<r.offset&&e.index<e.lines.length;){var i=e.lines[e.index++];t.lines.push(i),e.offset++}}function Tz(t,e){for(;e.index<e.lines.length;){var r=e.lines[e.index++];t.lines.push(r)}}function ZA(t){for(var e=[],r=t.lines[t.index][0];t.index<t.lines.length;){var i=t.lines[t.index];if(r==="-"&&i[0]==="+"&&(r="+"),r===i[0])e.push(i),t.index++;else break}return e}function pSe(t,e){for(var r=[],i=[],n=0,s=!1,o=!1;n<e.length&&t.index<t.lines.length;){var a=t.lines[t.index],l=e[n];if(l[0]==="+")break;if(s=s||a[0]!==" ",i.push(l),n++,a[0]==="+")for(o=!0;a[0]==="+";)r.push(a),a=t.lines[++t.index];l.substr(1)===a.substr(1)?(r.push(a),t.index++):o=!0}if((e[n]||"")[0]==="+"&&s&&(o=!0),o)return r;for(;n<e.length;)i.push(e[n++]);return{merged:i,changes:r}}function Oz(t){return t.reduce(function(e,r){return e&&r[0]==="-"},!0)}function Kz(t,e,r){for(var i=0;i<r;i++){var n=e[e.length-r+i].substr(1);if(t.lines[t.index+i]!==" "+n)return!1}return t.index+=r,!0}function yk(t){var e=0,r=0;return t.forEach(function(i){if(typeof i!="string"){var n=yk(i.mine),s=yk(i.theirs);e!==void 0&&(n.oldLines===s.oldLines?e+=n.oldLines:e=void 0),r!==void 0&&(n.newLines===s.newLines?r+=n.newLines:r=void 0)}else r!==void 0&
Line truncated
|
||||
|
||||
attempted value: ${s}
|
||||
`+(o!==s?`result of cast: ${o}`:""))}return n}_cast(e,r){let i=e===void 0?e:this.transforms.reduce((n,s)=>s.call(this,n,e,this),e);return i===void 0&&(i=this.getDefault()),i}_validate(e,r={},i){let{sync:n,path:s,from:o=[],originalValue:a=e,strict:l=this.spec.strict,abortEarly:c=this.spec.abortEarly}=r,u=e;l||(u=this._cast(u,wn({assert:!1},r)));let g={value:u,path:s,options:r,originalValue:a,schema:this,label:this.spec.label,sync:n,from:o},f=[];this._typeError&&f.push(this._typeError),this._whitelistError&&f.push(this._whitelistError),this._blacklistError&&f.push(this._blacklistError),(0,GV.default)({args:g,value:u,path:s,sync:n,tests:f,endEarly:c},h=>{if(h)return void i(h,u);(0,GV.default)({tests:this.tests,args:g,path:s,sync:n,value:u,endEarly:c},i)})}validate(e,r,i){let n=this.resolve(wn({},r,{value:e}));return typeof i=="function"?n._validate(e,r,i):new Promise((s,o)=>n._validate(e,r,(a,l)=>{a?o(a):s(l)}))}validateSync(e,r){let i=this.resolve(wn({},r,{value:e})),n;return i._validate(e,wn({},r,{sync:!0}),(s,o)=>{if(s)throw s;n=o}),n}isValid(e,r){return this.validate(e,r).then(()=>!0,i=>{if(JV.default.isError(i))return!1;throw i})}isValidSync(e,r){try{return this.validateSync(e,r),!0}catch(i){if(JV.default.isError(i))return!1;throw i}}_getDefault(){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this):(0,jV.default)(e)}getDefault(e){return this.resolve(e||{})._getDefault()}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){var r=this.clone();return r.spec.strict=e,r}_isPresent(e){return e!=null}defined(e=du.mixed.defined){return this.test({message:e,name:"defined",exclusive:!0,test(r){return r!==void 0}})}required(e=du.mixed.required){return this.clone({presence:"required"}).withMutation(r=>r.test({message:e,name:"required",exclusive:!0,test(i){return this.schema._isPresent(i)}}))}notRequired(){var e=this.clone({presence:"optional"});return e.tests=e.tests.filter(r=>r.OPTIONS.name!=="required"),e}nullable(e=!0){var r=this.clone({nullable:e!==!1});return r}transform(e){var r=this.clone();return r.transforms.push(e),r}test(...e){let r;if(e.length===1?typeof e[0]=="function"?r={test:e[0]}:r=e[0]:e.length===2?r={name:e[0],test:e[1]}:r={name:e[0],message:e[1],test:e[2]},r.message===void 0&&(r.message=du.mixed.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let i=this.clone(),n=(0,Ry.default)(r),s=r.exclusive||r.name&&i.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(i.exclusiveTests[r.name]=!!r.exclusive),i.tests=i.tests.filter(o=>!(o.OPTIONS.name===r.name&&(s||o.OPTIONS.test===n.OPTIONS.test))),i.tests.push(n),i}when(e,r){!Array.isArray(e)&&typeof e!="string"&&(r=e,e=".");let i=this.clone(),n=(0,nMe.default)(e).map(s=>new rMe.default(s));return n.forEach(s=>{s.isSibling&&i.deps.push(s.key)}),i.conditions.push(new tMe.default(n,r)),i}typeError(e){var r=this.clone();return r._typeError=(0,Ry.default)({message:e,name:"typeError",test(i){return i!==void 0&&!this.schema.isType(i)?this.createError({params:{type:this.schema._type}}):!0}}),r}oneOf(e,r=du.mixed.oneOf){var i=this.clone();return e.forEach(n=>{i._whitelist.add(n),i._blacklist.delete(n)}),i._whitelistError=(0,Ry.default)({message:r,name:"oneOf",test(n){if(n===void 0)return!0;let s=this.schema._whitelist;return s.has(n,this.resolve)?!0:this.createError({params:{values:s.toArray().join(", ")}})}}),i}notOneOf(e,r=du.mixed.notOneOf){var i=this.clone();return e.forEach(n=>{i._blacklist.add(n),i._whitelist.delete(n)}),i._blacklistError=(0,Ry.default)({message:r,name:"notOneOf",test(n){let s=this.schema._blacklist;return s.has(n,this.resolve)?this.createError({params:{values:s.toArray().join(", ")}}):!0}}),i}strip(e=!0){let r=this.clone();return r.spec.strip=e,r}describe(){let e=this.clone(),{label:r,meta:i}=e.spec;return{meta:i,label:r,type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(s=>({name:s.OPTIONS.name,params:s.OPTIONS.params})).filter((s,o,a)=>a.findIndex(l=>l.name===s.name)===o)}}};Fy.default=ms;ms.prototype.__isYupSchema__=!0;for(let t of["validate","validateSync"])ms.prototype[`${t}At`]=function(e,r,i={}){let{parent:n,parentPath:s,schema:o}=(0,iMe.getIn)(this,e,r,i.context);return o[t](n&&n[s],wn({},i,{parent:n,path:e}))};for(let t of["equals","is"])ms.prototype[t]=ms.prototype.oneOf;for(let t of["not","nope"])ms.prototype[t]=ms.prototype.notOneOf;ms.prototype.optional=ms.prototype.notRequired});var VV=C(Zh=>{"use strict";Object.defineProperty(Zh,"__esModule",{value:!0});Zh.create=zV;Zh.default=void 0;var oMe=sMe(po());function sMe(t){return t&&t.__esModule?t:{default:t}}var Sv=oMe.default,aMe=Sv;Zh.default=aMe;function zV(){return new Sv}zV.prototype=Sv.prototype});var Cu=C(Ny=>{"use strict";Object.defineProperty(Ny,"__esModule",{value:!0});Ny.default=void 0;var AMe=t=>t==null;Ny.default=AMe});v
Line truncated
|
||||
`),c=o.length;for(c>0&&o.includes("unstyle")&&(o=[...new Set(["unstyle",...o])].reverse());c-- >0;)a=r(t.styles[o[c]],a,l);return a},n=(s,o,a)=>{t.styles[s]=e({name:s,codes:o}),(t.keys[a]||(t.keys[a]=[])).push(s),Reflect.defineProperty(t,s,{configurable:!0,enumerable:!0,set(c){t.alias(s,c)},get(){let c=u=>i(u,c.stack);return Reflect.setPrototypeOf(c,t),c.stack=this.stack?this.stack.concat(s):[s],c}})};return n("reset",[0,0],"modifier"),n("bold",[1,22],"modifier"),n("dim",[2,22],"modifier"),n("italic",[3,23],"modifier"),n("underline",[4,24],"modifier"),n("inverse",[7,27],"modifier"),n("hidden",[8,28],"modifier"),n("strikethrough",[9,29],"modifier"),n("black",[30,39],"color"),n("red",[31,39],"color"),n("green",[32,39],"color"),n("yellow",[33,39],"color"),n("blue",[34,39],"color"),n("magenta",[35,39],"color"),n("cyan",[36,39],"color"),n("white",[37,39],"color"),n("gray",[90,39],"color"),n("grey",[90,39],"color"),n("bgBlack",[40,49],"bg"),n("bgRed",[41,49],"bg"),n("bgGreen",[42,49],"bg"),n("bgYellow",[43,49],"bg"),n("bgBlue",[44,49],"bg"),n("bgMagenta",[45,49],"bg"),n("bgCyan",[46,49],"bg"),n("bgWhite",[47,49],"bg"),n("blackBright",[90,39],"bright"),n("redBright",[91,39],"bright"),n("greenBright",[92,39],"bright"),n("yellowBright",[93,39],"bright"),n("blueBright",[94,39],"bright"),n("magentaBright",[95,39],"bright"),n("cyanBright",[96,39],"bright"),n("whiteBright",[97,39],"bright"),n("bgBlackBright",[100,49],"bgBright"),n("bgRedBright",[101,49],"bgBright"),n("bgGreenBright",[102,49],"bgBright"),n("bgYellowBright",[103,49],"bgBright"),n("bgBlueBright",[104,49],"bgBright"),n("bgMagentaBright",[105,49],"bgBright"),n("bgCyanBright",[106,49],"bgBright"),n("bgWhiteBright",[107,49],"bgBright"),t.ansiRegex=yOe,t.hasColor=t.hasAnsi=s=>(t.ansiRegex.lastIndex=0,typeof s=="string"&&s!==""&&t.ansiRegex.test(s)),t.alias=(s,o)=>{let a=typeof o=="string"?t[o]:o;if(typeof a!="function")throw new TypeError("Expected alias to be the name of an existing color (string) or a function");a.stack||(Reflect.defineProperty(a,"name",{value:s}),t.styles[s]=a,a.stack=[s]),Reflect.defineProperty(t,s,{configurable:!0,enumerable:!0,set(l){t.alias(s,l)},get(){let l=c=>i(c,l.stack);return Reflect.setPrototypeOf(l,t),l.stack=this.stack?this.stack.concat(a.stack):a.stack,l}})},t.theme=s=>{if(!EOe(s))throw new TypeError("Expected theme to be an object");for(let o of Object.keys(s))t.alias(o,s[o]);return t},t.alias("unstyle",s=>typeof s=="string"&&s!==""?(t.ansiRegex.lastIndex=0,s.replace(t.ansiRegex,"")):""),t.alias("noop",s=>s),t.none=t.clear=t.noop,t.stripColor=t.unstyle,t.symbols=bZ(),t.define=n,t};jv.exports=DZ();jv.exports.create=DZ});var $r=C(ht=>{"use strict";var BOe=Object.prototype.toString,Qn=Yn(),SZ=!1,Gv=[],xZ={yellow:"blue",cyan:"red",green:"magenta",black:"white",blue:"yellow",red:"cyan",magenta:"green",white:"black"};ht.longest=(t,e)=>t.reduce((r,i)=>Math.max(r,e?i[e].length:i.length),0);ht.hasColor=t=>!!t&&Qn.hasColor(t);var Gy=ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);ht.nativeType=t=>BOe.call(t).slice(8,-1).toLowerCase().replace(/\s/g,"");ht.isAsyncFn=t=>ht.nativeType(t)==="asyncfunction";ht.isPrimitive=t=>t!=null&&typeof t!="object"&&typeof t!="function";ht.resolve=(t,e,...r)=>typeof e=="function"?e.call(t,...r):e;ht.scrollDown=(t=[])=>[...t.slice(1),t[0]];ht.scrollUp=(t=[])=>[t.pop(),...t];ht.reorder=(t=[])=>{let e=t.slice();return e.sort((r,i)=>r.index>i.index?1:r.index<i.index?-1:0),e};ht.swap=(t,e,r)=>{let i=t.length,n=r===i?0:r<0?i-1:r,s=t[e];t[e]=t[n],t[n]=s};ht.width=(t,e=80)=>{let r=t&&t.columns?t.columns:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[0]),process.platform==="win32"?r-1:r};ht.height=(t,e=20)=>{let r=t&&t.rows?t.rows:e;return t&&typeof t.getWindowSize=="function"&&(r=t.getWindowSize()[1]),r};ht.wordWrap=(t,e={})=>{if(!t)return t;typeof e=="number"&&(e={width:e});let{indent:r="",newline:i=`
|
||||
`+r,width:n=80}=e;n-=((i+r).match(/[^\S\n]/g)||[]).length;let o=`.{1,${n}}([\\s\\u200B]+|$)|[^\\s\\u200B]+?([\\s\\u200B]+|$)`,a=t.trim(),l=new RegExp(o,"g"),c=a.match(l)||[];return c=c.map(u=>u.replace(/\n$/,"")),e.padEnd&&(c=c.map(u=>u.padEnd(n," "))),e.padStart&&(c=c.map(u=>u.padStart(n," "))),r+c.join(i)};ht.unmute=t=>{let e=t.stack.find(i=>Qn.keys.color.includes(i));return e?Qn[e]:t.stack.find(i=>i.slice(2)==="bg")?Qn[e.slice(2)]:i=>i};ht.pascal=t=>t?t[0].toUpperCase()+t.slice(1):"";ht.inverse=t=>{if(!t||!t.stack)return t;let e=t.stack.find(i=>Qn.keys.color.includes(i));if(e){let i=Qn["bg"+ht.pascal(e)];return i?i.black:t}let r=t.stack.find(i=>i.slice(0,2)==="bg");return r?Qn[r.slice(2).toLowerCase()]||t:Qn.none};ht.complement=t=>{if(!t||!t.stack)return t;let e=t.stack.find(i=>Qn.keys.color.includes(i)),r=t.stack.find(i=>i.slice(0,2)==="bg");if(e&&!r)return Qn[xZ[e]||e];if(r){let i=r.slice(2).toLowerCase(),n=xZ[i];return n&&Qn["bg"+ht.pascal(n)]||t}return Qn.none};ht.meridiem=t=>{let e=t.getHours(),r=t.getMinutes(),i=e>=12?"pm":"am";e=e%12;let n=e===0?12:e,s=r<10?"0"+r:r;return n+":"+s+" "+i};ht.set=(t={},e="",r)=>e.split(".").reduce((i,n,s,o)=>{let a=o.length-1>s?i[n]||{}:r;return!ht.isObject(a)&&s<o.length-1&&(a={}),i[n]=a},t);ht.get=(t={},e="",r)=>{let i=t[e]==null?e.split(".").reduce((n,s)=>n&&n[s],t):t[e];return i==null?r:i};ht.mixin=(t,e)=>{if(!Gy(t))return e;if(!Gy(e))return t;for(let r of Object.keys(e)){let i=Object.getOwnPropertyDescriptor(e,r);if(i.hasOwnProperty("value"))if(t.hasOwnProperty(r)&&Gy(i.value)){let n=Object.getOwnPropertyDescriptor(t,r);Gy(n.value)?t[r]=ht.merge({},t[r],e[r]):Reflect.defineProperty(t,r,i)}else Reflect.defineProperty(t,r,i);else Reflect.defineProperty(t,r,i)}return t};ht.merge=(...t)=>{let e={};for(let r of t)ht.mixin(e,r);return e};ht.mixinEmitter=(t,e)=>{let r=e.constructor.prototype;for(let i of Object.keys(r)){let n=r[i];typeof n=="function"?ht.define(t,i,n.bind(e)):ht.define(t,i,n)}};ht.onExit=t=>{let e=(r,i)=>{SZ||(SZ=!0,Gv.forEach(n=>n()),r===!0&&process.exit(128+i))};Gv.length===0&&(process.once("SIGTERM",e.bind(null,!0,15)),process.once("SIGINT",e.bind(null,!0,2)),process.once("exit",e)),Gv.push(t)};ht.define=(t,e,r)=>{Reflect.defineProperty(t,e,{value:r})};ht.defineExport=(t,e,r)=>{let i;Reflect.defineProperty(t,e,{enumerable:!0,configurable:!0,set(n){i=n},get(){return i?i():r()}})}});var kZ=C(Bu=>{"use strict";Bu.ctrl={a:"first",b:"backward",c:"cancel",d:"deleteForward",e:"last",f:"forward",g:"reset",i:"tab",k:"cutForward",l:"reset",n:"newItem",m:"cancel",j:"submit",p:"search",r:"remove",s:"save",u:"undo",w:"cutLeft",x:"toggleCursor",v:"paste"};Bu.shift={up:"shiftUp",down:"shiftDown",left:"shiftLeft",right:"shiftRight",tab:"prev"};Bu.fn={up:"pageUp",down:"pageDown",left:"pageLeft",right:"pageRight",delete:"deleteForward"};Bu.option={b:"backward",f:"forward",d:"cutRight",left:"cutLeft",up:"altUp",down:"altDown"};Bu.keys={pageup:"pageUp",pagedown:"pageDown",home:"home",end:"end",cancel:"cancel",delete:"deleteForward",backspace:"delete",down:"down",enter:"submit",escape:"cancel",left:"left",space:"space",number:"number",return:"submit",right:"right",tab:"next",up:"up"}});var FZ=C((hot,vZ)=>{"use strict";var PZ=require("readline"),wOe=kZ(),QOe=/^(?:\x1b)([a-zA-Z0-9])$/,bOe=/^(?:\x1b+)(O|N|\[|\[\[)(?:(\d+)(?:;(\d+))?([~^$])|(?:1;)?(\d+)?([a-zA-Z]))/,DOe={OP:"f1",OQ:"f2",OR:"f3",OS:"f4","[11~":"f1","[12~":"f2","[13~":"f3","[14~":"f4","[[A":"f1","[[B":"f2","[[C":"f3","[[D":"f4","[[E":"f5","[15~":"f5","[17~":"f6","[18~":"f7","[19~":"f8","[20~":"f9","[21~":"f10","[23~":"f11","[24~":"f12","[A":"up","[B":"down","[C":"right","[D":"left","[E":"clear","[F":"end","[H":"home",OA:"up",OB:"down",OC:"right",OD:"left",OE:"clear",OF:"end",OH:"home","[1~":"home","[2~":"insert","[3~":"delete","[4~":"end","[5~":"pageup","[6~":"pagedown","[[5~":"pageup","[[6~":"pagedown","[7~":"home","[8~":"end","[a":"up","[b":"down","[c":"right","[d":"left","[e":"clear","[2$":"insert","[3$":"delete","[5$":"pageup","[6$":"pagedown","[7$":"home","[8$":"end",Oa:"up",Ob:"down",Oc:"right",Od:"left",Oe:"clear","[2^":"insert","[3^":"delete","[5^":"pageup","[6^":"pagedown","[7^":"home","[8^":"end","[Z":"tab"};function SOe(t){return["[a","[b","[c","[d","[e","[2$","[3$","[5$","[6$","[7$","[8$","[Z"].includes(t)}function xOe(t){return["Oa","Ob","Oc","Od","Oe","[2^","[3^","[5^","[6^","[7^","[8^"].includes(t)}var qy=(t="",e={})=>{let r,i=v({name:e.name,ctrl:!1,meta:!1,shift:!1,option:!1,sequence:t,raw:t},e);if(Buffer.isBuffer(t)?t[0]>127&&t[1]===void 0?(t[0]-=128,t=""+String(t)):t=String(t):t!==void 0&&typeof t!="string"?t=String(t):t||(t=i.sequence||""),i.sequence=i.sequence||t||i.name,t==="\r")i.raw=void 0,i.name="return";else if(t===`
|
||||
`)i.name="enter";else if(t===" ")i.name="tab";else if(t==="\b"||t==="\x7F"||t==="\x7F"||t==="\b")i.name="backspace",i.meta=t.charAt(0)==="";else if(t===""||t==="")i.name="escape",i.meta=t.length===2;else if(t===" "||t===" ")i.name="space",i.meta=t.length===2;else if(t<="")i.name=String.fromCharCode(t.charCodeAt(0)+"a".charCodeAt(0)-1),i.ctrl=!0;else if(t.length===1&&t>="0"&&t<="9")i.name="number";else if(t.length===1&&t>="a"&&t<="z")i.name=t;else if(t.length===1&&t>="A"&&t<="Z")i.name=t.toLowerCase(),i.shift=!0;else if(r=QOe.exec(t))i.meta=!0,i.shift=/^[A-Z]$/.test(r[1]);else if(r=bOe.exec(t)){let n=[...t];n[0]===""&&n[1]===""&&(i.option=!0);let s=[r[1],r[2],r[4],r[6]].filter(Boolean).join(""),o=(r[3]||r[5]||1)-1;i.ctrl=!!(o&4),i.meta=!!(o&10),i.shift=!!(o&1),i.code=s,i.name=DOe[s],i.shift=SOe(s)||i.shift,i.ctrl=xOe(s)||i.ctrl}return i};qy.listen=(t={},e)=>{let{stdin:r}=t;if(!r||r!==process.stdin&&!r.isTTY)throw new Error("Invalid stream passed");let i=PZ.createInterface({terminal:!0,input:r});PZ.emitKeypressEvents(r,i);let n=(a,l)=>e(a,qy(a,l),i),s=r.isRaw;return r.isTTY&&r.setRawMode(!0),r.on("keypress",n),i.resume(),()=>{r.isTTY&&r.setRawMode(s),r.removeListener("keypress",n),i.pause(),i.close()}};qy.action=(t,e,r)=>{let i=v(v({},wOe),r);return e.ctrl?(e.action=i.ctrl[e.name],e):e.option&&i.option?(e.action=i.option[e.name],e):e.shift?(e.action=i.shift[e.name],e):(e.action=i.keys[e.name],e)};vZ.exports=qy});var NZ=C((pot,RZ)=>{"use strict";RZ.exports=t=>{t.timers=t.timers||{};let e=t.options.timers;if(!!e)for(let r of Object.keys(e)){let i=e[r];typeof i=="number"&&(i={interval:i}),kOe(t,r,i)}};function kOe(t,e,r={}){let i=t.timers[e]={name:e,start:Date.now(),ms:0,tick:0},n=r.interval||120;i.frames=r.frames||[],i.loading=!0;let s=setInterval(()=>{i.ms=Date.now()-i.start,i.tick++,t.render()},n);return i.stop=()=>{i.loading=!1,clearInterval(s)},Reflect.defineProperty(i,"interval",{value:s}),t.once("close",()=>i.stop()),i.stop}});var TZ=C((dot,LZ)=>{"use strict";var{define:vOe,width:POe}=$r(),MZ=class{constructor(e){let r=e.options;vOe(this,"_prompt",e),this.type=e.type,this.name=e.name,this.message="",this.header="",this.footer="",this.error="",this.hint="",this.input="",this.cursor=0,this.index=0,this.lines=0,this.tick=0,this.prompt="",this.buffer="",this.width=POe(r.stdout||process.stdout),Object.assign(this,r),this.name=this.name||this.message,this.message=this.message||this.name,this.symbols=e.symbols,this.styles=e.styles,this.required=new Set,this.cancelled=!1,this.submitted=!1}clone(){let e=v({},this);return e.status=this.status,e.buffer=Buffer.from(e.buffer),delete e.clone,e}set color(e){this._color=e}get color(){let e=this.prompt.styles;if(this.cancelled)return e.cancelled;if(this.submitted)return e.submitted;let r=this._color||e[this.status];return typeof r=="function"?r:e.pending}set loading(e){this._loading=e}get loading(){return typeof this._loading=="boolean"?this._loading:this.loadingChoices?"choices":!1}get status(){return this.cancelled?"cancelled":this.submitted?"submitted":"pending"}};LZ.exports=MZ});var KZ=C((Cot,OZ)=>{"use strict";var qv=$r(),Ur=Yn(),Jv={default:Ur.noop,noop:Ur.noop,set inverse(t){this._inverse=t},get inverse(){return this._inverse||qv.inverse(this.primary)},set complement(t){this._complement=t},get complement(){return this._complement||qv.complement(this.primary)},primary:Ur.cyan,success:Ur.green,danger:Ur.magenta,strong:Ur.bold,warning:Ur.yellow,muted:Ur.dim,disabled:Ur.gray,dark:Ur.dim.gray,underline:Ur.underline,set info(t){this._info=t},get info(){return this._info||this.primary},set em(t){this._em=t},get em(){return this._em||this.primary.underline},set heading(t){this._heading=t},get heading(){return this._heading||this.muted.underline},set pending(t){this._pending=t},get pending(){return this._pending||this.primary},set submitted(t){this._submitted=t},get submitted(){return this._submitted||this.success},set cancelled(t){this._cancelled=t},get cancelled(){return this._cancelled||this.danger},set typing(t){this._typing=t},get typing(){return this._typing||this.dim},set placeholder(t){this._placeholder=t},get placeholder(){return this._placeholder||this.primary.dim},set highlight(t){this._highlight=t},get highlight(){return this._highlight||this.inverse}};Jv.merge=(t={})=>{t.styles&&typeof t.styles.enabled=="boolean"&&(Ur.enabled=t.styles.enabled),t.styles&&typeof t.styles.visible=="boolean"&&(Ur.visible=t.styles.visible);let e=qv.merge({},Jv,t.styles);delete e.merge;for(let r of Object.keys(Ur))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>Ur[r]});for(let r of Object.keys(Ur.styles))e.hasOwnProperty(r)||Reflect.defineProperty(e,r,{get:()=>Ur[r]});return e};OZ.exports=Jv});var HZ=C((mot,UZ)=>{"use strict";var Wv=process.platform==="win32",mo=Yn(),FOe=$r(),zv=V(v({},mo.symbols),{upDownDoubleArrow:"\u21D5",upDownDoubleArrow2:"\u2B0D",upDownArrow:"\u2195",asterisk:"*",asterism:"\u2042",bulletWhite:"\u25E6",electricArrow:"\u2301",ellipsisLarge:"\uLine truncated
|
||||
`),c=l[0],u=l[l.length-1],f=(i+(r?" "+r:"")).length,h=f<c.length?c.slice(f+1):"";return{header:o,prompt:c,after:h,rest:l.slice(1),last:u}}async submit(){this.state.submitted=!0,this.state.validating=!0,this.options.onSubmit&&await this.options.onSubmit.call(this,this.name,this.value,this);let e=this.state.error||await this.validate(this.value,this.state);if(e!==!0){let r=`
|
||||
`+this.symbols.pointer+" ";typeof e=="string"?r+=e.trim():r+="Invalid input",this.state.error=`
|
||||
`+this.styles.danger(r),this.state.submitted=!1,await this.render(),await this.alert(),this.state.validating=!1,this.state.error=void 0;return}this.state.validating=!1,await this.render(),await this.close(),this.value=await this.result(this.value),this.emit("submit",this.value)}async cancel(e){this.state.cancelled=this.state.submitted=!0,await this.render(),await this.close(),typeof this.options.onCancel=="function"&&await this.options.onCancel.call(this,this.name,this.value,this),this.emit("cancel",await this.error(e))}async close(){this.state.closed=!0;try{let e=this.sections(),r=Math.ceil(e.prompt.length/this.width);e.rest&&this.write(al.cursor.down(e.rest.length)),this.write(`
|
||||
`.repeat(r))}catch(e){}this.emit("close")}start(){!this.stop&&this.options.show!==!1&&(this.stop=_v.listen(this,this.keypress.bind(this)),this.once("close",this.stop))}async skip(){return this.skipped=this.options.skip===!0,typeof this.options.skip=="function"&&(this.skipped=await this.options.skip.call(this,this.name,this.value)),this.skipped}async initialize(){let{format:e,options:r,result:i}=this;if(this.format=()=>e.call(this,this.value),this.result=()=>i.call(this,this.value),typeof r.initial=="function"&&(this.initial=await r.initial.call(this,this)),typeof r.onRun=="function"&&await r.onRun.call(this,this),typeof r.onSubmit=="function"){let n=r.onSubmit.bind(this),s=this.submit.bind(this);delete this.options.onSubmit,this.submit=async()=>(await n(this.name,this.value,this),s())}await this.start(),await this.render()}render(){throw new Error("expected prompt to have a custom render method")}run(){return new Promise(async(e,r)=>{if(this.once("submit",e),this.once("cancel",r),await this.skip())return this.render=()=>{},this.submit();await this.initialize(),this.emit("run")})}async element(e,r,i){let{options:n,state:s,symbols:o,timers:a}=this,l=a&&a[e];s.timer=l;let c=n[e]||s[e]||o[e],u=r&&r[e]!=null?r[e]:await c;if(u==="")return u;let g=await this.resolve(u,s,r,i);return!g&&r&&r[e]?this.resolve(c,s,r,i):g}async prefix(){let e=await this.element("prefix")||this.symbols,r=this.timers&&this.timers.prefix,i=this.state;return i.timer=r,Ri.isObject(e)&&(e=e[i.status]||e.pending),Ri.hasColor(e)?e:(this.styles[i.status]||this.styles.pending)(e)}async message(){let e=await this.element("message");return Ri.hasColor(e)?e:this.styles.strong(e)}async separator(){let e=await this.element("separator")||this.symbols,r=this.timers&&this.timers.separator,i=this.state;i.timer=r;let n=e[i.status]||e.pending||i.separator,s=await this.resolve(n,i);return Ri.isObject(s)&&(s=s[i.status]||s.pending),Ri.hasColor(s)?s:this.styles.muted(s)}async pointer(e,r){let i=await this.element("pointer",e,r);if(typeof i=="string"&&Ri.hasColor(i))return i;if(i){let n=this.styles,s=this.index===r,o=s?n.primary:c=>c,a=await this.resolve(i[s?"on":"off"]||i,this.state),l=Ri.hasColor(a)?a:o(a);return s?l:" ".repeat(a.length)}}async indicator(e,r){let i=await this.element("indicator",e,r);if(typeof i=="string"&&Ri.hasColor(i))return i;if(i){let n=this.styles,s=e.enabled===!0,o=s?n.success:n.dark,a=i[s?"on":"off"]||i;return Ri.hasColor(a)?a:o(a)}return""}body(){return null}footer(){if(this.state.status==="pending")return this.element("footer")}header(){if(this.state.status==="pending")return this.element("header")}async hint(){if(this.state.status==="pending"&&!this.isValue(this.state.input)){let e=await this.element("hint");return Ri.hasColor(e)?e:this.styles.muted(e)}}error(e){return this.state.submitted?"":e||this.state.error}format(e){return e}result(e){return e}validate(e){return this.options.required===!0?this.isValue(e):!0}isValue(e){return e!=null&&e!==""}resolve(e,...r){return Ri.resolve(this,e,...r)}get base(){return Jy.prototype}get style(){return this.styles[this.state.status]}get height(){return this.options.rows||Ri.height(this.stdout,25)}get width(){return this.options.columns||Ri.width(this.stdout,80)}get size(){return{width:this.width,height:this.height}}set cursor(e){this.state.cursor=e}get cursor(){return this.state.cursor}set input(e){this.state.input=e}get input(){return this.state.input}set value(e){this.state.value=e}get value(){let{input:e,value:r}=this.state,i=[r,e].find(this.isValue.bind(this));return this.isValue(i)?i:this.initial}static get prompt(){return e=>new this(e).run()}};function HOe(t){let e=n=>t[n]===void 0||typeof t[n]=="function",r=["actions","choices","initial","margin","roles","styles","symbols","theme","timers","value"],i=["body","footer","error","header","hint","indicator","message","prefix","separator","skip"];for(let n of Object.keys(t.options)){if(r.includes(n)||/^on[A-Z]/.test(n))continue;let s=t.options[n];typeof s=="function"&&e(n)?i.includes(n)||(t[n]=s.bind(t)):typeof t[n]!="function"&&(t[n]=s)}}function YOe(t){typeof t=="number"&&(t=[t,t,t,t]);let e=[].concat(t||[]),r=n=>n%2==0?`
|
||||
`:" ",i=[];for(let n=0;n<4;n++){let s=r(n);e[n]?i.push(s.repeat(e[n])):i.push("")}return i}VZ.exports=Jy});var $Z=C((yot,ZZ)=>{"use strict";var jOe=$r(),_Z={default(t,e){return e},checkbox(t,e){throw new Error("checkbox role is not implemented yet")},editable(t,e){throw new Error("editable role is not implemented yet")},expandable(t,e){throw new Error("expandable role is not implemented yet")},heading(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||"",e},input(t,e){throw new Error("input role is not implemented yet")},option(t,e){return _Z.default(t,e)},radio(t,e){throw new Error("radio role is not implemented yet")},separator(t,e){return e.disabled="",e.indicator=[e.indicator," "].find(r=>r!=null),e.message=e.message||t.symbols.line.repeat(5),e},spacer(t,e){return e}};ZZ.exports=(t,e={})=>{let r=jOe.merge({},_Z,e.roles);return r[t]||r.default}});var lp=C((Bot,e_)=>{"use strict";var GOe=Yn(),qOe=wu(),JOe=$Z(),Wy=$r(),{reorder:$v,scrollUp:WOe,scrollDown:zOe,isObject:t_,swap:VOe}=Wy,r_=class extends qOe{constructor(e){super(e);this.cursorHide(),this.maxSelected=e.maxSelected||Infinity,this.multiple=e.multiple||!1,this.initial=e.initial||0,this.delay=e.delay||0,this.longest=0,this.num=""}async initialize(){typeof this.options.initial=="function"&&(this.initial=await this.options.initial.call(this)),await this.reset(!0),await super.initialize()}async reset(){let{choices:e,initial:r,autofocus:i,suggest:n}=this.options;if(this.state._choices=[],this.state.choices=[],this.choices=await Promise.all(await this.toChoices(e)),this.choices.forEach(s=>s.enabled=!1),typeof n!="function"&&this.selectable.length===0)throw new Error("At least one choice must be selectable");t_(r)&&(r=Object.keys(r)),Array.isArray(r)?(i!=null&&(this.index=this.findIndex(i)),r.forEach(s=>this.enable(this.find(s))),await this.render()):(i!=null&&(r=i),typeof r=="string"&&(r=this.findIndex(r)),typeof r=="number"&&r>-1&&(this.index=Math.max(0,Math.min(r,this.choices.length)),this.enable(this.find(this.index)))),this.isDisabled(this.focused)&&await this.down()}async toChoices(e,r){this.state.loadingChoices=!0;let i=[],n=0,s=async(o,a)=>{typeof o=="function"&&(o=await o.call(this)),o instanceof Promise&&(o=await o);for(let l=0;l<o.length;l++){let c=o[l]=await this.toChoice(o[l],n++,a);i.push(c),c.choices&&await s(c.choices,c)}return i};return s(e,r).then(o=>(this.state.loadingChoices=!1,o))}async toChoice(e,r,i){if(typeof e=="function"&&(e=await e.call(this,this)),e instanceof Promise&&(e=await e),typeof e=="string"&&(e={name:e}),e.normalized)return e;e.normalized=!0;let n=e.value;if(e=JOe(e.role,this.options)(this,e),typeof e.disabled=="string"&&!e.hint&&(e.hint=e.disabled,e.disabled=!0),e.disabled===!0&&e.hint==null&&(e.hint="(disabled)"),e.index!=null)return e;e.name=e.name||e.key||e.title||e.value||e.message,e.message=e.message||e.name||"",e.value=[e.value,e.name].find(this.isValue.bind(this)),e.input="",e.index=r,e.cursor=0,Wy.define(e,"parent",i),e.level=i?i.level+1:1,e.indent==null&&(e.indent=i?i.indent+" ":e.indent||""),e.path=i?i.path+"."+e.name:e.name,e.enabled=!!(this.multiple&&!this.isDisabled(e)&&(e.enabled||this.isSelected(e))),this.isDisabled(e)||(this.longest=Math.max(this.longest,GOe.unstyle(e.message).length));let o=v({},e);return e.reset=(a=o.input,l=o.value)=>{for(let c of Object.keys(o))e[c]=o[c];e.input=a,e.value=l},n==null&&typeof e.initial=="function"&&(e.input=await e.initial.call(this,this.state,e,r)),e}async onChoice(e,r){this.emit("choice",e,r,this),typeof e.onChoice=="function"&&await e.onChoice.call(this,this.state,e,r)}async addChoice(e,r,i){let n=await this.toChoice(e,r,i);return this.choices.push(n),this.index=this.choices.length-1,this.limit=this.choices.length,n}async newItem(e,r,i){let n=v({name:"New choice name?",editable:!0,newChoice:!0},e),s=await this.addChoice(n,r,i);return s.updateChoice=()=>{delete s.newChoice,s.name=s.message=s.input,s.input="",s.cursor=0},this.render()}indent(e){return e.indent==null?e.level>1?" ".repeat(e.level-1):"":e.indent}dispatch(e,r){if(this.multiple&&this[r.name])return this[r.name]();this.alert()}focus(e,r){return typeof r!="boolean"&&(r=e.enabled),r&&!e.enabled&&this.selected.length>=this.maxSelected?this.alert():(this.index=e.index,e.enabled=r&&!this.isDisabled(e),e)}space(){return this.multiple?(this.toggle(this.focused),this.render()):this.alert()}a(){if(this.maxSelected<this.choices.length)return this.alert();let e=this.selectable.every(r=>r.enabled);return this.choices.forEach(r=>r.enabled=!e),this.render()}i(){return this.choices.length-this.selected.length>this.maxSelected?this.alert():(this.choices.forEach(e=>e.enabled=!e.enabled),this.render())}g(e=this.focused){return this.choices.some(r=>!!r.parent)?(this.toggle(e.parent&&!e.choices?e.parent:e),this.render()):this.a()}toggle(e,r){if(!e.enabled&&this.selected.length>=this.maxSelected)return this.alert();typeof r!="boolean"&&(r=!e.enabled),e.enabled=r,e.choices&&e.choic
Line truncated
|
||||
`),n;return this.options.choicesHeader&&(n=await this.resolve(this.options.choicesHeader,this.state)),[n,i].filter(Boolean).join(`
|
||||
`)}format(){return!this.state.submitted||this.state.cancelled?"":Array.isArray(this.selected)?this.selected.map(e=>this.styles.primary(e.name)).join(", "):this.styles.primary(this.selected.name)}async render(){let{submitted:e,size:r}=this.state,i="",n=await this.header(),s=await this.prefix(),o=await this.separator(),a=await this.message();this.options.promptLine!==!1&&(i=[s,a,o,""].join(" "),this.state.prompt=i);let l=await this.format(),c=await this.error()||await this.hint(),u=await this.renderChoices(),g=await this.footer();l&&(i+=l),c&&!i.includes(c)&&(i+=" "+c),e&&!l&&!u.trim()&&this.multiple&&this.emptyError!=null&&(i+=this.styles.danger(this.emptyError)),this.clear(r),this.write([n,i,u,g].filter(Boolean).join(`
|
||||
`)),this.write(this.margin[2]),this.restore()}};n_.exports=s_});var A_=C((Qot,o_)=>{"use strict";var ZOe=Ea(),_Oe=(t,e)=>{let r=t.toLowerCase();return i=>{let s=i.toLowerCase().indexOf(r),o=e(i.slice(s,s+r.length));return s>=0?i.slice(0,s)+o+i.slice(s+r.length):i}},a_=class extends ZOe{constructor(e){super(e);this.cursorShow()}moveCursor(e){this.state.cursor+=e}dispatch(e){return this.append(e)}space(e){return this.options.multiple?super.space(e):this.append(e)}append(e){let{cursor:r,input:i}=this.state;return this.input=i.slice(0,r)+e+i.slice(r),this.moveCursor(1),this.complete()}delete(){let{cursor:e,input:r}=this.state;return r?(this.input=r.slice(0,e-1)+r.slice(e),this.moveCursor(-1),this.complete()):this.alert()}deleteForward(){let{cursor:e,input:r}=this.state;return r[e]===void 0?this.alert():(this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.complete())}number(e){return this.append(e)}async complete(){this.completing=!0,this.choices=await this.suggest(this.input,this.state._choices),this.state.limit=void 0,this.index=Math.min(Math.max(this.visible.length-1,0),this.index),await this.render(),this.completing=!1}suggest(e=this.input,r=this.state._choices){if(typeof this.options.suggest=="function")return this.options.suggest.call(this,e,r);let i=e.toLowerCase();return r.filter(n=>n.message.toLowerCase().includes(i))}pointer(){return""}format(){if(!this.focused)return this.input;if(this.options.multiple&&this.state.submitted)return this.selected.map(e=>this.styles.primary(e.message)).join(", ");if(this.state.submitted){let e=this.value=this.input=this.focused.value;return this.styles.primary(e)}return this.input}async render(){if(this.state.status!=="pending")return super.render();let e=this.options.highlight?this.options.highlight.bind(this):this.styles.placeholder,r=_Oe(this.input,e),i=this.choices;this.choices=i.map(n=>V(v({},n),{message:r(n.message)})),await super.render(),this.choices=i}submit(){return this.options.multiple&&(this.value=this.selected.map(e=>e.name)),super.submit()}};o_.exports=a_});var rP=C((bot,l_)=>{"use strict";var tP=$r();l_.exports=(t,e={})=>{t.cursorHide();let{input:r="",initial:i="",pos:n,showCursor:s=!0,color:o}=e,a=o||t.styles.placeholder,l=tP.inverse(t.styles.primary),c=m=>l(t.styles.black(m)),u=r,g=" ",f=c(g);if(t.blink&&t.blink.off===!0&&(c=m=>m,f=""),s&&n===0&&i===""&&r==="")return c(g);if(s&&n===0&&(r===i||r===""))return c(i[0])+a(i.slice(1));i=tP.isPrimitive(i)?`${i}`:"",r=tP.isPrimitive(r)?`${r}`:"";let h=i&&i.startsWith(r)&&i!==r,p=h?c(i[r.length]):f;if(n!==r.length&&s===!0&&(u=r.slice(0,n)+c(r[n])+r.slice(n+1),p=""),s===!1&&(p=""),h){let m=t.styles.unstyle(u+p);return u+p+a(i.slice(m.length))}return u+p}});var zy=C((Dot,c_)=>{"use strict";var $Oe=Yn(),eKe=Ea(),tKe=rP(),u_=class extends eKe{constructor(e){super(V(v({},e),{multiple:!0}));this.type="form",this.initial=this.options.initial,this.align=[this.options.align,"right"].find(r=>r!=null),this.emptyError="",this.values={}}async reset(e){return await super.reset(),e===!0&&(this._index=this.index),this.index=this._index,this.values={},this.choices.forEach(r=>r.reset&&r.reset()),this.render()}dispatch(e){return!!e&&this.append(e)}append(e){let r=this.focused;if(!r)return this.alert();let{cursor:i,input:n}=r;return r.value=r.input=n.slice(0,i)+e+n.slice(i),r.cursor++,this.render()}delete(){let e=this.focused;if(!e||e.cursor<=0)return this.alert();let{cursor:r,input:i}=e;return e.value=e.input=i.slice(0,r-1)+i.slice(r),e.cursor--,this.render()}deleteForward(){let e=this.focused;if(!e)return this.alert();let{cursor:r,input:i}=e;if(i[r]===void 0)return this.alert();let n=`${i}`.slice(0,r)+`${i}`.slice(r+1);return e.value=e.input=n,this.render()}right(){let e=this.focused;return e?e.cursor>=e.input.length?this.alert():(e.cursor++,this.render()):this.alert()}left(){let e=this.focused;return e?e.cursor<=0?this.alert():(e.cursor--,this.render()):this.alert()}space(e,r){return this.dispatch(e,r)}number(e,r){return this.dispatch(e,r)}next(){let e=this.focused;if(!e)return this.alert();let{initial:r,input:i}=e;return r&&r.startsWith(i)&&i!==r?(e.value=e.input=r,e.cursor=e.value.length,this.render()):super.next()}prev(){let e=this.focused;return e?e.cursor===0?super.prev():(e.value=e.input="",e.cursor=0,this.render()):this.alert()}separator(){return""}format(e){return this.state.submitted?"":super.format(e)}pointer(){return""}indicator(e){return e.input?"\u29BF":"\u2299"}async choiceSeparator(e,r){let i=await this.resolve(e.separator,this.state,e,r)||":";return i?" "+this.styles.disabled(i):""}async renderChoice(e,r){await this.onChoice(e,r);let{state:i,styles:n}=this,{cursor:s,initial:o="",name:a,hint:l,input:c=""}=e,{muted:u,submitted:g,primary:f,danger:h}=n,p=l,m=this.index===r,I=e.validate||(()=>!0),y=await this.choiceSeparator(e,r),B=e.message;this.align==="right"&&(B=B.padStart(this.longest+1," ")),this.align==="left"&&(B=B.padEnd(this.longest+1," "));let x=this.values[a]=c||o,F=c?"success":"dark";await I.call(e,x,thi
Line truncated
|
||||
`)),this.restore()}set value(e){super.value=e}get value(){return this.cast(super.value)}};C_.exports=m_});var y_=C((vot,I_)=>{"use strict";var lKe=Vy(),E_=class extends lKe{constructor(e){super(e);this.default=this.options.default||(this.initial?"(Y/n)":"(y/N)")}};I_.exports=E_});var Q_=C((Pot,B_)=>{"use strict";var cKe=Ea(),uKe=zy(),Qu=uKe.prototype,w_=class extends cKe{constructor(e){super(V(v({},e),{multiple:!0}));this.align=[this.options.align,"left"].find(r=>r!=null),this.emptyError="",this.values={}}dispatch(e,r){let i=this.focused,n=i.parent||{};return!i.editable&&!n.editable&&(e==="a"||e==="i")?super[e]():Qu.dispatch.call(this,e,r)}append(e,r){return Qu.append.call(this,e,r)}delete(e,r){return Qu.delete.call(this,e,r)}space(e){return this.focused.editable?this.append(e):super.space()}number(e){return this.focused.editable?this.append(e):super.number(e)}next(){return this.focused.editable?Qu.next.call(this):super.next()}prev(){return this.focused.editable?Qu.prev.call(this):super.prev()}async indicator(e,r){let i=e.indicator||"",n=e.editable?i:super.indicator(e,r);return await this.resolve(n,this.state,e,r)||""}indent(e){return e.role==="heading"?"":e.editable?" ":" "}async renderChoice(e,r){return e.indent="",e.editable?Qu.renderChoice.call(this,e,r):super.renderChoice(e,r)}error(){return""}footer(){return this.state.error}async validate(){let e=!0;for(let r of this.choices){if(typeof r.validate!="function"||r.role==="heading")continue;let i=r.parent?this.value[r.parent.name]:this.value;if(r.editable?i=r.value===r.name?r.initial||"":r.value:this.isDisabled(r)||(i=r.enabled===!0),e=await r.validate(i,this.state),e!==!0)break}return e!==!0&&(this.state.error=typeof e=="string"?e:"Invalid Input"),e}submit(){if(this.focused.newChoice===!0)return super.submit();if(this.choices.some(e=>e.newChoice))return this.alert();this.value={};for(let e of this.choices){let r=e.parent?this.value[e.parent.name]:this.value;if(e.role==="heading"){this.value[e.name]={};continue}e.editable?r[e.name]=e.value===e.name?e.initial||"":e.value:this.isDisabled(e)||(r[e.name]=e.enabled===!0)}return this.base.submit.call(this)}};B_.exports=w_});var Al=C((Fot,b_)=>{"use strict";var gKe=wu(),fKe=rP(),{isPrimitive:hKe}=$r(),D_=class extends gKe{constructor(e){super(e);this.initial=hKe(this.initial)?String(this.initial):"",this.initial&&this.cursorHide(),this.state.prevCursor=0,this.state.clipboard=[]}async keypress(e,r={}){let i=this.state.prevKeypress;return this.state.prevKeypress=r,this.options.multiline===!0&&r.name==="return"&&(!i||i.name!=="return")?this.append(`
|
||||
`,r):super.keypress(e,r)}moveCursor(e){this.cursor+=e}reset(){return this.input=this.value="",this.cursor=0,this.render()}dispatch(e,r){if(!e||r.ctrl||r.code)return this.alert();this.append(e)}append(e){let{cursor:r,input:i}=this.state;this.input=`${i}`.slice(0,r)+e+`${i}`.slice(r),this.moveCursor(String(e).length),this.render()}insert(e){this.append(e)}delete(){let{cursor:e,input:r}=this.state;if(e<=0)return this.alert();this.input=`${r}`.slice(0,e-1)+`${r}`.slice(e),this.moveCursor(-1),this.render()}deleteForward(){let{cursor:e,input:r}=this.state;if(r[e]===void 0)return this.alert();this.input=`${r}`.slice(0,e)+`${r}`.slice(e+1),this.render()}cutForward(){let e=this.cursor;if(this.input.length<=e)return this.alert();this.state.clipboard.push(this.input.slice(e)),this.input=this.input.slice(0,e),this.render()}cutLeft(){let e=this.cursor;if(e===0)return this.alert();let r=this.input.slice(0,e),i=this.input.slice(e),n=r.split(" ");this.state.clipboard.push(n.pop()),this.input=n.join(" "),this.cursor=this.input.length,this.input+=i,this.render()}paste(){if(!this.state.clipboard.length)return this.alert();this.insert(this.state.clipboard.pop()),this.render()}toggleCursor(){this.state.prevCursor?(this.cursor=this.state.prevCursor,this.state.prevCursor=0):(this.state.prevCursor=this.cursor,this.cursor=0),this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.input.length-1,this.render()}next(){let e=this.initial!=null?String(this.initial):"";if(!e||!e.startsWith(this.input))return this.alert();this.input=this.initial,this.cursor=this.initial.length,this.render()}prev(){if(!this.input)return this.alert();this.reset()}backward(){return this.left()}forward(){return this.right()}right(){return this.cursor>=this.input.length?this.alert():(this.moveCursor(1),this.render())}left(){return this.cursor<=0?this.alert():(this.moveCursor(-1),this.render())}isValue(e){return!!e}async format(e=this.value){let r=await this.resolve(this.initial,this.state);return this.state.submitted?this.styles.submitted(e||r):fKe(this,{input:e,initial:r,pos:this.cursor})}async render(){let e=this.state.size,r=await this.prefix(),i=await this.separator(),n=await this.message(),s=[r,n,i].filter(Boolean).join(" ");this.state.prompt=s;let o=await this.header(),a=await this.format(),l=await this.error()||await this.hint(),c=await this.footer();l&&!a.includes(l)&&(a+=" "+l),s+=" "+a,this.clear(e),this.write([o,s,c].filter(Boolean).join(`
|
||||
`)),this.restore()}};b_.exports=D_});var x_=C((Rot,S_)=>{"use strict";var pKe=t=>t.filter((e,r)=>t.lastIndexOf(e)===r),Xy=t=>pKe(t).filter(Boolean);S_.exports=(t,e={},r="")=>{let{past:i=[],present:n=""}=e,s,o;switch(t){case"prev":case"undo":return s=i.slice(0,i.length-1),o=i[i.length-1]||"",{past:Xy([r,...s]),present:o};case"next":case"redo":return s=i.slice(1),o=i[0]||"",{past:Xy([...s,r]),present:o};case"save":return{past:Xy([...i,r]),present:""};case"remove":return o=Xy(i.filter(a=>a!==r)),n="",o.length&&(n=o.pop()),{past:o,present:n};default:throw new Error(`Invalid action: "${t}"`)}}});var nP=C((Not,k_)=>{"use strict";var dKe=Al(),v_=x_(),P_=class extends dKe{constructor(e){super(e);let r=this.options.history;if(r&&r.store){let i=r.values||this.initial;this.autosave=!!r.autosave,this.store=r.store,this.data=this.store.get("values")||{past:[],present:i},this.initial=this.data.present||this.data.past[this.data.past.length-1]}}completion(e){return this.store?(this.data=v_(e,this.data,this.input),this.data.present?(this.input=this.data.present,this.cursor=this.input.length,this.render()):this.alert()):this.alert()}altUp(){return this.completion("prev")}altDown(){return this.completion("next")}prev(){return this.save(),super.prev()}save(){!this.store||(this.data=v_("save",this.data,this.input),this.store.set("values",this.data))}submit(){return this.store&&this.autosave===!0&&this.save(),super.submit()}};k_.exports=P_});var N_=C((Lot,F_)=>{"use strict";var CKe=Al(),R_=class extends CKe{format(){return""}};F_.exports=R_});var T_=C((Mot,L_)=>{"use strict";var mKe=Al(),M_=class extends mKe{constructor(e={}){super(e);this.sep=this.options.separator||/, */,this.initial=e.initial||""}split(e=this.value){return e?String(e).split(this.sep):[]}format(){let e=this.state.submitted?this.styles.primary:r=>r;return this.list.map(e).join(", ")}async submit(e){let r=this.state.error||await this.validate(this.list,this.state);return r!==!0?(this.state.error=r,super.submit()):(this.value=this.list,super.submit())}get list(){return this.split()}};L_.exports=M_});var U_=C((Tot,O_)=>{"use strict";var IKe=Ea(),K_=class extends IKe{constructor(e){super(V(v({},e),{multiple:!0}))}};O_.exports=K_});var sP=C((Oot,H_)=>{"use strict";var EKe=Al(),Y_=class extends EKe{constructor(e={}){super(v({style:"number"},e));this.min=this.isValue(e.min)?this.toNumber(e.min):-Infinity,this.max=this.isValue(e.max)?this.toNumber(e.max):Infinity,this.delay=e.delay!=null?e.delay:1e3,this.float=e.float!==!1,this.round=e.round===!0||e.float===!1,this.major=e.major||10,this.minor=e.minor||1,this.initial=e.initial!=null?e.initial:"",this.input=String(this.initial),this.cursor=this.input.length,this.cursorShow()}append(e){return!/[-+.]/.test(e)||e==="."&&this.input.includes(".")?this.alert("invalid number"):super.append(e)}number(e){return super.append(e)}next(){return this.input&&this.input!==this.initial?this.alert():this.isValue(this.initial)?(this.input=this.initial,this.cursor=String(this.initial).length,this.render()):this.alert()}up(e){let r=e||this.minor,i=this.toNumber(this.input);return i>this.max+r?this.alert():(this.input=`${i+r}`,this.render())}down(e){let r=e||this.minor,i=this.toNumber(this.input);return i<this.min-r?this.alert():(this.input=`${i-r}`,this.render())}shiftDown(){return this.down(this.major)}shiftUp(){return this.up(this.major)}format(e=this.input){return typeof this.options.format=="function"?this.options.format.call(this,e):this.styles.info(e)}toNumber(e=""){return this.float?+e:Math.round(+e)}isValue(e){return/^[-+]?[0-9]+((\.)|(\.[0-9]+))?$/.test(e)}submit(){let e=[this.input,this.initial].find(r=>this.isValue(r));return this.value=this.toNumber(e||0),super.submit()}};H_.exports=Y_});var G_=C((Kot,j_)=>{j_.exports=sP()});var W_=C((Uot,q_)=>{"use strict";var yKe=Al(),J_=class extends yKe{constructor(e){super(e);this.cursorShow()}format(e=this.input){return this.keypressed?(this.state.submitted?this.styles.primary:this.styles.muted)(this.symbols.asterisk.repeat(e.length)):""}};q_.exports=J_});var Z_=C((Hot,z_)=>{"use strict";var BKe=Yn(),wKe=lp(),V_=$r(),X_=class extends wKe{constructor(e={}){super(e);this.widths=[].concat(e.messageWidth||50),this.align=[].concat(e.align||"left"),this.linebreak=e.linebreak||!1,this.edgeLength=e.edgeLength||3,this.newline=e.newline||`
|
||||
`;let r=e.startNumber||1;typeof this.scale=="number"&&(this.scaleKey=!1,this.scale=Array(this.scale).fill(0).map((i,n)=>({name:n+r})))}async reset(){return this.tableized=!1,await super.reset(),this.render()}tableize(){if(this.tableized===!0)return;this.tableized=!0;let e=0;for(let r of this.choices){e=Math.max(e,r.message.length),r.scaleIndex=r.initial||2,r.scale=[];for(let i=0;i<this.scale.length;i++)r.scale.push({index:i})}this.widths[0]=Math.min(this.widths[0],e+3)}async dispatch(e,r){if(this.multiple)return this[r.name]?await this[r.name](e,r):await super.dispatch(e,r);this.alert()}heading(e,r,i){return this.styles.strong(e)}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIndex>=this.scale.length-1?this.alert():(e.scaleIndex++,this.render())}left(){let e=this.focused;return e.scaleIndex<=0?this.alert():(e.scaleIndex--,this.render())}indent(){return""}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.index)).join(", "):""}pointer(){return""}renderScaleKey(){if(this.scaleKey===!1||this.state.submitted)return"";let e=this.scale.map(i=>` ${i.name} - ${i.message}`);return["",...e].map(i=>this.styles.muted(i)).join(`
|
||||
`)}renderScaleHeading(e){let r=this.scale.map(l=>l.name);typeof this.options.renderScaleHeading=="function"&&(r=this.options.renderScaleHeading.call(this,e));let i=this.scaleLength-r.join("").length,n=Math.round(i/(r.length-1)),o=r.map(l=>this.styles.strong(l)).join(" ".repeat(n)),a=" ".repeat(this.widths[0]);return this.margin[3]+a+this.margin[1]+o}scaleIndicator(e,r,i){if(typeof this.options.scaleIndicator=="function")return this.options.scaleIndicator.call(this,e,r,i);let n=e.scaleIndex===r.index;return r.disabled?this.styles.hint(this.symbols.radio.disabled):n?this.styles.success(this.symbols.radio.on):this.symbols.radio.off}renderScale(e,r){let i=e.scale.map(s=>this.scaleIndicator(e,s,r)),n=this.term==="Hyper"?"":" ";return i.join(n+this.symbols.line.repeat(this.edgeLength))}async renderChoice(e,r){await this.onChoice(e,r);let i=this.index===r,n=await this.pointer(e,r),s=await e.hint;s&&!V_.hasColor(s)&&(s=this.styles.muted(s));let o=p=>this.margin[3]+p.replace(/\s+$/,"").padEnd(this.widths[0]," "),a=this.newline,l=this.indent(e),c=await this.resolve(e.message,this.state,e,r),u=await this.renderScale(e,r),g=this.margin[1]+this.margin[3];this.scaleLength=BKe.unstyle(u).length,this.widths[0]=Math.min(this.widths[0],this.width-this.scaleLength-g.length);let h=V_.wordWrap(c,{width:this.widths[0],newline:a}).split(`
|
||||
`).map(p=>o(p)+this.margin[1]);return i&&(u=this.styles.info(u),h=h.map(p=>this.styles.info(p))),h[0]+=u,this.linebreak&&h.push(""),[l+n,h.join(`
|
||||
`)].filter(Boolean)}async renderChoices(){if(this.state.submitted)return"";this.tableize();let e=this.visible.map(async(n,s)=>await this.renderChoice(n,s)),r=await Promise.all(e),i=await this.renderScaleHeading();return this.margin[0]+[i,...r.map(n=>n.join(" "))].join(`
|
||||
`)}async render(){let{submitted:e,size:r}=this.state,i=await this.prefix(),n=await this.separator(),s=await this.message(),o="";this.options.promptLine!==!1&&(o=[i,s,n,""].join(" "),this.state.prompt=o);let a=await this.header(),l=await this.format(),c=await this.renderScaleKey(),u=await this.error()||await this.hint(),g=await this.renderChoices(),f=await this.footer(),h=this.emptyError;l&&(o+=l),u&&!o.includes(u)&&(o+=" "+u),e&&!l&&!g.trim()&&this.multiple&&h!=null&&(o+=this.styles.danger(h)),this.clear(r),this.write([a,o,c,g,f].filter(Boolean).join(`
|
||||
`)),this.state.submitted||this.write(this.margin[2]),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIndex;return this.base.submit.call(this)}};z_.exports=X_});var t$=C((Yot,__)=>{"use strict";var $_=Yn(),QKe=(t="")=>typeof t=="string"?t.replace(/^['"]|['"]$/g,""):"",e$=class{constructor(e){this.name=e.key,this.field=e.field||{},this.value=QKe(e.initial||this.field.initial||""),this.message=e.message||this.name,this.cursor=0,this.input="",this.lines=[]}},bKe=async(t={},e={},r=i=>i)=>{let i=new Set,n=t.fields||[],s=t.template,o=[],a=[],l=[],c=1;typeof s=="function"&&(s=await s());let u=-1,g=()=>s[++u],f=()=>s[u+1],h=p=>{p.line=c,o.push(p)};for(h({type:"bos",value:""});u<s.length-1;){let p=g();if(/^[^\S\n ]$/.test(p)){h({type:"text",value:p});continue}if(p===`
|
||||
`){h({type:"newline",value:p}),c++;continue}if(p==="\\"){p+=g(),h({type:"text",value:p});continue}if((p==="$"||p==="#"||p==="{")&&f()==="{"){p+=g();let y={type:"template",open:p,inner:"",close:"",value:p},B;for(;B=g();){if(B==="}"){f()==="}"&&(B+=g()),y.value+=B,y.close=B;break}B===":"?(y.initial="",y.key=y.inner):y.initial!==void 0&&(y.initial+=B),y.value+=B,y.inner+=B}y.template=y.open+(y.initial||y.inner)+y.close,y.key=y.key||y.inner,e.hasOwnProperty(y.key)&&(y.initial=e[y.key]),y=r(y),h(y),l.push(y.key),i.add(y.key);let x=a.find(F=>F.name===y.key);y.field=n.find(F=>F.name===y.key),x||(x=new e$(y),a.push(x)),x.lines.push(y.line-1);continue}let m=o[o.length-1];m.type==="text"&&m.line===c?m.value+=p:h({type:"text",value:p})}return h({type:"eos",value:""}),{input:s,tabstops:o,unique:i,keys:l,items:a}};__.exports=async t=>{let e=t.options,r=new Set(e.required===!0?[]:e.required||[]),i=v(v({},e.values),e.initial),{tabstops:n,items:s,keys:o}=await bKe(e,i),a=oP("result",t,e),l=oP("format",t,e),c=oP("validate",t,e,!0),u=t.isValue.bind(t);return async(g={},f=!1)=>{let h=0;g.required=r,g.items=s,g.keys=o,g.output="";let p=async(B,x,F,N)=>{let O=await c(B,x,F,N);return O===!1?"Invalid field "+F.name:O};for(let B of n){let x=B.value,F=B.key;if(B.type!=="template"){x&&(g.output+=x);continue}if(B.type==="template"){let N=s.find(K=>K.name===F);e.required===!0&&g.required.add(N.name);let O=[N.input,g.values[N.value],N.value,x].find(u),J=(N.field||{}).message||B.inner;if(f){let K=await p(g.values[F],g,N,h);if(K&&typeof K=="string"||K===!1){g.invalid.set(F,K);continue}g.invalid.delete(F);let A=await a(g.values[F],g,N,h);g.output+=$_.unstyle(A);continue}N.placeholder=!1;let oe=x;x=await l(x,g,N,h),O!==x?(g.values[F]=O,x=t.styles.typing(O),g.missing.delete(J)):(g.values[F]=void 0,O=`<${J}>`,x=t.styles.primary(O),N.placeholder=!0,g.required.has(F)&&g.missing.add(J)),g.missing.has(J)&&g.validating&&(x=t.styles.warning(O)),g.invalid.has(F)&&g.validating&&(x=t.styles.danger(O)),h===g.index&&(oe!==x?x=t.styles.underline(x):x=t.styles.heading($_.unstyle(x))),h++}x&&(g.output+=x)}let m=g.output.split(`
|
||||
`).map(B=>" "+B),I=s.length,y=0;for(let B of s)g.invalid.has(B.name)&&B.lines.forEach(x=>{m[x][0]===" "&&(m[x]=g.styles.danger(g.symbols.bullet)+m[x].slice(1))}),t.isValue(g.values[B.name])&&y++;return g.completed=(y/I*100).toFixed(0),g.output=m.join(`
|
||||
`),g.output}};function oP(t,e,r,i){return(n,s,o,a)=>typeof o.field[t]=="function"?o.field[t].call(e,n,s,o,a):[i,n].find(l=>e.isValue(l))}});var n$=C((jot,r$)=>{"use strict";var DKe=Yn(),SKe=t$(),xKe=wu(),i$=class extends xKe{constructor(e){super(e);this.cursorHide(),this.reset(!0)}async initialize(){this.interpolate=await SKe(this),await super.initialize()}async reset(e){this.state.keys=[],this.state.invalid=new Map,this.state.missing=new Set,this.state.completed=0,this.state.values={},e!==!0&&(await this.initialize(),await this.render())}moveCursor(e){let r=this.getItem();this.cursor+=e,r.cursor+=e}dispatch(e,r){if(!r.code&&!r.ctrl&&e!=null&&this.getItem()){this.append(e,r);return}this.alert()}append(e,r){let i=this.getItem(),n=i.input.slice(0,this.cursor),s=i.input.slice(this.cursor);this.input=i.input=`${n}${e}${s}`,this.moveCursor(1),this.render()}delete(){let e=this.getItem();if(this.cursor<=0||!e.input)return this.alert();let r=e.input.slice(this.cursor),i=e.input.slice(0,this.cursor-1);this.input=e.input=`${i}${r}`,this.moveCursor(-1),this.render()}increment(e){return e>=this.state.keys.length-1?0:e+1}decrement(e){return e<=0?this.state.keys.length-1:e-1}first(){this.state.index=0,this.render()}last(){this.state.index=this.state.keys.length-1,this.render()}right(){if(this.cursor>=this.input.length)return this.alert();this.moveCursor(1),this.render()}left(){if(this.cursor<=0)return this.alert();this.moveCursor(-1),this.render()}prev(){this.state.index=this.decrement(this.state.index),this.getItem(),this.render()}next(){this.state.index=this.increment(this.state.index),this.getItem(),this.render()}up(){this.prev()}down(){this.next()}format(e){let r=this.state.completed<100?this.styles.warning:this.styles.success;return this.state.submitted===!0&&this.state.completed!==100&&(r=this.styles.danger),r(`${this.state.completed}% completed`)}async render(){let{index:e,keys:r=[],submitted:i,size:n}=this.state,s=[this.options.newline,`
|
||||
`].find(B=>B!=null),o=await this.prefix(),a=await this.separator(),l=await this.message(),c=[o,l,a].filter(Boolean).join(" ");this.state.prompt=c;let u=await this.header(),g=await this.error()||"",f=await this.hint()||"",h=i?"":await this.interpolate(this.state),p=this.state.key=r[e]||"",m=await this.format(p),I=await this.footer();m&&(c+=" "+m),f&&!m&&this.state.completed===0&&(c+=" "+f),this.clear(n);let y=[u,c,h,I,g.trim()];this.write(y.filter(Boolean).join(s)),this.restore()}getItem(e){let{items:r,keys:i,index:n}=this.state,s=r.find(o=>o.name===i[n]);return s&&s.input!=null&&(this.input=s.input,this.cursor=s.cursor),s}async submit(){typeof this.interpolate!="function"&&await this.initialize(),await this.interpolate(this.state,!0);let{invalid:e,missing:r,output:i,values:n}=this.state;if(e.size){let a="";for(let[l,c]of e)a+=`Invalid ${l}: ${c}
|
||||
`;return this.state.error=a,super.submit()}if(r.size)return this.state.error="Required: "+[...r.keys()].join(", "),super.submit();let o=DKe.unstyle(i).split(`
|
||||
`).map(a=>a.slice(1)).join(`
|
||||
`);return this.value={values:n,result:o},super.submit()}};r$.exports=i$});var a$=C((Got,s$)=>{"use strict";var kKe="(Use <shift>+<up/down> to sort)",vKe=Ea(),o$=class extends vKe{constructor(e){super(V(v({},e),{reorder:!1,sort:!0,multiple:!0}));this.state.hint=[this.options.hint,kKe].find(this.isValue.bind(this))}indicator(){return""}async renderChoice(e,r){let i=await super.renderChoice(e,r),n=this.symbols.identicalTo+" ",s=this.index===r&&this.sorting?this.styles.muted(n):" ";return this.options.drag===!1&&(s=""),this.options.numbered===!0?s+`${r+1} - `+i:s+i}get selected(){return this.choices}submit(){return this.value=this.choices.map(e=>e.value),super.submit()}};s$.exports=o$});var c$=C((qot,A$)=>{"use strict";var PKe=lp(),l$=class extends PKe{constructor(e={}){super(e);if(this.emptyError=e.emptyError||"No items were selected",this.term=process.env.TERM_PROGRAM,!this.options.header){let r=["","4 - Strongly Agree","3 - Agree","2 - Neutral","1 - Disagree","0 - Strongly Disagree",""];r=r.map(i=>this.styles.muted(i)),this.state.header=r.join(`
|
||||
`)}}async toChoices(...e){if(this.createdScales)return!1;this.createdScales=!0;let r=await super.toChoices(...e);for(let i of r)i.scale=FKe(5,this.options),i.scaleIdx=2;return r}dispatch(){this.alert()}space(){let e=this.focused,r=e.scale[e.scaleIdx],i=r.selected;return e.scale.forEach(n=>n.selected=!1),r.selected=!i,this.render()}indicator(){return""}pointer(){return""}separator(){return this.styles.muted(this.symbols.ellipsis)}right(){let e=this.focused;return e.scaleIdx>=e.scale.length-1?this.alert():(e.scaleIdx++,this.render())}left(){let e=this.focused;return e.scaleIdx<=0?this.alert():(e.scaleIdx--,this.render())}indent(){return" "}async renderChoice(e,r){await this.onChoice(e,r);let i=this.index===r,n=this.term==="Hyper",s=n?9:8,o=n?"":" ",a=this.symbols.line.repeat(s),l=" ".repeat(s+(n?0:1)),c=x=>(x?this.styles.success("\u25C9"):"\u25EF")+o,u=r+1+".",g=i?this.styles.heading:this.styles.noop,f=await this.resolve(e.message,this.state,e,r),h=this.indent(e),p=h+e.scale.map((x,F)=>c(F===e.scaleIdx)).join(a),m=x=>x===e.scaleIdx?g(x):x,I=h+e.scale.map((x,F)=>m(F)).join(l),y=()=>[u,f].filter(Boolean).join(" "),B=()=>[y(),p,I," "].filter(Boolean).join(`
|
||||
`);return i&&(p=this.styles.cyan(p),I=this.styles.cyan(I)),B()}async renderChoices(){if(this.state.submitted)return"";let e=this.visible.map(async(i,n)=>await this.renderChoice(i,n)),r=await Promise.all(e);return r.length||r.push(this.styles.danger("No matching choices")),r.join(`
|
||||
`)}format(){return this.state.submitted?this.choices.map(r=>this.styles.info(r.scaleIdx)).join(", "):""}async render(){let{submitted:e,size:r}=this.state,i=await this.prefix(),n=await this.separator(),s=await this.message(),o=[i,s,n].filter(Boolean).join(" ");this.state.prompt=o;let a=await this.header(),l=await this.format(),c=await this.error()||await this.hint(),u=await this.renderChoices(),g=await this.footer();(l||!c)&&(o+=" "+l),c&&!o.includes(c)&&(o+=" "+c),e&&!l&&!u&&this.multiple&&this.type!=="form"&&(o+=this.styles.danger(this.emptyError)),this.clear(r),this.write([o,a,u,g].filter(Boolean).join(`
|
||||
`)),this.restore()}submit(){this.value={};for(let e of this.choices)this.value[e.name]=e.scaleIdx;return this.base.submit.call(this)}};function FKe(t,e={}){if(Array.isArray(e.scale))return e.scale.map(i=>v({},i));let r=[];for(let i=1;i<t+1;i++)r.push({i,selected:!1});return r}A$.exports=l$});var g$=C((Jot,u$)=>{u$.exports=nP()});var p$=C((Wot,f$)=>{"use strict";var RKe=Vy(),h$=class extends RKe{async initialize(){await super.initialize(),this.value=this.initial=!!this.options.initial,this.disabled=this.options.disabled||"no",this.enabled=this.options.enabled||"yes",await this.render()}reset(){this.value=this.initial,this.render()}delete(){this.alert()}toggle(){this.value=!this.value,this.render()}enable(){if(this.value===!0)return this.alert();this.value=!0,this.render()}disable(){if(this.value===!1)return this.alert();this.value=!1,this.render()}up(){this.toggle()}down(){this.toggle()}right(){this.toggle()}left(){this.toggle()}next(){this.toggle()}prev(){this.toggle()}dispatch(e="",r){switch(e.toLowerCase()){case" ":return this.toggle();case"1":case"y":case"t":return this.enable();case"0":case"n":case"f":return this.disable();default:return this.alert()}}format(){let e=i=>this.styles.primary.underline(i);return[this.value?this.disabled:e(this.disabled),this.value?e(this.enabled):this.enabled].join(this.styles.muted(" / "))}async render(){let{size:e}=this.state,r=await this.header(),i=await this.prefix(),n=await this.separator(),s=await this.message(),o=await this.format(),a=await this.error()||await this.hint(),l=await this.footer(),c=[i,s,n,o].join(" ");this.state.prompt=c,a&&!c.includes(a)&&(c+=" "+a),this.clear(e),this.write([r,c,l].filter(Boolean).join(`
|
||||
`)),this.write(this.margin[2]),this.restore()}};f$.exports=h$});var m$=C((zot,d$)=>{"use strict";var NKe=Ea(),C$=class extends NKe{constructor(e){super(e);if(typeof this.options.correctChoice!="number"||this.options.correctChoice<0)throw new Error("Please specify the index of the correct answer from the list of choices")}async toChoices(e,r){let i=await super.toChoices(e,r);if(i.length<2)throw new Error("Please give at least two choices to the user");if(this.options.correctChoice>i.length)throw new Error("Please specify the index of the correct answer from the list of choices");return i}check(e){return e.index===this.options.correctChoice}async result(e){return{selectedAnswer:e,correctAnswer:this.options.choices[this.options.correctChoice].value,correct:await this.check(this.state)}}};d$.exports=C$});var E$=C(aP=>{"use strict";var I$=$r(),wr=(t,e)=>{I$.defineExport(aP,t,e),I$.defineExport(aP,t.toLowerCase(),e)};wr("AutoComplete",()=>A_());wr("BasicAuth",()=>d_());wr("Confirm",()=>y_());wr("Editable",()=>Q_());wr("Form",()=>zy());wr("Input",()=>nP());wr("Invisible",()=>N_());wr("List",()=>T_());wr("MultiSelect",()=>U_());wr("Numeral",()=>G_());wr("Password",()=>W_());wr("Scale",()=>Z_());wr("Select",()=>Ea());wr("Snippet",()=>n$());wr("Sort",()=>a$());wr("Survey",()=>c$());wr("Text",()=>g$());wr("Toggle",()=>p$());wr("Quiz",()=>m$())});var B$=C((Xot,y$)=>{y$.exports={ArrayPrompt:lp(),AuthPrompt:iP(),BooleanPrompt:Vy(),NumberPrompt:sP(),StringPrompt:Al()}});var up=C((Zot,w$)=>{"use strict";var Q$=require("assert"),AP=require("events"),ya=$r(),ys=class extends AP{constructor(e,r){super();this.options=ya.merge({},e),this.answers=v({},r)}register(e,r){if(ya.isObject(e)){for(let n of Object.keys(e))this.register(n,e[n]);return this}Q$.equal(typeof r,"function","expected a function");let i=e.toLowerCase();return r.prototype instanceof this.Prompt?this.prompts[i]=r:this.prompts[i]=r(this.Prompt,this),this}async prompt(e=[]){for(let r of[].concat(e))try{typeof r=="function"&&(r=await r.call(this)),await this.ask(ya.merge({},this.options,r))}catch(i){return Promise.reject(i)}return this.answers}async ask(e){typeof e=="function"&&(e=await e.call(this));let r=ya.merge({},this.options,e),{type:i,name:n}=e,{set:s,get:o}=ya;if(typeof i=="function"&&(i=await i.call(this,e,this.answers)),!i)return this.answers[n];Q$(this.prompts[i],`Prompt "${i}" is not registered`);let a=new this.prompts[i](r),l=o(this.answers,n);a.state.answers=this.answers,a.enquirer=this,n&&a.on("submit",u=>{this.emit("answer",n,u,a),s(this.answers,n,u)});let c=a.emit.bind(a);return a.emit=(...u)=>(this.emit.call(this,...u),c(...u)),this.emit("prompt",a,this),r.autofill&&l!=null?(a.value=a.input=l,r.autofill==="show"&&await a.submit()):l=a.value=await a.run(),l}use(e){return e.call(this,this),this}set Prompt(e){this._Prompt=e}get Prompt(){return this._Prompt||this.constructor.Prompt}get prompts(){return this.constructor.prompts}static set Prompt(e){this._Prompt=e}static get Prompt(){return this._Prompt||wu()}static get prompts(){return E$()}static get types(){return B$()}static get prompt(){let e=(r,...i)=>{let n=new this(...i),s=n.emit.bind(n);return n.emit=(...o)=>(e.emit(...o),s(...o)),n.prompt(r)};return ya.mixinEmitter(e,new AP),e}};ya.mixinEmitter(ys,new AP);var lP=ys.prompts;for(let t of Object.keys(lP)){let e=t.toLowerCase(),r=i=>new lP[t](i).run();ys.prompt[e]=r,ys[e]=r,ys[t]||Reflect.defineProperty(ys,t,{get:()=>lP[t]})}var cp=t=>{ya.defineExport(ys,t,()=>ys.types[t])};cp("ArrayPrompt");cp("AuthPrompt");cp("BooleanPrompt");cp("NumberPrompt");cp("StringPrompt");w$.exports=ys});var L$=C((Uat,N$)=>{function OKe(t,e){for(var r=-1,i=t==null?0:t.length;++r<i&&e(t[r],r,t)!==!1;);return t}N$.exports=OKe});var bu=C((Hat,M$)=>{var KKe=oy(),UKe=Au();function HKe(t,e,r,i){var n=!r;r||(r={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=i?i(r[a],t[a],a,r,t):void 0;l===void 0&&(l=t[a]),n?UKe(r,a,l):KKe(r,a,l)}return r}M$.exports=HKe});var O$=C((Yat,T$)=>{var YKe=bu(),jKe=fu();function GKe(t,e){return t&&YKe(e,jKe(e),t)}T$.exports=GKe});var U$=C((jat,K$)=>{function qKe(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}K$.exports=qKe});var Y$=C((Gat,H$)=>{var JKe=Hn(),WKe=yy(),zKe=U$(),VKe=Object.prototype,XKe=VKe.hasOwnProperty;function ZKe(t){if(!JKe(t))return zKe(t);var e=WKe(t),r=[];for(var i in t)i=="constructor"&&(e||!XKe.call(t,i))||r.push(i);return r}H$.exports=ZKe});var Du=C((qat,j$)=>{var _Ke=ev(),$Ke=Y$(),eUe=qh();function tUe(t){return eUe(t)?_Ke(t,!0):$Ke(t)}j$.exports=tUe});var q$=C((Jat,G$)=>{var rUe=bu(),iUe=Du();function nUe(t,e){return t&&rUe(e,iUe(e),t)}G$.exports=nUe});var pP=C((mp,Su)=>{var sUe=On(),J$=typeof mp=="object"&&mp&&!mp.nodeType&&mp,W$=J$&&typeof Su=="object"&&Su&&!Su.nodeType&&Su,oUe=W$&&W$.exports===J$,z$=oUe?sUe.Buffer:void 0,V$=z$?z$.allocUnsafe:void 0;function aUe(t,e){if(e)return t.slice();var r=t.length,i=V$?V$(r):new t.constructor(r);return t.copy(i),i}Su.exports=aUe});var dP=C((Wat,X$)=>{function AUe(t,e
Line truncated
|
||||
`:"";return o?g+=`@IF EXIST ${o} (\r
|
||||
${o} ${l} ${n} ${u}%*\r
|
||||
) ELSE (\r
|
||||
@SETLOCAL\r
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%\r
|
||||
${a} ${l} ${n} ${u}%*\r
|
||||
)\r
|
||||
`:g+=`@${a} ${l} ${n} ${u}%*\r
|
||||
`,g}function Sje(t,e,r){let i=bn.relative(bn.dirname(e),t),n=r.prog&&r.prog.split("\\").join("/"),s;i=i.split("\\").join("/");let o=bn.isAbsolute(i)?`"${i}"`:`"$basedir/${i}"`,a=r.args||"",l=MF(r.nodePath).posix;n?(s=`"$basedir/${r.prog}"`,i=o):(n=o,a="",i="");let c=r.progArgs?`${r.progArgs.join(" ")} `:"",u=`#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
|
||||
|
||||
case \`uname\` in
|
||||
*CYGWIN*) basedir=\`cygpath -w "$basedir"\`;;
|
||||
esac
|
||||
|
||||
`,g=r.nodePath?`export NODE_PATH="${l}"
|
||||
`:"";return s?u+=`${g}if [ -x ${s} ]; then
|
||||
exec ${s} ${a} ${i} ${c}"$@"
|
||||
else
|
||||
exec ${n} ${a} ${i} ${c}"$@"
|
||||
fi
|
||||
`:u+=`${g}${n} ${a} ${i} ${c}"$@"
|
||||
exit $?
|
||||
`,u}function xje(t,e,r){let i=bn.relative(bn.dirname(e),t),n=r.prog&&r.prog.split("\\").join("/"),s=n&&`"${n}$exe"`,o;i=i.split("\\").join("/");let a=bn.isAbsolute(i)?`"${i}"`:`"$basedir/${i}"`,l=r.args||"",c=MF(r.nodePath),u=c.win32,g=c.posix;s?(o=`"$basedir/${r.prog}$exe"`,i=a):(s=a,l="",i="");let f=r.progArgs?`${r.progArgs.join(" ")} `:"",h=`#!/usr/bin/env pwsh
|
||||
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
|
||||
$exe=""
|
||||
${r.nodePath?`$env_node_path=$env:NODE_PATH
|
||||
$env:NODE_PATH="${u}"
|
||||
`:""}if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
# Fix case when both the Windows and Linux builds of Node
|
||||
# are installed in the same directory
|
||||
$exe=".exe"
|
||||
}`;return r.nodePath&&(h+=` else {
|
||||
$env:NODE_PATH="${g}"
|
||||
}`),o?h+=`
|
||||
$ret=0
|
||||
if (Test-Path ${o}) {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & ${o} ${l} ${i} ${f}$args
|
||||
} else {
|
||||
& ${o} ${l} ${i} ${f}$args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
} else {
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & ${s} ${l} ${i} ${f}$args
|
||||
} else {
|
||||
& ${s} ${l} ${i} ${f}$args
|
||||
}
|
||||
$ret=$LASTEXITCODE
|
||||
}
|
||||
${r.nodePath?`$env:NODE_PATH=$env_node_path
|
||||
`:""}exit $ret
|
||||
`:h+=`
|
||||
# Support pipeline input
|
||||
if ($MyInvocation.ExpectingInput) {
|
||||
$input | & ${s} ${l} ${i} ${f}$args
|
||||
} else {
|
||||
& ${s} ${l} ${i} ${f}$args
|
||||
}
|
||||
${r.nodePath?`$env:NODE_PATH=$env_node_path
|
||||
`:""}exit $LASTEXITCODE
|
||||
`,h}function vje(t,e){return e.fs_.chmod(t,493)}function MF(t){if(!t)return{win32:"",posix:""};let e=typeof t=="string"?t.split(bn.delimiter):Array.from(t),r={};for(let i=0;i<e.length;i++){let n=e[i].split("/").join("\\"),s=Rie()?e[i].split("\\").join("/").replace(/^([^:\\/]*):/,(o,a)=>`/mnt/${a.toLowerCase()}`):e[i];r.win32=r.win32?`${r.win32};${n}`:n,r.posix=r.posix?`${r.posix}:${s}`:s,r[i]={win32:n,posix:s}}return r}Fie.exports=LF});var rR=C((aEt,_ie)=>{_ie.exports=require("stream")});var rne=C((AEt,$ie)=>{"use strict";function ene(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Zje(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ene(Object(r),!0).forEach(function(i){Xje(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ene(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function Xje(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _je(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tne(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function $je(t,e,r){return e&&tne(t.prototype,e),r&&tne(t,r),t}var eGe=require("buffer"),fB=eGe.Buffer,tGe=require("util"),iR=tGe.inspect,rGe=iR&&iR.custom||"inspect";function iGe(t,e,r){fB.prototype.copy.call(t,e,r)}$ie.exports=function(){function t(){_je(this,t),this.head=null,this.tail=null,this.length=0}return $je(t,[{key:"push",value:function(r){var i={data:r,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function(r){var i={data:r,next:this.head};this.length===0&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(r){if(this.length===0)return"";for(var i=this.head,n=""+i.data;i=i.next;)n+=r+i.data;return n}},{key:"concat",value:function(r){if(this.length===0)return fB.alloc(0);for(var i=fB.allocUnsafe(r>>>0),n=this.head,s=0;n;)iGe(n.data,i,s),s+=n.data.length,n=n.next;return i}},{key:"consume",value:function(r,i){var n;return r<this.head.data.length?(n=this.head.data.slice(0,r),this.head.data=this.head.data.slice(r)):r===this.head.data.length?n=this.shift():n=i?this._getString(r):this._getBuffer(r),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(r){var i=this.head,n=1,s=i.data;for(r-=s.length;i=i.next;){var o=i.data,a=r>o.length?o.length:r;if(a===o.length?s+=o:s+=o.slice(0,r),r-=a,r===0){a===o.length?(++n,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=o.slice(a));break}++n}return this.length-=n,s}},{key:"_getBuffer",value:function(r){var i=fB.allocUnsafe(r),n=this.head,s=1;for(n.data.copy(i),r-=n.data.length;n=n.next;){var o=n.data,a=r>o.length?o.length:r;if(o.copy(i,i.length-r,0,a),r-=a,r===0){a===o.length?(++s,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=o.slice(a));break}++s}return this.length-=s,i}},{key:rGe,value:function(r,i){return iR(this,Zje({},i,{depth:0,customInspect:!1}))}}]),t}()});var sR=C((lEt,ine)=>{"use strict";function nGe(t,e){var r=this,i=this._readableState&&this._readableState.destroyed,n=this._writableState&&this._writableState.destroyed;return i||n?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(nR,this,t)):process.nextTick(nR,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(s){!e&&s?r._writableState?r._writableState.errorEmitted?process.nextTick(hB,r):(r._writableState.errorEmitted=!0,process.nextTick(nne,r,s)):process.nextTick(nne,r,s):e?(process.nextTick(hB,r),e(s)):process.nextTick(hB,r)}),this)}function nne(t,e){nR(t,e),hB(t)}function hB(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function sGe(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function nR(t,e){t.emit("error",e)}function oGe(t,e){var r=t._readableState,i=t._wr
Line truncated
|
||||
`)),t.linkname&&(e+=NR(" linkpath="+t.linkname+`
|
||||
`));var r=t.pax;if(r)for(var i in r)e+=NR(" "+i+"="+r[i]+`
|
||||
`);return Buffer.from(e)};ju.decodePax=function(t){for(var e={};t.length;){for(var r=0;r<t.length&&t[r]!==32;)r++;var i=parseInt(t.slice(0,r).toString(),10);if(!i)return e;var n=t.slice(r+1,i-1).toString(),s=n.indexOf("=");if(s===-1)return e;e[n.slice(0,s)]=n.slice(s+1),t=t.slice(i)}return e};ju.encode=function(t){var e=_qe(512),r=t.name,i="";if(t.typeflag===5&&r[r.length-1]!=="/"&&(r+="/"),Buffer.byteLength(r)!==r.length)return null;for(;Buffer.byteLength(r)>100;){var n=r.indexOf("/");if(n===-1)return null;i+=i?"/"+r.slice(0,n):r.slice(0,n),r=r.slice(n+1)}return Buffer.byteLength(r)>100||Buffer.byteLength(i)>155||t.linkname&&Buffer.byteLength(t.linkname)>100?null:(e.write(r),e.write(La(t.mode&nJe,6),100),e.write(La(t.uid,6),108),e.write(La(t.gid,6),116),e.write(La(t.size,11),124),e.write(La(t.mtime.getTime()/1e3|0,11),136),e[156]=nse+aJe(t.type),t.linkname&&e.write(t.linkname,157),sse.copy(e,dd),tJe.copy(e,RR),t.uname&&e.write(t.uname,265),t.gname&&e.write(t.gname,297),e.write(La(t.devmajor||0,6),329),e.write(La(t.devminor||0,6),337),i&&e.write(i,345),e.write(La(ase(e),6),148),e)};ju.decode=function(t,e,r){var i=t[156]===0?0:t[156]-nse,n=Gu(t,0,100,e),s=Ma(t,100,8),o=Ma(t,108,8),a=Ma(t,116,8),l=Ma(t,124,12),c=Ma(t,136,12),u=oJe(i),g=t[157]===0?null:Gu(t,157,100,e),f=Gu(t,265,32),h=Gu(t,297,32),p=Ma(t,329,8),m=Ma(t,337,8),I=ase(t);if(I===8*32)return null;if(I!==Ma(t,148,8))throw new Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(sse.compare(t,dd,dd+6)===0)t[345]&&(n=Gu(t,345,155,e)+"/"+n);else if(!(rJe.compare(t,dd,dd+6)===0&&iJe.compare(t,RR,RR+2)===0)){if(!r)throw new Error("Invalid tar header: unknown format.")}return i===0&&n&&n[n.length-1]==="/"&&(i=5),{name:n,mode:s,uid:o,gid:a,size:l,mtime:new Date(1e3*c),type:u,linkname:g,uname:f,gname:h,devmajor:p,devminor:m}}});var hse=C((kEt,Ase)=>{var lse=require("util"),lJe=ise(),Cd=LR(),cse=Yu().Writable,use=Yu().PassThrough,gse=function(){},fse=function(t){return t&=511,t&&512-t},cJe=function(t,e){var r=new kB(t,e);return r.end(),r},uJe=function(t,e){return e.path&&(t.name=e.path),e.linkpath&&(t.linkname=e.linkpath),e.size&&(t.size=parseInt(e.size,10)),t.pax=e,t},kB=function(t,e){this._parent=t,this.offset=e,use.call(this,{autoDestroy:!1})};lse.inherits(kB,use);kB.prototype.destroy=function(t){this._parent.destroy(t)};var bo=function(t){if(!(this instanceof bo))return new bo(t);cse.call(this,t),t=t||{},this._offset=0,this._buffer=lJe(),this._missing=0,this._partial=!1,this._onparse=gse,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var e=this,r=e._buffer,i=function(){e._continue()},n=function(f){if(e._locked=!1,f)return e.destroy(f);e._stream||i()},s=function(){e._stream=null;var f=fse(e._header.size);f?e._parse(f,o):e._parse(512,g),e._locked||i()},o=function(){e._buffer.consume(fse(e._header.size)),e._parse(512,g),i()},a=function(){var f=e._header.size;e._paxGlobal=Cd.decodePax(r.slice(0,f)),r.consume(f),s()},l=function(){var f=e._header.size;e._pax=Cd.decodePax(r.slice(0,f)),e._paxGlobal&&(e._pax=Object.assign({},e._paxGlobal,e._pax)),r.consume(f),s()},c=function(){var f=e._header.size;this._gnuLongPath=Cd.decodeLongPath(r.slice(0,f),t.filenameEncoding),r.consume(f),s()},u=function(){var f=e._header.size;this._gnuLongLinkPath=Cd.decodeLongPath(r.slice(0,f),t.filenameEncoding),r.consume(f),s()},g=function(){var f=e._offset,h;try{h=e._header=Cd.decode(r.slice(0,512),t.filenameEncoding,t.allowUnknownFormat)}catch(p){e.emit("error",p)}if(r.consume(512),!h){e._parse(512,g),i();return}if(h.type==="gnu-long-path"){e._parse(h.size,c),i();return}if(h.type==="gnu-long-link-path"){e._parse(h.size,u),i();return}if(h.type==="pax-global-header"){e._parse(h.size,a),i();return}if(h.type==="pax-header"){e._parse(h.size,l),i();return}if(e._gnuLongPath&&(h.name=e._gnuLongPath,e._gnuLongPath=null),e._gnuLongLinkPath&&(h.linkname=e._gnuLongLinkPath,e._gnuLongLinkPath=null),e._pax&&(e._header=h=uJe(h,e._pax),e._pax=null),e._locked=!0,!h.size||h.type==="directory"){e._parse(512,g),e.emit("entry",h,cJe(e,f),n);return}e._stream=new kB(e,f),e.emit("entry",h,e._stream,n),e._parse(h.size,s),i()};this._onheader=g,this._parse(512,g)};lse.inherits(bo,cse);bo.prototype.destroy=function(t){this._destroyed||(this._destroyed=!0,t&&this.emit("error",t),this.emit("close"),this._stream&&this._stream.emit("close"))};bo.prototype._parse=function(t,e){this._destroyed||(this._offset+=t,this._missing=t,e===this._onheader&&(this._partial=!1),this._onparse=e)};bo.prototype._continue=function(){if(!this._destroyed){var t=this._cb;this._cb=gse,this._overflow?this._write(this._overflow,void 0,t):t()}};bo.prototype._write=function(t,e,r){if(!this._destroyed){var i=this._stream,n=this._buffer,s=this._missing;if(t.length&&(this._partial=!0),t.length<s)return this._missing-=t.length,this._overflow=null,i?i.write(t,r):(n.appen
Line truncated
|
||||
Wanted: ${r.size}
|
||||
Found: ${t.length}`);throw a.code="EBADSIZE",a.found=t.length,a.expected=r.size,a.sri=e,a}else{let a=new Error(`Integrity checksum failed when using ${i}: Wanted ${e}, but got ${s}. (${t.length} bytes)`);throw a.code="EINTEGRITY",a.found=s,a.expected=e,a.algorithm=i,a.sri=e,a}}bs.exports.checkStream=jJe;function jJe(t,e,r){r=mi(r);let i=r.Promise||Promise,n=JR(r.concat({integrity:e}));return new i((s,o)=>{t.pipe(n),t.on("error",o),n.on("error",o);let a;n.on("verified",l=>{a=l}),n.on("end",()=>s(a)),n.on("data",()=>{})})}bs.exports.integrityStream=JR;function JR(t){t=mi(t);let e=t.integrity&&Ds(t.integrity,t),r=e&&Object.keys(e).length,i=r&&e.pickAlgorithm(t),n=r&&e[i],s=Array.from(new Set(t.algorithms.concat(i?[i]:[]))),o=s.map(Ed.createHash),a=0,l=new RJe({transform(c,u,g){a+=c.length,o.forEach(f=>f.update(c,u)),g(null,c,u)}}).on("end",()=>{let c=t.options&&t.options.length?`?${t.options.join("?")}`:"",u=Ds(o.map((f,h)=>`${s[h]}-${f.digest("base64")}${c}`).join(" "),t),g=r&&u.match(e,t);if(typeof t.size=="number"&&a!==t.size){let f=new Error(`stream size mismatch when checking ${e}.
|
||||
Wanted: ${t.size}
|
||||
Found: ${a}`);f.code="EBADSIZE",f.found=a,f.expected=t.size,f.sri=e,l.emit("error",f)}else if(t.integrity&&!g){let f=new Error(`${e} integrity checksum failed when using ${i}: wanted ${n} but got ${u}. (${a} bytes)`);f.code="EINTEGRITY",f.found=u,f.expected=n,f.algorithm=i,f.sri=e,l.emit("error",f)}else l.emit("size",a),l.emit("integrity",u),g&&l.emit("verified",g)});return l}bs.exports.create=GJe;function GJe(t){t=mi(t);let e=t.algorithms,r=t.options.length?`?${t.options.join("?")}`:"",i=e.map(Ed.createHash);return{update:function(n,s){return i.forEach(o=>o.update(n,s)),this},digest:function(n){return e.reduce((o,a)=>{let l=i.shift().digest("base64"),c=new Il(`${a}-${l}${r}`,t);if(c.algorithm&&c.digest){let u=c.algorithm;o[u]||(o[u]=[]),o[u].push(c)}return o},new zu)}}}var qJe=new Set(Ed.getHashes()),Tse=["md5","whirlpool","sha1","sha224","sha256","sha384","sha512","sha3","sha3-256","sha3-384","sha3-512","sha3_256","sha3_384","sha3_512"].filter(t=>qJe.has(t));function OJe(t,e){return Tse.indexOf(t.toLowerCase())>=Tse.indexOf(e.toLowerCase())?t:e}});var Th={};et(Th,{BuildType:()=>Vi,Cache:()=>ft,Configuration:()=>le,DEFAULT_LOCK_FILENAME:()=>ok,DEFAULT_RC_FILENAME:()=>sk,FormatType:()=>ds,InstallMode:()=>kr,LightReport:()=>uo,LinkType:()=>lt,Manifest:()=>ze,MessageName:()=>z,PackageExtensionStatus:()=>qr,PackageExtensionType:()=>Dr,Project:()=>Fe,ProjectLookup:()=>Ca,Report:()=>ci,ReportError:()=>_e,SettingsType:()=>ge,StreamReport:()=>xe,TAG_REGEXP:()=>Zc,TelemetryManager:()=>Mh,ThrowReport:()=>Br,VirtualFetcher:()=>Ih,Workspace:()=>Lh,WorkspaceResolver:()=>Ci,YarnVersion:()=>Er,execUtils:()=>Lr,folderUtils:()=>Hw,formatUtils:()=>Ae,hashUtils:()=>Di,httpUtils:()=>Rt,miscUtils:()=>de,scriptUtils:()=>Qt,semverUtils:()=>vt,structUtils:()=>w,tgzUtils:()=>hr,treeUtils:()=>Un});var Lr={};et(Lr,{EndStrategy:()=>sn,execvp:()=>kae,pipevp:()=>Ts});var kg={};et(kg,{AliasFS:()=>Ja,CwdFS:()=>yt,DEFAULT_COMPRESSION_LEVEL:()=>qa,FakeFS:()=>Ns,Filename:()=>xt,JailFS:()=>Ls,LazyFS:()=>bg,LinkStrategy:()=>Ig,NoFS:()=>BC,NodeFS:()=>Ft,PortablePath:()=>we,PosixFS:()=>Dg,ProxiedFS:()=>Nr,VirtualFS:()=>ir,ZipFS:()=>Qr,ZipOpenFS:()=>nn,extendFs:()=>QC,normalizeLineEndings:()=>Dl,npath:()=>T,opendir:()=>IC,patchFs:()=>Dw,ppath:()=>D,statUtils:()=>gw,toFilename:()=>rr,xfs:()=>L});var gw={};et(gw,{BigIntStatsEntry:()=>dg,DirEntry:()=>yN,StatEntry:()=>Ro,areStatsEqual:()=>hw,clearStats:()=>fC,convertToBigIntStats:()=>hC,makeDefaultStats:()=>Cg,makeEmptyStats:()=>Goe});var fw=te(require("util"));var tn=61440,Po=16384,Rs=32768,Fo=40960;var yN=class{constructor(){this.name="";this.mode=0}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&tn)===Po}isFIFO(){return!1}isFile(){return(this.mode&tn)===Rs}isSocket(){return!1}isSymbolicLink(){return(this.mode&tn)===Fo}},Ro=class{constructor(){this.uid=0;this.gid=0;this.size=0;this.blksize=0;this.atimeMs=0;this.mtimeMs=0;this.ctimeMs=0;this.birthtimeMs=0;this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=0;this.ino=0;this.mode=Rs|420;this.nlink=1;this.rdev=0;this.blocks=1}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&tn)===Po}isFIFO(){return!1}isFile(){return(this.mode&tn)===Rs}isSocket(){return!1}isSymbolicLink(){return(this.mode&tn)===Fo}},dg=class{constructor(){this.uid=BigInt(0);this.gid=BigInt(0);this.size=BigInt(0);this.blksize=BigInt(0);this.atimeMs=BigInt(0);this.mtimeMs=BigInt(0);this.ctimeMs=BigInt(0);this.birthtimeMs=BigInt(0);this.atimeNs=BigInt(0);this.mtimeNs=BigInt(0);this.ctimeNs=BigInt(0);this.birthtimeNs=BigInt(0);this.atime=new Date(0);this.mtime=new Date(0);this.ctime=new Date(0);this.birthtime=new Date(0);this.dev=BigInt(0);this.ino=BigInt(0);this.mode=BigInt(Rs|420);this.nlink=BigInt(1);this.rdev=BigInt(0);this.blocks=BigInt(1)}isBlockDevice(){return!1}isCharacterDevice(){return!1}isDirectory(){return(this.mode&BigInt(tn))===BigInt(Po)}isFIFO(){return!1}isFile(){return(this.mode&BigInt(tn))===BigInt(Rs)}isSocket(){return!1}isSymbolicLink(){return(this.mode&BigInt(tn))===BigInt(Fo)}};function Cg(){return new Ro}function Goe(){return fC(Cg())}function fC(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)){let r=t[e];typeof r=="number"?t[e]=0:typeof r=="bigint"?t[e]=BigInt(0):fw.types.isDate(r)&&(t[e]=new Date(0))}return t}function hC(t){let e=new dg;for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];typeof i=="number"?e[r]=BigInt(i):fw.types.isDate(i)&&(e[r]=new Date(i))}return e.atimeNs=e.atimeMs*BigInt(1e6),e.mtimeNs=e.mtimeMs*BigInt(1e6),e.ctimeNs=e.ctimeMs*BigInt(1e6),e.birthtimeNs=e.birthtimeMs*BigInt(1e6),e}function hw(t,e){if(t.atimeMs!==e.atimeMs||t.birthtimeMs!==e.birthtimeMs||t.blksize!==e.blksize||t.blocks!==e.blocks||t.ctimeMs!==e.ctimeMs||t.dev!==e.dev||t.gid!==e.gid||t.ino!==e.ino||t.isBlockDevice()!==e.isBlockDevice()||t.isCharacterDevice()!==e.isCharacterDevice()||t.isDirectory()!==e.isDirectory()||
Line truncated
|
||||
`)}writeJsonSync(e,r){return this.writeFileSync(e,`${JSON.stringify(r,null,2)}
|
||||
`)}async preserveTimePromise(e,r){let i=await this.lstatPromise(e),n=await r();typeof n!="undefined"&&(e=n),this.lutimesPromise?await this.lutimesPromise(e,i.atime,i.mtime):i.isSymbolicLink()||await this.utimesPromise(e,i.atime,i.mtime)}async preserveTimeSync(e,r){let i=this.lstatSync(e),n=r();typeof n!="undefined"&&(e=n),this.lutimesSync?this.lutimesSync(e,i.atime,i.mtime):i.isSymbolicLink()||this.utimesSync(e,i.atime,i.mtime)}};Ns.DEFAULT_TIME=315532800;var Ya=class extends Ns{constructor(){super(D)}};function Xoe(t){let e=t.match(/\r?\n/g);if(e===null)return LN.EOL;let r=e.filter(n=>n===`\r
|
||||
`).length,i=e.length-r;return r>i?`\r
|
||||
`:`
|
||||
`}function Dl(t,e){return e.replace(/\r?\n/g,Xoe(t))}var Sl=te(require("fs")),Ew=te(require("stream")),KN=te(require("util")),yw=te(require("zlib"));var MN=te(require("fs"));var Ft=class extends Ya{constructor(e=MN.default){super();this.realFs=e,typeof this.realFs.lutimes!="undefined"&&(this.lutimesPromise=this.lutimesPromiseImpl,this.lutimesSync=this.lutimesSyncImpl)}getExtractHint(){return!1}getRealPath(){return we.root}resolve(e){return D.resolve(e)}async openPromise(e,r,i){return await new Promise((n,s)=>{this.realFs.open(T.fromPortablePath(e),r,i,this.makeCallback(n,s))})}openSync(e,r,i){return this.realFs.openSync(T.fromPortablePath(e),r,i)}async opendirPromise(e,r){return await new Promise((i,n)=>{typeof r!="undefined"?this.realFs.opendir(T.fromPortablePath(e),r,this.makeCallback(i,n)):this.realFs.opendir(T.fromPortablePath(e),this.makeCallback(i,n))}).then(i=>Object.defineProperty(i,"path",{value:e,configurable:!0,writable:!0}))}opendirSync(e,r){let i=typeof r!="undefined"?this.realFs.opendirSync(T.fromPortablePath(e),r):this.realFs.opendirSync(T.fromPortablePath(e));return Object.defineProperty(i,"path",{value:e,configurable:!0,writable:!0})}async readPromise(e,r,i=0,n=0,s=-1){return await new Promise((o,a)=>{this.realFs.read(e,r,i,n,s,(l,c)=>{l?a(l):o(c)})})}readSync(e,r,i,n,s){return this.realFs.readSync(e,r,i,n,s)}async writePromise(e,r,i,n,s){return await new Promise((o,a)=>typeof r=="string"?this.realFs.write(e,r,i,this.makeCallback(o,a)):this.realFs.write(e,r,i,n,s,this.makeCallback(o,a)))}writeSync(e,r,i,n,s){return typeof r=="string"?this.realFs.writeSync(e,r,i):this.realFs.writeSync(e,r,i,n,s)}async closePromise(e){await new Promise((r,i)=>{this.realFs.close(e,this.makeCallback(r,i))})}closeSync(e){this.realFs.closeSync(e)}createReadStream(e,r){let i=e!==null?T.fromPortablePath(e):e;return this.realFs.createReadStream(i,r)}createWriteStream(e,r){let i=e!==null?T.fromPortablePath(e):e;return this.realFs.createWriteStream(i,r)}async realpathPromise(e){return await new Promise((r,i)=>{this.realFs.realpath(T.fromPortablePath(e),{},this.makeCallback(r,i))}).then(r=>T.toPortablePath(r))}realpathSync(e){return T.toPortablePath(this.realFs.realpathSync(T.fromPortablePath(e),{}))}async existsPromise(e){return await new Promise(r=>{this.realFs.exists(T.fromPortablePath(e),r)})}accessSync(e,r){return this.realFs.accessSync(T.fromPortablePath(e),r)}async accessPromise(e,r){return await new Promise((i,n)=>{this.realFs.access(T.fromPortablePath(e),r,this.makeCallback(i,n))})}existsSync(e){return this.realFs.existsSync(T.fromPortablePath(e))}async statPromise(e,r){return await new Promise((i,n)=>{r?this.realFs.stat(T.fromPortablePath(e),r,this.makeCallback(i,n)):this.realFs.stat(T.fromPortablePath(e),this.makeCallback(i,n))})}statSync(e,r){return r?this.realFs.statSync(T.fromPortablePath(e),r):this.realFs.statSync(T.fromPortablePath(e))}async fstatPromise(e,r){return await new Promise((i,n)=>{r?this.realFs.fstat(e,r,this.makeCallback(i,n)):this.realFs.fstat(e,this.makeCallback(i,n))})}fstatSync(e,r){return r?this.realFs.fstatSync(e,r):this.realFs.fstatSync(e)}async lstatPromise(e,r){return await new Promise((i,n)=>{r?this.realFs.lstat(T.fromPortablePath(e),r,this.makeCallback(i,n)):this.realFs.lstat(T.fromPortablePath(e),this.makeCallback(i,n))})}lstatSync(e,r){return r?this.realFs.lstatSync(T.fromPortablePath(e),r):this.realFs.lstatSync(T.fromPortablePath(e))}async chmodPromise(e,r){return await new Promise((i,n)=>{this.realFs.chmod(T.fromPortablePath(e),r,this.makeCallback(i,n))})}chmodSync(e,r){return this.realFs.chmodSync(T.fromPortablePath(e),r)}async chownPromise(e,r,i){return await new Promise((n,s)=>{this.realFs.chown(T.fromPortablePath(e),r,i,this.makeCallback(n,s))})}chownSync(e,r,i){return this.realFs.chownSync(T.fromPortablePath(e),r,i)}async renamePromise(e,r){return await new Promise((i,n)=>{this.realFs.rename(T.fromPortablePath(e),T.fromPortablePath(r),this.makeCallback(i,n))})}renameSync(e,r){return this.realFs.renameSync(T.fromPortablePath(e),T.fromPortablePath(r))}async copyFilePromise(e,r,i=0){return await new Promise((n,s)=>{this.realFs.copyFile(T.fromPortablePath(e),T.fromPortablePath(r),i,this.makeCallback(n,s))})}copyFileSync(e,r,i=0){return this.realFs.copyFileSync(T.fromPortablePath(e),T.fromPortablePath(r),i)}async appendFilePromise(e,r,i){return await new Promise((n,s)=>{let o=typeof e=="string"?T.fromPortablePath(e):e;i?this.realFs.appendFile(o,r,i,this.makeCallback(n,s)):this.realFs.appendFile(o,r,this.makeCallback(n,s))})}appendFileSync(e,r,i){let n=typeof e=="string"?T.fromPortablePath(e):e;i?this.realFs.appendFileSync(n,r,i):this.realFs.appendFileSync(n,r)}async writeFilePromise(e,r,i){return await new Promise((n,s)=>{let o=typeof e=="string"?T.fromPortablePath(e):e;i?this.realFs.writeFile(o,r,i,this.makeCallback(n,s)):this.realFs.writeFile(o,r,this.makeCallback(n,s))})}writeFileSync(e,r,i){let n=typeof e=="string"?T.fromPortablePath(e):e;i?this.realFs.writeFileSync(n,r,i
Line truncated
|
||||
|
||||
${I}`),{code:Uw(h,p),stdout:m,stderr:I}))})})}var vae=new Map([["SIGINT",2],["SIGQUIT",3],["SIGKILL",9],["SIGTERM",15]]);function Uw(t,e){let r=vae.get(e);return typeof r!="undefined"?128+r:t!=null?t:1}var Hw={};et(Hw,{getDefaultGlobalFolder:()=>jw,getHomeFolder:()=>vg,isFolderInside:()=>Gw});var Yw=te(require("os"));function jw(){if(process.platform==="win32"){let t=T.toPortablePath(process.env.LOCALAPPDATA||T.join((0,Yw.homedir)(),"AppData","Local"));return D.resolve(t,"Yarn/Berry")}if(process.env.XDG_DATA_HOME){let t=T.toPortablePath(process.env.XDG_DATA_HOME);return D.resolve(t,"yarn/berry")}return D.resolve(vg(),".yarn/berry")}function vg(){return T.toPortablePath((0,Yw.homedir)()||"/usr/local/share")}function Gw(t,e){let r=D.relative(e,t);return r&&!r.startsWith("..")&&!D.isAbsolute(r)}var Ae={};et(Ae,{LogLevel:()=>Ln,Style:()=>pA,Type:()=>Pe,addLogFilterSupport:()=>Bf,applyColor:()=>Gi,applyHyperlink:()=>tc,applyStyle:()=>Hm,json:()=>rc,mark:()=>ib,pretty:()=>qe,prettyField:()=>CA,prettyList:()=>hb,supportsColor:()=>Km,supportsHyperlinks:()=>gb,tuple:()=>dA});var yf=te(eQ()),K2=te(Ng()),U2=te(Yi()),H2=te(bT());var z;(function(_){_[_.UNNAMED=0]="UNNAMED",_[_.EXCEPTION=1]="EXCEPTION",_[_.MISSING_PEER_DEPENDENCY=2]="MISSING_PEER_DEPENDENCY",_[_.CYCLIC_DEPENDENCIES=3]="CYCLIC_DEPENDENCIES",_[_.DISABLED_BUILD_SCRIPTS=4]="DISABLED_BUILD_SCRIPTS",_[_.BUILD_DISABLED=5]="BUILD_DISABLED",_[_.SOFT_LINK_BUILD=6]="SOFT_LINK_BUILD",_[_.MUST_BUILD=7]="MUST_BUILD",_[_.MUST_REBUILD=8]="MUST_REBUILD",_[_.BUILD_FAILED=9]="BUILD_FAILED",_[_.RESOLVER_NOT_FOUND=10]="RESOLVER_NOT_FOUND",_[_.FETCHER_NOT_FOUND=11]="FETCHER_NOT_FOUND",_[_.LINKER_NOT_FOUND=12]="LINKER_NOT_FOUND",_[_.FETCH_NOT_CACHED=13]="FETCH_NOT_CACHED",_[_.YARN_IMPORT_FAILED=14]="YARN_IMPORT_FAILED",_[_.REMOTE_INVALID=15]="REMOTE_INVALID",_[_.REMOTE_NOT_FOUND=16]="REMOTE_NOT_FOUND",_[_.RESOLUTION_PACK=17]="RESOLUTION_PACK",_[_.CACHE_CHECKSUM_MISMATCH=18]="CACHE_CHECKSUM_MISMATCH",_[_.UNUSED_CACHE_ENTRY=19]="UNUSED_CACHE_ENTRY",_[_.MISSING_LOCKFILE_ENTRY=20]="MISSING_LOCKFILE_ENTRY",_[_.WORKSPACE_NOT_FOUND=21]="WORKSPACE_NOT_FOUND",_[_.TOO_MANY_MATCHING_WORKSPACES=22]="TOO_MANY_MATCHING_WORKSPACES",_[_.CONSTRAINTS_MISSING_DEPENDENCY=23]="CONSTRAINTS_MISSING_DEPENDENCY",_[_.CONSTRAINTS_INCOMPATIBLE_DEPENDENCY=24]="CONSTRAINTS_INCOMPATIBLE_DEPENDENCY",_[_.CONSTRAINTS_EXTRANEOUS_DEPENDENCY=25]="CONSTRAINTS_EXTRANEOUS_DEPENDENCY",_[_.CONSTRAINTS_INVALID_DEPENDENCY=26]="CONSTRAINTS_INVALID_DEPENDENCY",_[_.CANT_SUGGEST_RESOLUTIONS=27]="CANT_SUGGEST_RESOLUTIONS",_[_.FROZEN_LOCKFILE_EXCEPTION=28]="FROZEN_LOCKFILE_EXCEPTION",_[_.CROSS_DRIVE_VIRTUAL_LOCAL=29]="CROSS_DRIVE_VIRTUAL_LOCAL",_[_.FETCH_FAILED=30]="FETCH_FAILED",_[_.DANGEROUS_NODE_MODULES=31]="DANGEROUS_NODE_MODULES",_[_.NODE_GYP_INJECTED=32]="NODE_GYP_INJECTED",_[_.AUTHENTICATION_NOT_FOUND=33]="AUTHENTICATION_NOT_FOUND",_[_.INVALID_CONFIGURATION_KEY=34]="INVALID_CONFIGURATION_KEY",_[_.NETWORK_ERROR=35]="NETWORK_ERROR",_[_.LIFECYCLE_SCRIPT=36]="LIFECYCLE_SCRIPT",_[_.CONSTRAINTS_MISSING_FIELD=37]="CONSTRAINTS_MISSING_FIELD",_[_.CONSTRAINTS_INCOMPATIBLE_FIELD=38]="CONSTRAINTS_INCOMPATIBLE_FIELD",_[_.CONSTRAINTS_EXTRANEOUS_FIELD=39]="CONSTRAINTS_EXTRANEOUS_FIELD",_[_.CONSTRAINTS_INVALID_FIELD=40]="CONSTRAINTS_INVALID_FIELD",_[_.AUTHENTICATION_INVALID=41]="AUTHENTICATION_INVALID",_[_.PROLOG_UNKNOWN_ERROR=42]="PROLOG_UNKNOWN_ERROR",_[_.PROLOG_SYNTAX_ERROR=43]="PROLOG_SYNTAX_ERROR",_[_.PROLOG_EXISTENCE_ERROR=44]="PROLOG_EXISTENCE_ERROR",_[_.STACK_OVERFLOW_RESOLUTION=45]="STACK_OVERFLOW_RESOLUTION",_[_.AUTOMERGE_FAILED_TO_PARSE=46]="AUTOMERGE_FAILED_TO_PARSE",_[_.AUTOMERGE_IMMUTABLE=47]="AUTOMERGE_IMMUTABLE",_[_.AUTOMERGE_SUCCESS=48]="AUTOMERGE_SUCCESS",_[_.AUTOMERGE_REQUIRED=49]="AUTOMERGE_REQUIRED",_[_.DEPRECATED_CLI_SETTINGS=50]="DEPRECATED_CLI_SETTINGS",_[_.PLUGIN_NAME_NOT_FOUND=51]="PLUGIN_NAME_NOT_FOUND",_[_.INVALID_PLUGIN_REFERENCE=52]="INVALID_PLUGIN_REFERENCE",_[_.CONSTRAINTS_AMBIGUITY=53]="CONSTRAINTS_AMBIGUITY",_[_.CACHE_OUTSIDE_PROJECT=54]="CACHE_OUTSIDE_PROJECT",_[_.IMMUTABLE_INSTALL=55]="IMMUTABLE_INSTALL",_[_.IMMUTABLE_CACHE=56]="IMMUTABLE_CACHE",_[_.INVALID_MANIFEST=57]="INVALID_MANIFEST",_[_.PACKAGE_PREPARATION_FAILED=58]="PACKAGE_PREPARATION_FAILED",_[_.INVALID_RANGE_PEER_DEPENDENCY=59]="INVALID_RANGE_PEER_DEPENDENCY",_[_.INCOMPATIBLE_PEER_DEPENDENCY=60]="INCOMPATIBLE_PEER_DEPENDENCY",_[_.DEPRECATED_PACKAGE=61]="DEPRECATED_PACKAGE",_[_.INCOMPATIBLE_OS=62]="INCOMPATIBLE_OS",_[_.INCOMPATIBLE_CPU=63]="INCOMPATIBLE_CPU",_[_.FROZEN_ARTIFACT_EXCEPTION=64]="FROZEN_ARTIFACT_EXCEPTION",_[_.TELEMETRY_NOTICE=65]="TELEMETRY_NOTICE",_[_.PATCH_HUNK_FAILED=66]="PATCH_HUNK_FAILED",_[_.INVALID_CONFIGURATION_VALUE=67]="INVALID_CONFIGURATION_VALUE",_[_.UNUSED_PACKAGE_EXTENSION=68]="UNUSED_PACKAGE_EXTENSION",_[_.REDUNDANT_PACKAGE_EXTENSION=69]="REDUNDANT_PACKAGE_EXTENSION",_[_.AUTO_NM_SUCCESS=70]="AUTO_NM_SUCCESS",_[_.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK=71]="NM_CANT_INSTALL_EXTERNAL_SOFT_LINK",_[_.NM_PRESERVE_SYMLINK
Line truncated
|
||||
|
||||
${this.candidates.map(({usage:n})=>`$ ${n}`).join(`
|
||||
`)}`}else if(this.candidates.length===1){let[{usage:i}]=this.candidates;this.message=`Command not found; did you mean:
|
||||
|
||||
$ ${i}
|
||||
${EQ(e)}`}else this.message=`Command not found; did you mean one of:
|
||||
|
||||
${this.candidates.map(({usage:i},n)=>`${`${n}.`.padStart(4)} ${i}`).join(`
|
||||
`)}
|
||||
|
||||
${EQ(e)}`}},yQ=class extends Error{constructor(e,r){super();this.input=e,this.usages=r,this.clipanion={type:"none"},this.name="AmbiguousSyntaxError",this.message=`Cannot find which to pick amongst the following alternatives:
|
||||
|
||||
${this.usages.map((i,n)=>`${`${n}.`.padStart(4)} ${i}`).join(`
|
||||
`)}
|
||||
|
||||
${EQ(e)}`}},EQ=t=>`While running ${t.filter(e=>e!==Mr).map(e=>{let r=JSON.stringify(e);return e.match(/\s/)||e.length===0||r!==`"${e}"`?r:e}).join(" ")}`;var Hg=Symbol("clipanion/isOption");function ii(t){return V(v({},t),{[Hg]:!0})}function es(t,e){return typeof t=="undefined"?[t,e]:typeof t=="object"&&t!==null&&!Array.isArray(t)?[void 0,t]:[t,e]}function OC(t,e=!1){let r=t.replace(/^\.: /,"");return e&&(r=r[0].toLowerCase()+r.slice(1)),r}function Yg(t,e){return e.length===1?new me(`${t}: ${OC(e[0],!0)}`):new me(`${t}:
|
||||
${e.map(r=>`
|
||||
- ${OC(r)}`).join("")}`)}function jg(t,e,r){if(typeof r=="undefined")return e;let i=[],n=[],s=a=>{let l=e;return e=a,s.bind(null,l)};if(!r(e,{errors:i,coercions:n,coercion:s}))throw Yg(`Invalid value for ${t}`,i);for(let[,a]of n)a();return e}var he=class{constructor(){this.help=!1}static Usage(e){return e}async catch(e){throw e}async validateAndExecute(){let r=this.constructor.schema;if(typeof r!="undefined"){let{isDict:n,isUnknown:s,applyCascade:o}=await Promise.resolve().then(()=>(Pn(),Tl)),a=o(n(s()),r),l=[],c=[];if(!a(this,{errors:l,coercions:c}))throw Yg("Invalid option schema",l);for(let[,g]of c)g()}let i=await this.execute();return typeof i!="undefined"?i:0}};he.isOption=Hg;he.Default=[];function Qi(t){IQ&&console.log(t)}var MT={candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,path:[],positionals:[],options:[],remainder:null,selectedIndex:Ml};function TT(){return{nodes:[si(),si(),si()]}}function $le(t){let e=TT(),r=[],i=e.nodes.length;for(let n of t){r.push(i);for(let s=0;s<n.nodes.length;++s)OT(s)||e.nodes.push(_le(n.nodes[s],i));i+=n.nodes.length-2}for(let n of r)Ol(e,Za,n);return e}function Fn(t,e){return t.nodes.push(e),t.nodes.length-1}function ece(t){let e=new Set,r=i=>{if(e.has(i))return;e.add(i);let n=t.nodes[i];for(let o of Object.values(n.statics))for(let{to:a}of o)r(a);for(let[,{to:o}]of n.dynamics)r(o);for(let{to:o}of n.shortcuts)r(o);let s=new Set(n.shortcuts.map(({to:o})=>o));for(;n.shortcuts.length>0;){let{to:o}=n.shortcuts.shift(),a=t.nodes[o];for(let[l,c]of Object.entries(a.statics)){let u=Object.prototype.hasOwnProperty.call(n.statics,l)?n.statics[l]:n.statics[l]=[];for(let g of c)u.some(({to:f})=>g.to===f)||u.push(g)}for(let[l,c]of a.dynamics)n.dynamics.some(([u,{to:g}])=>l===u&&c.to===g)||n.dynamics.push([l,c]);for(let l of a.shortcuts)s.has(l.to)||(n.shortcuts.push(l),s.add(l.to))}};r(Za)}function tce(t,{prefix:e=""}={}){if(IQ){Qi(`${e}Nodes are:`);for(let r=0;r<t.nodes.length;++r)Qi(`${e} ${r}: ${JSON.stringify(t.nodes[r])}`)}}function KT(t,e,r=!1){Qi(`Running a vm on ${JSON.stringify(e)}`);let i=[{node:Za,state:{candidateUsage:null,requiredOptions:[],errorMessage:null,ignoreOptions:!1,options:[],path:[],positionals:[],remainder:null,selectedIndex:null}}];tce(t,{prefix:" "});let n=[dQ,...e];for(let s=0;s<n.length;++s){let o=n[s];Qi(` Processing ${JSON.stringify(o)}`);let a=[];for(let{node:l,state:c}of i){Qi(` Current node is ${l}`);let u=t.nodes[l];if(l===ri){a.push({node:l,state:c});continue}console.assert(u.shortcuts.length===0,"Shortcuts should have been eliminated by now");let g=Object.prototype.hasOwnProperty.call(u.statics,o);if(!r||s<n.length-1||g)if(g){let f=u.statics[o];for(let{to:h,reducer:p}of f)a.push({node:h,state:typeof p!="undefined"?UC(SQ,p,c,o):c}),Qi(` Static transition to ${h} found`)}else Qi(" No static transition found");else{let f=!1;for(let h of Object.keys(u.statics))if(!!h.startsWith(o)){if(o===h)for(let{to:p,reducer:m}of u.statics[h])a.push({node:p,state:typeof m!="undefined"?UC(SQ,m,c,o):c}),Qi(` Static transition to ${p} found`);else for(let{to:p}of u.statics[h])a.push({node:p,state:V(v({},c),{remainder:h.slice(o.length)})}),Qi(` Static transition to ${p} found (partial match)`);f=!0}f||Qi(" No partial static transition found")}if(o!==Mr)for(let[f,{to:h,reducer:p}]of u.dynamics)UC(HC,f,c,o)&&(a.push({node:h,state:typeof p!="undefined"?UC(SQ,p,c,o):c}),Qi(` Dynamic transition to ${h} found (via ${f})`))}if(a.length===0&&o===Mr&&e.length===1)return[{node:Za,state:MT}];if(a.length===0)throw new Ug(e,i.filter(({node:l})=>l!==ri).map(({state:l})=>({usage:l.candidateUsage,reason:null})));if(a.every(({node:l})=>l===ri))throw new Ug(e,a.map(({state:l})=>({usage:l.candidateUsage,reason:l.errorMessage})));i=rce(a)}if(i.length>0){Qi(" Results:");for(let s of i)Qi(` - ${s.node} -> ${JSON.stringify(s.state)}`)}else Qi(" No results");return i}function ice(t,e){if(e.selectedIndex!==null)return!0;if(Object.prototype.hasOwnProperty.call(t.statics,Mr)){for(let{to:r}of t.statics[Mr])if(r===Kg)return!0}return!1}function sce(t,e,r){let i=r&&e.length>0?[""]:[],n=KT(t,e,r),s=[],o=new Set,a=(l,c,u=!0)=>{let g=[c];for(;g.length>0;){let h=g;g=[];for(let p of h){let m=t.nodes[p],I=Object.keys(m.statics);for(let y of Object.keys(m.statics)){let B=I[0];for(let{to:x,reducer:F}of m.statics[B])F==="pushPath"&&(u||l.push(B),g.push(x))}}u=!1}let f=JSON.stringify(l);o.has(f)||(s.push(l),o.add(f))};for(let{node:l,state:c}of n){if(c.remainder!==null){a([c.remainder],l);continue}let u=t.nodes[l],g=ice(u,c);for(let[f,h]of Object.entries(u.statics))(g&&f!==Mr||!f.startsWith("-")&&h.some(({reducer:p})=>p==="pushPath"))&&a([...i,f],l);if(!!g)for(let[f,{to:h}]of u.dynamics){if(h===ri)continue;let p=nce(f,c);if(p!==null)for(let m of p)a([...i,m],l)}}return[...s].sort()}function ace(t,e){let r=KT(t,[...e,Mr]);return oce(e,r.map(({state:i})=>i))}function rce(t){let e=0;for(let{state:r}of t)r.path.length>e&&(e=r.path.length);returnLine truncated
|
||||
`),r=e.filter(n=>n.match(/\S/)),i=r.length>0?r.reduce((n,s)=>Math.min(n,s.length-s.trimStart().length),Number.MAX_VALUE):0;return e.map(n=>n.slice(i).trimRight()).join(`
|
||||
`)}function An(t,{format:e,paragraphs:r}){return t=t.replace(/\r\n?/g,`
|
||||
`),t=lce(t),t=t.replace(/^\n+|\n+$/g,""),t=t.replace(/^(\s*)-([^\n]*?)\n+/gm,`$1-$2
|
||||
|
||||
`),t=t.replace(/\n(\n)?\n*/g,"$1"),r&&(t=t.split(/\n/).map(i=>{let n=i.match(/^\s*[*-][\t ]+(.*)/);if(!n)return i.match(/(.{1,80})(?: |$)/g).join(`
|
||||
`);let s=i.length-i.trimStart().length;return n[1].match(new RegExp(`(.{1,${78-s}})(?: |$)`,"g")).map((o,a)=>" ".repeat(s)+(a===0?"- ":" ")+o).join(`
|
||||
`)}).join(`
|
||||
|
||||
`)),t=t.replace(/(`+)((?:.|[\n])*?)\1/g,(i,n,s)=>e.code(n+s+n)),t=t.replace(/(\*\*)((?:.|[\n])*?)\1/g,(i,n,s)=>e.bold(n+s+n)),t?`${t}
|
||||
`:""}var qg=class extends he{constructor(e){super();this.contexts=e,this.commands=[]}static from(e,r){let i=new qg(r);i.path=e.path;for(let n of e.options)switch(n.name){case"-c":i.commands.push(Number(n.value));break;case"-i":i.index=Number(n.value);break}return i}async execute(){let e=this.commands;if(typeof this.index!="undefined"&&this.index>=0&&this.index<e.length&&(e=[e[this.index]]),e.length===0)this.context.stdout.write(this.cli.usage());else if(e.length===1)this.context.stdout.write(this.cli.usage(this.contexts[e[0]].commandClass,{detailed:!0}));else if(e.length>1){this.context.stdout.write(`Multiple commands match your selection:
|
||||
`),this.context.stdout.write(`
|
||||
`);let r=0;for(let i of this.commands)this.context.stdout.write(this.cli.usage(this.contexts[i].commandClass,{prefix:`${r++}. `.padStart(5)}));this.context.stdout.write(`
|
||||
`),this.context.stdout.write(`Run again with -h=<index> to see the longer details of any of those commands.
|
||||
`)}}};var GT=Symbol("clipanion/errorCommand");function cce(){return process.env.FORCE_COLOR==="0"?!1:!!(process.env.FORCE_COLOR==="1"||typeof process.stdout!="undefined"&&process.stdout.isTTY)}var ts=class{constructor({binaryLabel:e,binaryName:r="...",binaryVersion:i,enableColors:n=cce()}={}){this.registrations=new Map,this.builder=new Gg({binaryName:r}),this.binaryLabel=e,this.binaryName=r,this.binaryVersion=i,this.enableColors=n}static from(e,r={}){let i=new ts(r);for(let n of e)i.register(n);return i}register(e){var r;let i=new Map,n=new e;for(let l in n){let c=n[l];typeof c=="object"&&c!==null&&c[he.isOption]&&i.set(l,c)}let s=this.builder.command(),o=s.cliIndex,a=(r=e.paths)!==null&&r!==void 0?r:n.paths;if(typeof a!="undefined")for(let l of a)s.addPath(l);this.registrations.set(e,{specs:i,builder:s,index:o});for(let[l,{definition:c}]of i.entries())c(s,l);s.setContext({commandClass:e})}process(e){let{contexts:r,process:i}=this.builder.compile(),n=i(e);switch(n.selectedIndex){case Ml:return qg.from(n,r);default:{let{commandClass:s}=r[n.selectedIndex],o=this.registrations.get(s);if(typeof o=="undefined")throw new Error("Assertion failed: Expected the command class to have been registered.");let a=new s;a.path=n.path;try{for(let[l,{transformer:c}]of o.specs.entries())a[l]=c(o.builder,l,n);return a}catch(l){throw l[GT]=a,l}}break}}async run(e,r){let i;if(!Array.isArray(e))i=e;else try{i=this.process(e)}catch(s){return r.stdout.write(this.error(s)),1}if(i.help)return r.stdout.write(this.usage(i,{detailed:!0})),0;i.context=r,i.cli={binaryLabel:this.binaryLabel,binaryName:this.binaryName,binaryVersion:this.binaryVersion,enableColors:this.enableColors,definitions:()=>this.definitions(),error:(s,o)=>this.error(s,o),process:s=>this.process(s),run:(s,o)=>this.run(s,v(v({},r),o)),usage:(s,o)=>this.usage(s,o)};let n;try{n=await i.validateAndExecute().catch(s=>i.catch(s).then(()=>0))}catch(s){return r.stdout.write(this.error(s,{command:i})),1}return n}async runExit(e,r){process.exitCode=await this.run(e,r)}suggest(e,r){let{suggest:i}=this.builder.compile();return i(e,r)}definitions({colored:e=!1}={}){let r=[];for(let[i,{index:n}]of this.registrations){if(typeof i.usage=="undefined")continue;let{usage:s}=this.getUsageByIndex(n,{detailed:!1}),{usage:o,options:a}=this.getUsageByIndex(n,{detailed:!0,inlineOptions:!1}),l=typeof i.usage.category!="undefined"?An(i.usage.category,{format:this.format(e),paragraphs:!1}):void 0,c=typeof i.usage.description!="undefined"?An(i.usage.description,{format:this.format(e),paragraphs:!1}):void 0,u=typeof i.usage.details!="undefined"?An(i.usage.details,{format:this.format(e),paragraphs:!0}):void 0,g=typeof i.usage.examples!="undefined"?i.usage.examples.map(([f,h])=>[An(f,{format:this.format(e),paragraphs:!1}),h.replace(/\$0/g,this.binaryName)]):void 0;r.push({path:s,usage:o,category:l,description:c,details:u,examples:g,options:a})}return r}usage(e=null,{colored:r,detailed:i=!1,prefix:n="$ "}={}){var s;if(e===null){for(let l of this.registrations.keys()){let c=l.paths,u=typeof l.usage!="undefined";if(!c||c.length===0||c.length===1&&c[0].length===0||((s=c==null?void 0:c.some(h=>h.length===0))!==null&&s!==void 0?s:!1))if(e){e=null;break}else e=l;else if(u){e=null;continue}}e&&(i=!0)}let o=e!==null&&e instanceof he?e.constructor:e,a="";if(o)if(i){let{description:l="",details:c="",examples:u=[]}=o.usage||{};l!==""&&(a+=An(l,{format:this.format(r),paragraphs:!1}).replace(/^./,h=>h.toUpperCase()),a+=`
|
||||
`),(c!==""||u.length>0)&&(a+=`${this.format(r).header("Usage")}
|
||||
`,a+=`
|
||||
`);let{usage:g,options:f}=this.getUsageByRegistration(o,{inlineOptions:!1});if(a+=`${this.format(r).bold(n)}${g}
|
||||
`,f.length>0){a+=`
|
||||
`,a+=`${vQ.header("Options")}
|
||||
`;let h=f.reduce((p,m)=>Math.max(p,m.definition.length),0);a+=`
|
||||
`;for(let{definition:p,description:m}of f)a+=` ${this.format(r).bold(p.padEnd(h))} ${An(m,{format:this.format(r),paragraphs:!1})}`}if(c!==""&&(a+=`
|
||||
`,a+=`${this.format(r).header("Details")}
|
||||
`,a+=`
|
||||
`,a+=An(c,{format:this.format(r),paragraphs:!0})),u.length>0){a+=`
|
||||
`,a+=`${this.format(r).header("Examples")}
|
||||
`;for(let[h,p]of u)a+=`
|
||||
`,a+=An(h,{format:this.format(r),paragraphs:!1}),a+=`${p.replace(/^/m,` ${this.format(r).bold(n)}`).replace(/\$0/g,this.binaryName)}
|
||||
`}}else{let{usage:l}=this.getUsageByRegistration(o);a+=`${this.format(r).bold(n)}${l}
|
||||
`}else{let l=new Map;for(let[f,{index:h}]of this.registrations.entries()){if(typeof f.usage=="undefined")continue;let p=typeof f.usage.category!="undefined"?An(f.usage.category,{format:this.format(r),paragraphs:!1}):null,m=l.get(p);typeof m=="undefined"&&l.set(p,m=[]);let{usage:I}=this.getUsageByIndex(h);m.push({commandClass:f,usage:I})}let c=Array.from(l.keys()).sort((f,h)=>f===null?-1:h===null?1:f.localeCompare(h,"en",{usage:"sort",caseFirst:"upper"})),u=typeof this.binaryLabel!="undefined",g=typeof this.binaryVersion!="undefined";u||g?(u&&g?a+=`${this.format(r).header(`${this.binaryLabel} - ${this.binaryVersion}`)}
|
||||
|
||||
`:u?a+=`${this.format(r).header(`${this.binaryLabel}`)}
|
||||
`:a+=`${this.format(r).header(`${this.binaryVersion}`)}
|
||||
`,a+=` ${this.format(r).bold(n)}${this.binaryName} <command>
|
||||
`):a+=`${this.format(r).bold(n)}${this.binaryName} <command>
|
||||
`;for(let f of c){let h=l.get(f).slice().sort((m,I)=>m.usage.localeCompare(I.usage,"en",{usage:"sort",caseFirst:"upper"})),p=f!==null?f.trim():"General commands";a+=`
|
||||
`,a+=`${this.format(r).header(`${p}`)}
|
||||
`;for(let{commandClass:m,usage:I}of h){let y=m.usage.description||"undocumented";a+=`
|
||||
`,a+=` ${this.format(r).bold(I)}
|
||||
`,a+=` ${An(y,{format:this.format(r),paragraphs:!1})}`}}a+=`
|
||||
`,a+=An("You can also print more details about any of these commands by calling them with the `-h,--help` flag right after the command name.",{format:this.format(r),paragraphs:!0})}return a}error(e,r){var i,{colored:n,command:s=(i=e[GT])!==null&&i!==void 0?i:null}=r===void 0?{}:r;e instanceof Error||(e=new Error(`Execution failed with a non-error rejection (rejected value: ${JSON.stringify(e)})`));let o="",a=e.name.replace(/([a-z])([A-Z])/g,"$1 $2");a==="Error"&&(a="Internal Error"),o+=`${this.format(n).error(a)}: ${e.message}
|
||||
`;let l=e.clipanion;return typeof l!="undefined"?l.type==="usage"&&(o+=`
|
||||
`,o+=this.usage(s)):e.stack&&(o+=`${e.stack.replace(/^.*\n/,"")}
|
||||
`),o}getUsageByRegistration(e,r){let i=this.registrations.get(e);if(typeof i=="undefined")throw new Error("Assertion failed: Unregistered command");return this.getUsageByIndex(i.index,r)}getUsageByIndex(e,r){return this.builder.getBuilderByIndex(e).usage(r)}format(e=this.enableColors){return e?vQ:jT}};ts.defaultContext={stdin:process.stdin,stdout:process.stdout,stderr:process.stderr};var PQ={};et(PQ,{DefinitionsCommand:()=>YC,HelpCommand:()=>jC,VersionCommand:()=>GC});var YC=class extends he{async execute(){this.context.stdout.write(`${JSON.stringify(this.cli.definitions(),null,2)}
|
||||
`)}};YC.paths=[["--clipanion=definitions"]];var jC=class extends he{async execute(){this.context.stdout.write(this.cli.usage())}};jC.paths=[["-h"],["--help"]];var GC=class extends he{async execute(){var e;this.context.stdout.write(`${(e=this.cli.binaryVersion)!==null&&e!==void 0?e:"<unknown>"}
|
||||
`)}};GC.paths=[["-v"],["--version"]];var j={};et(j,{Array:()=>qT,Boolean:()=>JT,Counter:()=>WT,Proxy:()=>zT,Rest:()=>VT,String:()=>XT,applyValidator:()=>jg,cleanValidationError:()=>OC,formatError:()=>Yg,isOptionSymbol:()=>Hg,makeCommandOption:()=>ii,rerouteArguments:()=>es});function qT(t,e,r){let[i,n]=es(e,r!=null?r:{}),{arity:s=1}=n,o=t.split(","),a=new Set(o);return ii({definition(l){l.addOption({names:o,arity:s,hidden:n==null?void 0:n.hidden,description:n==null?void 0:n.description,required:n.required})},transformer(l,c,u){let g=typeof i!="undefined"?[...i]:void 0;for(let{name:f,value:h}of u.options)!a.has(f)||(g=g!=null?g:[],g.push(h));return g}})}function JT(t,e,r){let[i,n]=es(e,r!=null?r:{}),s=t.split(","),o=new Set(s);return ii({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u=f);return u}})}function WT(t,e,r){let[i,n]=es(e,r!=null?r:{}),s=t.split(","),o=new Set(s);return ii({definition(a){a.addOption({names:s,allowBinding:!1,arity:0,hidden:n.hidden,description:n.description,required:n.required})},transformer(a,l,c){let u=i;for(let{name:g,value:f}of c.options)!o.has(g)||(u!=null||(u=0),f?u+=1:u=0);return u}})}function zT(t={}){return ii({definition(e,r){var i;e.addProxy({name:(i=t.name)!==null&&i!==void 0?i:r,required:t.required})},transformer(e,r,i){return i.positionals.map(({value:n})=>n)}})}function VT(t={}){return ii({definition(e,r){var i;e.addRest({name:(i=t.name)!==null&&i!==void 0?i:r,required:t.required})},transformer(e,r,i){let n=o=>{let a=i.positionals[o];return a.extra===ji||a.extra===!1&&o<e.arity.leading.length},s=0;for(;s<i.positionals.length&&n(s);)s+=1;return i.positionals.splice(0,s).map(({value:o})=>o)}})}function uce(t,e,r){let[i,n]=es(e,r!=null?r:{}),{arity:s=1}=n,o=t.split(","),a=new Set(o);return ii({definition(l){l.addOption({names:o,arity:n.tolerateBoolean?0:s,hidden:n.hidden,description:n.description,required:n.required})},transformer(l,c,u){let g,f=i;for(let{name:h,value:p}of u.options)!a.has(h)||(g=h,f=p);return typeof f=="string"?jg(g!=null?g:c,f,n.validator):f}})}function gce(t={}){let{required:e=!0}=t;return ii({definition(r,i){var n;r.addPositional({name:(n=t.name)!==null&&n!==void 0?n:i,required:t.required})},transformer(r,i,n){var s;for(let o=0;o<n.positionals.length;++o){if(n.positionals[o].extra===ji||e&&n.positionals[o].extra===!0||!e&&n.positionals[o].extra===!1)continue;let[a]=n.positionals.splice(o,1);return jg((s=t.name)!==null&&s!==void 0?s:i,a.value,t.validator)}}})}function XT(t,...e){return typeof t=="string"?uce(t,...e):gce(t)}var JK=te(Yi()),WK=te(cr()),GQ=te(require("stream"));function yge(t){return WK.default.valid(t)&&t.match(/^[^-]+(-rc\.[0-9]+)?$/)}function Bge(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function qQ(t){}function JQ(t){throw new Error(`Assertion failed: Unexpected object '${t}'`)}function wge(t,e){let r=Object.values(t);if(!r.includes(e))throw new me(`Invalid value for enumeration: ${JSON.stringify(e)} (expected one of ${r.map(i=>JSON.stringify(i)).join(", ")})`);return e}function sA(t,e){let r=[];for(let i of t){let n=e(i);n!==zK&&r.push(n)}return r}var zK=Symbol();sA.skip=zK;function XK(t,e){for(let r of t){let i=e(r);if(i!==VK)return i}}var VK=Symbol();XK.skip=VK;function WQ(t){return typeof t=="object"&&t!==null}function nm(t){if(t instanceof Map&&(t=Object.fromEntries(t)),WQ(t))for(let e of Object.keys(t)){let r=t[e];WQ(r)&&(t[e]=nm(r))}return t}function Ys(t,e,r){let i=t.get(e);return typeof i=="undefined"&&t.set(e,i=r()),i}function Yl(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=[]),r}function oA(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=new Set),r}function jl(t,e){let r=t.get(e);return typeof r=="undefined"&&t.set(e,r=new Map),r}async function Qge(t,e){if(e==null)return await t();try{return await t()}finally{await e()}}async function Gl(t,e){try{return await t()}catch(r){throw r.message=e(r.message),r}}function zQ(t,e){try{return t()}catch(r){throw r.message=e(r.message),r}}async function af(t){return await new Promise((e,r)=>{let i=[];t.on("error",n=>{r(n)}),t.on("data",n=>{i.push(n)}),t.on("end",()=>{e(Buffer.concat(i))})})}var ZK=class extends GQ.Transform{constructor(){super(...arguments);this.chunks=[]}_transform(e,r,i){if(r!=="buffer"||!Buffer.isBuffer(e))throw new Error("Assertion failed: BufferStream only accept buffers");this.chunks.push(e),i(null,null)}_flush(e){e(null,Buffer.concat(this.chunks))}},_K=class extends GQ.Transform{constructor(e=Buffer.alloc(0)){super();this.active=!0;this.ifEmpty=e}_transform(e,r,i){if(r!=="buffer"||!Buffer.isBuffer(e))throw new Error("Assertion failed: DefaultStream only accept buffers");this.active=!1,i(null,e)}_flush(e){this.active&&this.ifEmpty.length>0?e(null,this.ifEmpty):e(null)}},Af=eval("require");function $K(t){return Af(T.fromPortablePath(t))}function eU(path){let physicalPath=T.fromPo
Line truncated
|
||||
`),a!==-1){let l=n+o.substr(0,a);o=o.substr(a+1),n="",e!==null?this.reportInfo(null,`${e} ${l}`):this.reportInfo(null,l)}while(a!==-1);n+=o}),r.on("end",()=>{let s=i.end();s!==""&&(e!==null?this.reportInfo(null,`${e} ${s}`):this.reportInfo(null,s))}),r}};var xj=te(sI()),kj=new Map,vj=new Map,AIe=new Sj.Agent({keepAlive:!0}),lIe=new Dj.Agent({keepAlive:!0});function Pj(t){let e=new oI.URL(t),r={host:e.hostname,headers:{}};return e.port&&(r.port=Number(e.port)),{proxy:r}}async function cIe(t){return Ys(vj,t,()=>L.readFilePromise(t).then(e=>(vj.set(t,e),e)))}function uIe({statusCode:t,statusMessage:e},r){let i=qe(r,t,Pe.NUMBER),n=`https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/${t}`;return tc(r,`${i}${e?` (${e})`:""}`,n)}async function aI(t,{configuration:e,customErrorMessage:r}){var i,n;try{return await t}catch(s){if(s.name!=="HTTPError")throw s;let o=(n=r==null?void 0:r(s))!=null?n:(i=s.response.body)==null?void 0:i.error;o==null&&(s.message.startsWith("Response code")?o="The remote server failed to provide the requested resource":o=s.message),s instanceof bj.TimeoutError&&s.event==="socket"&&(o+=`(can be increased via ${qe(e,"httpTimeout",Pe.SETTING)})`);let a=new _e(z.NETWORK_ERROR,o,l=>{s.response&&l.reportError(z.NETWORK_ERROR,` ${CA(e,{label:"Response Code",value:dA(Pe.NO_HINT,uIe(s.response,e))})}`),s.request&&(l.reportError(z.NETWORK_ERROR,` ${CA(e,{label:"Request Method",value:dA(Pe.NO_HINT,s.request.options.method)})}`),l.reportError(z.NETWORK_ERROR,` ${CA(e,{label:"Request URL",value:dA(Pe.URL,s.request.requestUrl)})}`)),s.request.redirects.length>0&&l.reportError(z.NETWORK_ERROR,` ${CA(e,{label:"Request Redirects",value:dA(Pe.NO_HINT,hb(e,s.request.redirects,Pe.URL))})}`),s.request.retryCount===s.request.options.retry.limit&&l.reportError(z.NETWORK_ERROR,` ${CA(e,{label:"Request Retry Count",value:dA(Pe.NO_HINT,`${qe(e,s.request.retryCount,Pe.NUMBER)} (can be increased via ${qe(e,"httpRetry",Pe.SETTING)})`)})}`)});throw a.originalError=s,a}}function Fj(t,e){let r=[...e.configuration.get("networkSettings")].sort(([o],[a])=>a.length-o.length),i={enableNetwork:void 0,caFilePath:void 0,httpProxy:void 0,httpsProxy:void 0},n=Object.keys(i),s=typeof t=="string"?new oI.URL(t):t;for(let[o,a]of r)if(kD.default.isMatch(s.hostname,o))for(let l of n){let c=a.get(l);c!==null&&typeof i[l]=="undefined"&&(i[l]=c)}for(let o of n)typeof i[o]=="undefined"&&(i[o]=e.configuration.get(o));return i}var IA;(function(n){n.GET="GET",n.PUT="PUT",n.POST="POST",n.DELETE="DELETE"})(IA||(IA={}));async function Rf(t,e,{configuration:r,headers:i,jsonRequest:n,jsonResponse:s,method:o=IA.GET}){let a=typeof t=="string"?new oI.URL(t):t,l=Fj(a,{configuration:r});if(l.enableNetwork===!1)throw new Error(`Request to '${a.href}' has been blocked because of your configuration settings`);if(a.protocol==="http:"&&!kD.default.isMatch(a.hostname,r.get("unsafeHttpWhitelist")))throw new Error(`Unsafe http requests must be explicitly whitelisted in your configuration (${a.hostname})`);let u={agent:{http:l.httpProxy?vD.default.httpOverHttp(Pj(l.httpProxy)):AIe,https:l.httpsProxy?vD.default.httpsOverHttp(Pj(l.httpsProxy)):lIe},headers:i,method:o};u.responseType=s?"json":"buffer",e!==null&&(Buffer.isBuffer(e)||!n&&typeof e=="string"?u.body=e:u.json=e);let g=r.get("httpTimeout"),f=r.get("httpRetry"),h=r.get("enableStrictSsl"),p=l.caFilePath,{default:m}=await Promise.resolve().then(()=>te(sI())),I=p?await cIe(p):void 0,y=m.extend(v({timeout:{socket:g},retry:f,https:{rejectUnauthorized:h,certificateAuthority:I}},u));return r.getLimit("networkConcurrency")(()=>y(a))}async function gIe(t,n){var s=n,{configuration:e,jsonResponse:r}=s,i=Rr(s,["configuration","jsonResponse"]);let o=Ys(kj,t,()=>aI(Rf(t,null,v({configuration:e},i)),{configuration:e}).then(a=>(kj.set(t,a.body),a.body)));return Buffer.isBuffer(o)===!1&&(o=await o),r?JSON.parse(o.toString()):o}async function fIe(t,e,n){var s=n,{customErrorMessage:r}=s,i=Rr(s,["customErrorMessage"]);return(await aI(Rf(t,e,V(v({},i),{method:IA.PUT})),i)).body}async function PD(t,e,n){var s=n,{customErrorMessage:r}=s,i=Rr(s,["customErrorMessage"]);return(await aI(Rf(t,e,V(v({},i),{method:IA.POST})),i)).body}async function hIe(t,i){var n=i,{customErrorMessage:e}=n,r=Rr(n,["customErrorMessage"]);return(await aI(Rf(t,null,V(v({},r),{method:IA.DELETE})),r)).body}var Qt={};et(Qt,{executePackageAccessibleBinary:()=>jW,executePackageScript:()=>VI,executePackageShellcode:()=>PS,executeWorkspaceAccessibleBinary:()=>qQe,executeWorkspaceLifecycleScript:()=>YW,executeWorkspaceScript:()=>HW,getPackageAccessibleBinaries:()=>XI,getWorkspaceAccessibleBinaries:()=>UW,hasPackageScript:()=>YQe,hasWorkspaceScript:()=>vS,makeScriptEnv:()=>$f,maybeExecuteWorkspaceLifecycleScript:()=>GQe,prepareExternalProject:()=>HQe});var Of={};et(Of,{getLibzipPromise:()=>gi,getLibzipSync:()=>oG});var _o=["number","number"],FD;(function(R){R[R.ZIP_ER_OK=0]="ZIP_ER_OK",R[R.ZIP_ER_MULTIDISK=1]="ZIP_ER_MULTIDISK",R[R.ZIP_ER_RENAME=2]="ZIP_E
Line truncated
|
||||
`;if(typeof t=="number"||typeof t=="boolean")return`${t.toString()}
|
||||
`;if(typeof t=="string")return`${aJ(t)}
|
||||
`;if(Array.isArray(t)){if(t.length===0)return`[]
|
||||
`;let i=" ".repeat(e);return`
|
||||
${t.map(s=>`${i}- ${dS(s,e+1,!1)}`).join("")}`}if(typeof t=="object"&&t){let i,n;t instanceof pS?(i=t.data,n=!1):(i=t,n=!0);let s=" ".repeat(e),o=Object.keys(i);n&&o.sort((l,c)=>{let u=oJ.indexOf(l),g=oJ.indexOf(c);return u===-1&&g===-1?l<c?-1:l>c?1:0:u!==-1&&g===-1?-1:u===-1&&g!==-1?1:u-g});let a=o.filter(l=>!AJ(i[l])).map((l,c)=>{let u=i[l],g=aJ(l),f=dS(u,e+1,!0),h=c>0||r?s:"";return f.startsWith(`
|
||||
`)?`${h}${g}:${f}`:`${h}${g}: ${f}`}).join(e===0?`
|
||||
`:"")||`
|
||||
`;return r?`
|
||||
${a}`:`${a}`}throw new Error(`Unsupported value type (${t})`)}function ro(t){try{let e=dS(t,0,!1);return e!==`
|
||||
`?e:""}catch(e){throw e.location&&(e.message=e.message.replace(/(\.)?$/,` (line ${e.location.start.line}, column ${e.location.start.column})$1`)),e}}ro.PreserveOrdering=pS;function $Be(t){return t.endsWith(`
|
||||
`)||(t+=`
|
||||
`),(0,sJ.parse)(t)}var ewe=/^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i;function twe(t){if(ewe.test(t))return $Be(t);let e=(0,LI.safeLoad)(t,{schema:LI.FAILSAFE_SCHEMA,json:!0});if(e==null)return{};if(typeof e!="object")throw new Error(`Expected an indexed object, got a ${typeof e} instead. Does your file follow Yaml's rules?`);if(Array.isArray(e))throw new Error("Expected an indexed object, got an array instead. Does your file follow Yaml's rules?");return e}function Kr(t){return twe(t)}var EJ=te(eQ()),yJ=te(require("os")),qi=te(require("stream")),BJ=te(require("util"));var ia=class extends Error{constructor(e){super(e);this.name="ShellError"}};var MI={};et(MI,{fastGlobOptions:()=>uJ,isBraceExpansion:()=>gJ,isGlobPattern:()=>rwe,match:()=>iwe,micromatchOptions:()=>OI});var lJ=te(Qm()),cJ=te(require("fs")),TI=te(Yi()),OI={strictBrackets:!0},uJ={onlyDirectories:!1,onlyFiles:!1};function rwe(t){if(!TI.default.scan(t,OI).isGlob)return!1;try{TI.default.parse(t,OI)}catch{return!1}return!0}function iwe(t,{cwd:e,baseFs:r}){return(0,lJ.default)(t,V(v({},uJ),{cwd:T.fromPortablePath(e),fs:QC(cJ.default,new Dg(r))}))}function gJ(t){return TI.default.scan(t,OI).isBrace}var fJ=te(Mw()),As=te(require("stream")),hJ=te(require("string_decoder")),vi;(function(i){i[i.STDIN=0]="STDIN",i[i.STDOUT=1]="STDOUT",i[i.STDERR=2]="STDERR"})(vi||(vi={}));var FA=new Set;function CS(){}function mS(){for(let t of FA)t.kill()}function pJ(t,e,r,i){return n=>{let s=n[0]instanceof As.Transform?"pipe":n[0],o=n[1]instanceof As.Transform?"pipe":n[1],a=n[2]instanceof As.Transform?"pipe":n[2],l=(0,fJ.default)(t,e,V(v({},i),{stdio:[s,o,a]}));return FA.add(l),FA.size===1&&(process.on("SIGINT",CS),process.on("SIGTERM",mS)),n[0]instanceof As.Transform&&n[0].pipe(l.stdin),n[1]instanceof As.Transform&&l.stdout.pipe(n[1],{end:!1}),n[2]instanceof As.Transform&&l.stderr.pipe(n[2],{end:!1}),{stdin:l.stdin,promise:new Promise(c=>{l.on("error",u=>{switch(FA.delete(l),FA.size===0&&(process.off("SIGINT",CS),process.off("SIGTERM",mS)),u.code){case"ENOENT":n[2].write(`command not found: ${t}
|
||||
`),c(127);break;case"EACCES":n[2].write(`permission denied: ${t}
|
||||
`),c(128);break;default:n[2].write(`uncaught error: ${u.message}
|
||||
`),c(1);break}}),l.on("exit",u=>{FA.delete(l),FA.size===0&&(process.off("SIGINT",CS),process.off("SIGTERM",mS)),c(u!==null?u:129)})})}}}function dJ(t){return e=>{let r=e[0]==="pipe"?new As.PassThrough:e[0];return{stdin:r,promise:Promise.resolve().then(()=>t({stdin:r,stdout:e[1],stderr:e[2]}))}}}var Tn=class{constructor(e){this.stream=e}close(){}get(){return this.stream}},CJ=class{constructor(){this.stream=null}close(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");this.stream.end()}attach(e){this.stream=e}get(){if(this.stream===null)throw new Error("Assertion failed: No stream attached");return this.stream}},Wf=class{constructor(e,r){this.stdin=null;this.stdout=null;this.stderr=null;this.pipe=null;this.ancestor=e,this.implementation=r}static start(e,{stdin:r,stdout:i,stderr:n}){let s=new Wf(null,e);return s.stdin=r,s.stdout=i,s.stderr=n,s}pipeTo(e,r=1){let i=new Wf(this,e),n=new CJ;return i.pipe=n,i.stdout=this.stdout,i.stderr=this.stderr,(r&1)==1?this.stdout=n:this.ancestor!==null&&(this.stderr=this.ancestor.stdout),(r&2)==2?this.stderr=n:this.ancestor!==null&&(this.stderr=this.ancestor.stderr),i}async exec(){let e=["ignore","ignore","ignore"];if(this.pipe)e[0]="pipe";else{if(this.stdin===null)throw new Error("Assertion failed: No input stream registered");e[0]=this.stdin.get()}let r;if(this.stdout===null)throw new Error("Assertion failed: No output stream registered");r=this.stdout,e[1]=r.get();let i;if(this.stderr===null)throw new Error("Assertion failed: No error stream registered");i=this.stderr,e[2]=i.get();let n=this.implementation(e);return this.pipe&&this.pipe.attach(n.stdin),await n.promise.then(s=>(r.close(),i.close(),s))}async run(){let e=[];for(let i=this;i;i=i.ancestor)e.push(i.exec());return(await Promise.all(e))[0]}};function KI(t,e){return Wf.start(t,e)}function mJ(t,e=null){let r=new As.PassThrough,i=new hJ.StringDecoder,n="";return r.on("data",s=>{let o=i.write(s),a;do if(a=o.indexOf(`
|
||||
`),a!==-1){let l=n+o.substr(0,a);o=o.substr(a+1),n="",t(e!==null?`${e} ${l}`:l)}while(a!==-1);n+=o}),r.on("end",()=>{let s=i.end();s!==""&&t(e!==null?`${e} ${s}`:s)}),r}function IJ(t,{prefix:e}){return{stdout:mJ(r=>t.stdout.write(`${r}
|
||||
`),t.stdout.isTTY?e:null),stderr:mJ(r=>t.stderr.write(`${r}
|
||||
`),t.stderr.isTTY?e:null)}}var nwe=(0,BJ.promisify)(setTimeout);var Vr;(function(r){r[r.Readable=1]="Readable",r[r.Writable=2]="Writable"})(Vr||(Vr={}));function wJ(t,e,r){let i=new qi.PassThrough({autoDestroy:!0});switch(t){case vi.STDIN:(e&1)==1&&r.stdin.pipe(i,{end:!1}),(e&2)==2&&r.stdin instanceof qi.Writable&&i.pipe(r.stdin,{end:!1});break;case vi.STDOUT:(e&1)==1&&r.stdout.pipe(i,{end:!1}),(e&2)==2&&i.pipe(r.stdout,{end:!1});break;case vi.STDERR:(e&1)==1&&r.stderr.pipe(i,{end:!1}),(e&2)==2&&i.pipe(r.stderr,{end:!1});break;default:throw new ia(`Bad file descriptor: "${t}"`)}return i}function UI(t,e={}){let r=v(v({},t),e);return r.environment=v(v({},t.environment),e.environment),r.variables=v(v({},t.variables),e.variables),r}var swe=new Map([["cd",async([t=(0,yJ.homedir)(),...e],r,i)=>{let n=D.resolve(i.cwd,T.toPortablePath(t));return(await r.baseFs.statPromise(n)).isDirectory()?(i.cwd=n,0):(i.stderr.write(`cd: not a directory
|
||||
`),1)}],["pwd",async(t,e,r)=>(r.stdout.write(`${T.fromPortablePath(r.cwd)}
|
||||
`),0)],[":",async(t,e,r)=>0],["true",async(t,e,r)=>0],["false",async(t,e,r)=>1],["exit",async([t,...e],r,i)=>i.exitCode=parseInt(t!=null?t:i.variables["?"],10)],["echo",async(t,e,r)=>(r.stdout.write(`${t.join(" ")}
|
||||
`),0)],["sleep",async([t],e,r)=>{if(typeof t=="undefined")return r.stderr.write(`sleep: missing operand
|
||||
`),1;let i=Number(t);return Number.isNaN(i)?(r.stderr.write(`sleep: invalid time interval '${t}'
|
||||
`),1):await nwe(1e3*i,0)}],["__ysh_run_procedure",async(t,e,r)=>{let i=r.procedures[t[0]];return await KI(i,{stdin:new Tn(r.stdin),stdout:new Tn(r.stdout),stderr:new Tn(r.stderr)}).run()}],["__ysh_set_redirects",async(t,e,r)=>{let i=r.stdin,n=r.stdout,s=r.stderr,o=[],a=[],l=[],c=0;for(;t[c]!=="--";){let g=t[c++],{type:f,fd:h}=JSON.parse(g),p=B=>{switch(h){case null:case 0:o.push(B);break;default:throw new Error(`Unsupported file descriptor: "${h}"`)}},m=B=>{switch(h){case null:case 1:a.push(B);break;case 2:l.push(B);break;default:throw new Error(`Unsupported file descriptor: "${h}"`)}},I=Number(t[c++]),y=c+I;for(let B=c;B<y;++c,++B)switch(f){case"<":p(()=>e.baseFs.createReadStream(D.resolve(r.cwd,T.toPortablePath(t[B]))));break;case"<<<":p(()=>{let x=new qi.PassThrough;return process.nextTick(()=>{x.write(`${t[B]}
|
||||
`),x.end()}),x});break;case"<&":p(()=>wJ(Number(t[B]),1,r));break;case">":case">>":{let x=D.resolve(r.cwd,T.toPortablePath(t[B]));m(x==="/dev/null"?new qi.Writable({autoDestroy:!0,emitClose:!0,write(F,N,O){setImmediate(O)}}):e.baseFs.createWriteStream(x,f===">>"?{flags:"a"}:void 0))}break;case">&":m(wJ(Number(t[B]),2,r));break;default:throw new Error(`Assertion failed: Unsupported redirection type: "${f}"`)}}if(o.length>0){let g=new qi.PassThrough;i=g;let f=h=>{if(h===o.length)g.end();else{let p=o[h]();p.pipe(g,{end:!1}),p.on("end",()=>{f(h+1)})}};f(0)}if(a.length>0){let g=new qi.PassThrough;n=g;for(let f of a)g.pipe(f)}if(l.length>0){let g=new qi.PassThrough;s=g;for(let f of l)g.pipe(f)}let u=await KI(Vf(t.slice(c+1),e,r),{stdin:new Tn(i),stdout:new Tn(n),stderr:new Tn(s)}).run();return await Promise.all(a.map(g=>new Promise((f,h)=>{g.on("error",p=>{h(p)}),g.on("close",()=>{f()}),g.end()}))),await Promise.all(l.map(g=>new Promise((f,h)=>{g.on("error",p=>{h(p)}),g.on("close",()=>{f()}),g.end()}))),u}]]);async function owe(t,e,r){let i=[],n=new qi.PassThrough;return n.on("data",s=>i.push(s)),await HI(t,e,UI(r,{stdout:n})),Buffer.concat(i).toString().replace(/[\r\n]+$/,"")}async function QJ(t,e,r){let i=t.map(async s=>{let o=await RA(s.args,e,r);return{name:s.name,value:o.join(" ")}});return(await Promise.all(i)).reduce((s,o)=>(s[o.name]=o.value,s),{})}function IS(t){return t.match(/[^ \r\n\t]+/g)||[]}async function bJ(t,e,r,i,n=i){switch(t.name){case"$":i(String(process.pid));break;case"#":i(String(e.args.length));break;case"@":if(t.quoted)for(let s of e.args)n(s);else for(let s of e.args){let o=IS(s);for(let a=0;a<o.length-1;++a)n(o[a]);i(o[o.length-1])}break;case"*":{let s=e.args.join(" ");if(t.quoted)i(s);else for(let o of IS(s))n(o)}break;case"PPID":i(String(process.ppid));break;case"RANDOM":i(String(Math.floor(Math.random()*32768)));break;default:{let s=parseInt(t.name,10);if(Number.isFinite(s))if(s>=0&&s<e.args.length)i(e.args[s]);else if(t.defaultValue)i((await RA(t.defaultValue,e,r)).join(" "));else throw new ia(`Unbound argument #${s}`);else if(Object.prototype.hasOwnProperty.call(r.variables,t.name))i(r.variables[t.name]);else if(Object.prototype.hasOwnProperty.call(r.environment,t.name))i(r.environment[t.name]);else if(t.defaultValue)i((await RA(t.defaultValue,e,r)).join(" "));else throw new ia(`Unbound variable "${t.name}"`)}break}}var awe={addition:(t,e)=>t+e,subtraction:(t,e)=>t-e,multiplication:(t,e)=>t*e,division:(t,e)=>Math.trunc(t/e)};async function Xf(t,e,r){if(t.type==="number"){if(Number.isInteger(t.value))return t.value;throw new Error(`Invalid number: "${t.value}", only integers are allowed`)}else if(t.type==="variable"){let i=[];await bJ(V(v({},t),{quoted:!0}),e,r,s=>i.push(s));let n=Number(i.join(" "));return Number.isNaN(n)?Xf({type:"variable",name:i.join(" ")},e,r):Xf({type:"number",value:n},e,r)}else return awe[t.type](await Xf(t.left,e,r),await Xf(t.right,e,r))}async function RA(t,e,r){let i=new Map,n=[],s=[],o=u=>{s.push(u)},a=()=>{s.length>0&&n.push(s.join("")),s=[]},l=u=>{o(u),a()},c=(u,g,f)=>{let h=JSON.stringify({type:u,fd:g}),p=i.get(h);typeof p=="undefined"&&i.set(h,p=[]),p.push(f)};for(let u of t){let g=!1;switch(u.type){case"redirection":{let f=await RA(u.args,e,r);for(let h of f)c(u.subtype,u.fd,h)}break;case"argument":for(let f of u.segments)switch(f.type){case"text":o(f.text);break;case"glob":o(f.pattern),g=!0;break;case"shell":{let h=await owe(f.shell,e,r);if(f.quoted)o(h);else{let p=IS(h);for(let m=0;m<p.length-1;++m)l(p[m]);o(p[p.length-1])}}break;case"variable":await bJ(f,e,r,o,l);break;case"arithmetic":o(String(await Xf(f.arithmetic,e,r)));break}break}if(a(),g){let f=n.pop();if(typeof f=="undefined")throw new Error("Assertion failed: Expected a glob pattern to have been set");let h=await e.glob.match(f,{cwd:r.cwd,baseFs:e.baseFs});if(h.length===0){let p=gJ(f)?". Note: Brace expansion of arbitrary strings isn't currently supported. For more details, please read this issue: https://github.com/yarnpkg/berry/issues/22":"";throw new ia(`No matches found: "${f}"${p}`)}for(let p of h.sort())l(p)}}if(i.size>0){let u=[];for(let[g,f]of i.entries())u.splice(u.length,0,g,String(f.length),...f);n.splice(0,0,"__ysh_set_redirects",...u,"--")}return n}function Vf(t,e,r){e.builtins.has(t[0])||(t=["command",...t]);let i=T.fromPortablePath(r.cwd),n=r.environment;typeof n.PWD!="undefined"&&(n=V(v({},n),{PWD:i}));let[s,...o]=t;if(s==="command")return pJ(o[0],o.slice(1),e,{cwd:i,env:n});let a=e.builtins.get(s);if(typeof a=="undefined")throw new Error(`Assertion failed: A builtin should exist for "${s}"`);return dJ(async({stdin:l,stdout:c,stderr:u})=>(r.stdin=l,r.stdout=c,r.stderr=u,await a(o,e,r)))}function Awe(t,e,r){return i=>{let n=new qi.PassThrough,s=HI(t,e,UI(r,{stdin:n}));return{stdin:n,promise:s}}}function lwe(t,e,r){return i=>{let n=new qi.PassThrough,s=HI(t,e,r);return{stdin:n,promise:s}}}function DJ(t,e,r,i){if(e.length===0)return t;{let n;do n=String(Math.random());while(
Line truncated
|
||||
`)).finally(()=>{r.stdout.isTTY&&r.stdout.write(`Job ${l}, '${o(mc(t))}' has ended
|
||||
`)})),0}return await SJ(t,e,r)}async function uwe(t,e,r,{background:i=!1}={}){let n,s=a=>{n=a,r.variables["?"]=String(a)},o=async a=>{try{return await cwe(a.chain,e,r,{background:i&&typeof a.then=="undefined"})}catch(l){if(!(l instanceof ia))throw l;return r.stderr.write(`${l.message}
|
||||
`),1}};for(s(await o(t));t.then;){if(r.exitCode!==null)return r.exitCode;switch(t.then.type){case"&&":n===0&&s(await o(t.then.line));break;case"||":n!==0&&s(await o(t.then.line));break;default:throw new Error(`Assertion failed: Unsupported command type: "${t.then.type}"`)}t=t.then.line}return n}async function HI(t,e,r){let i=r.backgroundJobs;r.backgroundJobs=[];let n=0;for(let{command:s,type:o}of t){if(n=await uwe(s,e,r,{background:o==="&"}),r.exitCode!==null)return r.exitCode;r.variables["?"]=String(n)}return await Promise.all(r.backgroundJobs),r.backgroundJobs=i,n}function xJ(t){switch(t.type){case"variable":return t.name==="@"||t.name==="#"||t.name==="*"||Number.isFinite(parseInt(t.name,10))||"defaultValue"in t&&!!t.defaultValue&&t.defaultValue.some(e=>YI(e));case"arithmetic":return ES(t.arithmetic);case"shell":return yS(t.shell);default:return!1}}function YI(t){switch(t.type){case"redirection":return t.args.some(e=>YI(e));case"argument":return t.segments.some(e=>xJ(e));default:throw new Error(`Assertion failed: Unsupported argument type: "${t.type}"`)}}function ES(t){switch(t.type){case"variable":return xJ(t);case"number":return!1;default:return ES(t.left)||ES(t.right)}}function yS(t){return t.some(({command:e})=>{for(;e;){let r=e.chain;for(;r;){let i;switch(r.type){case"subshell":i=yS(r.subshell);break;case"command":i=r.envs.some(n=>n.args.some(s=>YI(s)))||r.args.some(n=>YI(n));break}if(i)return!0;if(!r.then)break;r=r.then.chain}if(!e.then)break;e=e.then.line}return!1})}async function xc(t,e=[],{baseFs:r=new Ft,builtins:i={},cwd:n=T.toPortablePath(process.cwd()),env:s=process.env,stdin:o=process.stdin,stdout:a=process.stdout,stderr:l=process.stderr,variables:c={},glob:u=MI}={}){let g={};for(let[p,m]of Object.entries(s))typeof m!="undefined"&&(g[p]=m);let f=new Map(swe);for(let[p,m]of Object.entries(i))f.set(p,m);o===null&&(o=new qi.PassThrough,o.end());let h=II(t,u);if(!yS(h)&&h.length>0&&e.length>0){let{command:p}=h[h.length-1];for(;p.then;)p=p.then.line;let m=p.chain;for(;m.then;)m=m.then.chain;m.type==="command"&&(m.args=m.args.concat(e.map(I=>({type:"argument",segments:[{type:"text",text:I}]}))))}return await HI(h,{args:e,baseFs:r,builtins:f,initialStdin:o,initialStdout:a,initialStderr:l,glob:u},{cwd:n,environment:g,exitCode:null,procedures:{},stdin:o,stdout:a,stderr:l,variables:Object.assign({},c,{["?"]:0}),nextBackgroundJobIndex:1,backgroundJobs:[]})}var TW=te(SS()),OW=te(GI()),vc=te(require("stream"));var DW=te(cr());var vt={};et(vt,{SemVer:()=>wW.SemVer,satisfiesWithPrereleases:()=>_f,validRange:()=>Kn});var qI=te(cr()),wW=te(cr()),QW=new Map;function _f(t,e,r=!1){if(!t)return!1;let i=`${e}${r}`,n=QW.get(i);if(typeof n=="undefined")try{n=new qI.default.Range(e,{includePrerelease:!0,loose:r})}catch{return!1}finally{QW.set(i,n||null)}else if(n===null)return!1;let s;try{s=new qI.default.SemVer(t,n)}catch(o){return!1}return n.test(s)?!0:(s.prerelease&&(s.prerelease=[]),n.set.some(o=>{for(let a of o)a.semver.prerelease&&(a.semver.prerelease=[]);return o.every(a=>a.test(s))}))}var bW=new Map;function Kn(t){if(t.indexOf(":")!==-1)return null;let e=bW.get(t);if(typeof e!="undefined")return e;try{e=new qI.default.Range(t)}catch{e=null}return bW.set(t,e),e}var na=class{constructor(){this.indent=" ";this.name=null;this.version=null;this.os=null;this.cpu=null;this.type=null;this.packageManager=null;this.private=!1;this.license=null;this.main=null;this.module=null;this.browser=null;this.languageName=null;this.bin=new Map;this.scripts=new Map;this.dependencies=new Map;this.devDependencies=new Map;this.peerDependencies=new Map;this.workspaceDefinitions=[];this.dependenciesMeta=new Map;this.peerDependenciesMeta=new Map;this.resolutions=[];this.files=null;this.publishConfig=null;this.installConfig=null;this.preferUnplugged=null;this.raw={};this.errors=[]}static async tryFind(e,{baseFs:r=new Ft}={}){let i=D.join(e,"package.json");return await r.existsPromise(i)?await na.fromFile(i,{baseFs:r}):null}static async find(e,{baseFs:r}={}){let i=await na.tryFind(e,{baseFs:r});if(i===null)throw new Error("Manifest not found");return i}static async fromFile(e,{baseFs:r=new Ft}={}){let i=new na;return await i.loadFile(e,{baseFs:r}),i}static fromText(e){let r=new na;return r.loadFromText(e),r}static isManifestFieldCompatible(e,r){if(e===null)return!0;let i=!0,n=!1;for(let s of e)if(s[0]==="!"){if(n=!0,r===s.slice(1))return!1}else if(i=!1,s===r)return!0;return n&&i}loadFromText(e){let r;try{r=JSON.parse(xW(e)||"{}")}catch(i){throw i.message+=` (when parsing ${e})`,i}this.load(r),this.indent=SW(e)}async loadFile(e,{baseFs:r=new Ft}){let i=await r.readFilePromise(e,"utf8"),n;try{n=JSON.parse(xW(i)||"{}")}catch(s){throw s.message+=` (when parsing ${e})`,s}this.load(n),this.indent=SW(i)}load(e,{yamlCompatibilityMode:r=!1}={}){if(typeof e!="object"||e===null)throw new Error(`Utterly invalid manifest data (${e})`);this.raw=e;let i=[];if(this.name=null,typeof e.name=="string")try{this.name=Si(e.name)}catch(s){i.push(new Error("Pa
Line truncated
|
||||
`,end:t=>`::endgroup::
|
||||
`}:process.env.TRAVIS?{start:t=>`travis_fold:start:${t}
|
||||
`,end:t=>`travis_fold:end:${t}
|
||||
`}:process.env.GITLAB_CI?{start:t=>`section_start:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r[0K${t}
|
||||
`,end:t=>`section_end:${Math.floor(Date.now()/1e3)}:${t.toLowerCase().replace(/\W+/g,"_")}\r[0K`}:null,LW=new Date,LQe=["iTerm.app","Apple_Terminal"].includes(process.env.TERM_PROGRAM)||!!process.env.WT_SESSION,MQe=t=>t,zI=MQe({patrick:{date:[17,3],chars:["\u{1F340}","\u{1F331}"],size:40},simba:{date:[19,7],chars:["\u{1F981}","\u{1F334}"],size:40},jack:{date:[31,10],chars:["\u{1F383}","\u{1F987}"],size:40},hogsfather:{date:[31,12],chars:["\u{1F389}","\u{1F384}"],size:40},default:{chars:["=","-"],size:80}}),TQe=LQe&&Object.keys(zI).find(t=>{let e=zI[t];return!(e.date&&(e.date[0]!==LW.getDate()||e.date[1]!==LW.getMonth()+1))})||"default";function MW(t,{configuration:e,json:r}){if(!e.get("enableMessageNames"))return"";let n=MC(t===null?0:t);return!r&&t===null?qe(e,n,"grey"):n}function kS(t,{configuration:e,json:r}){let i=MW(t,{configuration:e,json:r});if(!i||t===null||t===z.UNNAMED)return i;let n=z[t],s=`https://yarnpkg.com/advanced/error-codes#${i}---${n}`.toLowerCase();return tc(e,i,s)}var xe=class extends ci{constructor({configuration:e,stdout:r,json:i=!1,includeFooter:n=!0,includeLogs:s=!i,includeInfos:o=s,includeWarnings:a=s,forgettableBufferSize:l=NQe,forgettableNames:c=new Set}){super();this.uncommitted=new Set;this.cacheHitCount=0;this.cacheMissCount=0;this.lastCacheMiss=null;this.warningCount=0;this.errorCount=0;this.startTime=Date.now();this.indent=0;this.progress=new Map;this.progressTime=0;this.progressFrame=0;this.progressTimeout=null;this.forgettableLines=[];Bf(this,{configuration:e}),this.configuration=e,this.forgettableBufferSize=l,this.forgettableNames=new Set([...c,...RQe]),this.includeFooter=n,this.includeInfos=o,this.includeWarnings=a,this.json=i,this.stdout=r;let u=this.configuration.get("progressBarStyle")||TQe;if(!Object.prototype.hasOwnProperty.call(zI,u))throw new Error("Assertion failed: Invalid progress bar style");this.progressStyle=zI[u];let g="\u27A4 YN0000: \u250C ".length,f=Math.max(0,Math.min(process.stdout.columns-g,80));this.progressMaxScaledSize=Math.floor(this.progressStyle.size*f/80)}static async start(e,r){let i=new this(e),n=process.emitWarning;process.emitWarning=(s,o)=>{if(typeof s!="string"){let l=s;s=l.message,o=o!=null?o:l.name}let a=typeof o!="undefined"?`${o}: ${s}`:s;i.reportWarning(z.UNNAMED,a)};try{await r(i)}catch(s){i.reportExceptionOnce(s)}finally{await i.finalize(),process.emitWarning=n}return i}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(e){this.cacheHitCount+=1}reportCacheMiss(e,r){this.lastCacheMiss=e,this.cacheMissCount+=1,typeof r!="undefined"&&!this.configuration.get("preferAggregateCacheInfo")&&this.reportInfo(z.FETCH_NOT_CACHED,r)}startTimerSync(e,r,i){let n=typeof r=="function"?{}:r,s=typeof r=="function"?r:i,o={committed:!1,action:()=>{this.reportInfo(null,`\u250C ${e}`),this.indent+=1,sa!==null&&!this.json&&this.includeInfos&&this.stdout.write(sa.start(e))}};n.skipIfEmpty?this.uncommitted.add(o):(o.action(),o.committed=!0);let a=Date.now();try{return s()}catch(l){throw this.reportExceptionOnce(l),l}finally{let l=Date.now();this.uncommitted.delete(o),o.committed&&(this.indent-=1,sa!==null&&!this.json&&this.includeInfos&&this.stdout.write(sa.end(e)),this.configuration.get("enableTimers")&&l-a>200?this.reportInfo(null,`\u2514 Completed in ${qe(this.configuration,l-a,Pe.DURATION)}`):this.reportInfo(null,"\u2514 Completed"))}}async startTimerPromise(e,r,i){let n=typeof r=="function"?{}:r,s=typeof r=="function"?r:i,o={committed:!1,action:()=>{this.reportInfo(null,`\u250C ${e}`),this.indent+=1,sa!==null&&!this.json&&this.includeInfos&&this.stdout.write(sa.start(e))}};n.skipIfEmpty?this.uncommitted.add(o):(o.action(),o.committed=!0);let a=Date.now();try{return await s()}catch(l){throw this.reportExceptionOnce(l),l}finally{let l=Date.now();this.uncommitted.delete(o),o.committed&&(this.indent-=1,sa!==null&&!this.json&&this.includeInfos&&this.stdout.write(sa.end(e)),this.configuration.get("enableTimers")&&l-a>200?this.reportInfo(null,`\u2514 Completed in ${qe(this.configuration,l-a,Pe.DURATION)}`):this.reportInfo(null,"\u2514 Completed"))}}async startCacheReport(e){let r=this.configuration.get("preferAggregateCacheInfo")?{cacheHitCount:this.cacheHitCount,cacheMissCount:this.cacheMissCount}:null;try{return await e()}catch(i){throw this.reportExceptionOnce(i),i}finally{r!==null&&this.reportCacheChanges(r)}}reportSeparator(){this.indent===0?this.writeLineWithForgettableReset(""):this.reportInfo(null,"")}reportInfo(e,r){if(!this.includeInfos)return;this.commit();let i=this.formatNameWithHyperlink(e),n=i?`${i}: `:"",s=`${qe(this.configuration,"\u27A4","blueBright")} ${n}${this.formatIndent()}${r}`;if(this.json)this.reportJson({type:"info",name:e,displayName:this.formatName(e),indent:this.formatIndent(),data:r});else if(this.forgettableNames.has(e))if(this.forgettableLines.push(s),this.forgettableLines.length>this.forgettableBufferSize){for(;this.forgettableLines.length>this.forgettableBufferSize;)this.forgettableL
Line truncated
|
||||
`),this.writeProgress()}writeLineWithForgettableReset(e,{truncate:r}={}){this.forgettableLines=[],this.writeLine(e,{truncate:r})}writeLines(e,{truncate:r}={}){this.clearProgress({delta:e.length});for(let i of e)this.stdout.write(`${this.truncate(i,{truncate:r})}
|
||||
`);this.writeProgress()}reportCacheChanges({cacheHitCount:e,cacheMissCount:r}){let i=this.cacheHitCount-e,n=this.cacheMissCount-r;if(i===0&&n===0)return;let s="";this.cacheHitCount>1?s+=`${this.cacheHitCount} packages were already cached`:this.cacheHitCount===1?s+=" - one package was already cached":s+="No packages were cached",this.cacheHitCount>0?this.cacheMissCount>1?s+=`, ${this.cacheMissCount} had to be fetched`:this.cacheMissCount===1&&(s+=`, one had to be fetched (${nt(this.configuration,this.lastCacheMiss)})`):this.cacheMissCount>1?s+=` - ${this.cacheMissCount} packages had to be fetched`:this.cacheMissCount===1&&(s+=` - one package had to be fetched (${nt(this.configuration,this.lastCacheMiss)})`),this.reportInfo(z.FETCH_NOT_CACHED,s)}commit(){let e=this.uncommitted;this.uncommitted=new Set;for(let r of e)r.committed=!0,r.action()}clearProgress({delta:e=0,clear:r=!1}){!this.configuration.get("enableProgressBars")||this.json||this.progress.size+e>0&&(this.stdout.write(`[${this.progress.size+e}A`),(e>0||r)&&this.stdout.write("[0J"))}writeProgress(){if(!this.configuration.get("enableProgressBars")||this.json||(this.progressTimeout!==null&&clearTimeout(this.progressTimeout),this.progressTimeout=null,this.progress.size===0))return;let e=Date.now();e-this.progressTime>NW&&(this.progressFrame=(this.progressFrame+1)%RW.length,this.progressTime=e);let r=RW[this.progressFrame];for(let i of this.progress.values()){let n=this.progressStyle.chars[0].repeat(i.lastScaledSize),s=this.progressStyle.chars[1].repeat(this.progressMaxScaledSize-i.lastScaledSize),o=this.formatName(null),a=o?`${o}: `:"";this.stdout.write(`${qe(this.configuration,"\u27A4","blueBright")} ${a}${r} ${n}${s}
|
||||
`)}this.progressTimeout=setTimeout(()=>{this.refreshProgress()},NW)}refreshProgress(e=0){let r=!1;if(this.progress.size===0)r=!0;else for(let i of this.progress.values()){let n=Math.trunc(this.progressMaxScaledSize*i.definition.progress),s=i.lastScaledSize;if(i.lastScaledSize=n,n!==s){r=!0;break}}r&&(this.clearProgress({delta:e}),this.writeProgress())}truncate(e,{truncate:r}={}){return this.configuration.get("enableProgressBars")||(r=!1),typeof r=="undefined"&&(r=this.configuration.get("preferTruncatedLines")),r&&(e=(0,FW.default)(e,0,process.stdout.columns-1)),e}formatName(e){return MW(e,{configuration:this.configuration,json:this.json})}formatNameWithHyperlink(e){return kS(e,{configuration:this.configuration,json:this.json})}formatIndent(){return"\u2502 ".repeat(this.indent)}};var Er="3.0.2";var cs;(function(n){n.Yarn1="Yarn Classic",n.Yarn2="Yarn",n.Npm="npm",n.Pnpm="pnpm"})(cs||(cs={}));async function io(t,e,r,i=[]){if(process.platform==="win32"){let n=`@goto #_undefined_# 2>NUL || @title %COMSPEC% & @setlocal & @"${r}" ${i.map(s=>`"${s.replace('"','""')}"`).join(" ")} %*`;await L.writeFilePromise(D.format({dir:t,name:e,ext:".cmd"}),n)}await L.writeFilePromise(D.join(t,e),`#!/bin/sh
|
||||
exec "${r}" ${i.map(n=>`'${n.replace(/'/g,`'"'"'`)}'`).join(" ")} "$@"
|
||||
`),await L.chmodPromise(D.join(t,e),493)}async function OQe(t){let e=null;try{e=await L.readFilePromise(D.join(t,xt.lockfile),"utf8")}catch{}return e!==null?e.match(/^__metadata:$/m)?{packageManager:cs.Yarn2,reason:'"__metadata" key found in yarn.lock'}:{packageManager:cs.Yarn1,reason:'"__metadata" key not found in yarn.lock, must be a Yarn classic lockfile'}:L.existsSync(D.join(t,"package-lock.json"))?{packageManager:cs.Npm,reason:`found npm's "package-lock.json" lockfile`}:L.existsSync(D.join(t,"pnpm-lock.yaml"))?{packageManager:cs.Pnpm,reason:`found pnpm's "pnpm-lock.yaml" lockfile`}:null}async function $f({project:t,locator:e,binFolder:r,lifecycleScript:i}){var l,c;let n={};for(let[u,g]of Object.entries(process.env))typeof g!="undefined"&&(n[u.toLowerCase()!=="path"?u:"PATH"]=g);let s=T.fromPortablePath(r);n.BERRY_BIN_FOLDER=T.fromPortablePath(s);let o=process.env.COREPACK_ROOT?T.join(process.env.COREPACK_ROOT,"dist/yarn.js"):process.argv[1];if(await Promise.all([io(r,"node",process.execPath),...Er!==null?[io(r,"run",process.execPath,[o,"run"]),io(r,"yarn",process.execPath,[o]),io(r,"yarnpkg",process.execPath,[o]),io(r,"node-gyp",process.execPath,[o,"run","--top-level","node-gyp"])]:[]]),t&&(n.INIT_CWD=T.fromPortablePath(t.configuration.startingCwd),n.PROJECT_CWD=T.fromPortablePath(t.cwd)),n.PATH=n.PATH?`${s}${T.delimiter}${n.PATH}`:`${s}`,n.npm_execpath=`${s}${T.sep}yarn`,n.npm_node_execpath=`${s}${T.sep}node`,e){if(!t)throw new Error("Assertion failed: Missing project");let u=t.tryWorkspaceByLocator(e),g=u?(l=u.manifest.version)!=null?l:"":(c=t.storedPackages.get(e.locatorHash).version)!=null?c:"";n.npm_package_name=dt(e),n.npm_package_version=g}let a=Er!==null?`yarn/${Er}`:`yarn/${ql("@yarnpkg/core").version}-core`;return n.npm_config_user_agent=`${a} npm/? node/${process.versions.node} ${process.platform} ${process.arch}`,i&&(n.npm_lifecycle_event=i),t&&await t.configuration.triggerHook(u=>u.setupScriptEnvironment,t,n,async(u,g,f)=>await io(r,rr(u),g,f)),n}var KQe=2,UQe=(0,OW.default)(KQe);async function HQe(t,e,{configuration:r,report:i,workspace:n=null,locator:s=null}){await UQe(async()=>{await L.mktempPromise(async o=>{let a=D.join(o,"pack.log"),l=null,{stdout:c,stderr:u}=r.getSubprocessStreams(a,{prefix:T.fromPortablePath(t),report:i}),g=s&&ss(s)?df(s):s,f=g?gn(g):"an external project";c.write(`Packing ${f} from sources
|
||||
`);let h=await OQe(t),p;h!==null?(c.write(`Using ${h.packageManager} for bootstrap. Reason: ${h.reason}
|
||||
|
||||
`),p=h.packageManager):(c.write(`No package manager configuration detected; defaulting to Yarn
|
||||
|
||||
`),p=cs.Yarn2),await L.mktempPromise(async m=>{let I=await $f({binFolder:m}),B=new Map([[cs.Yarn1,async()=>{let F=n!==null?["workspace",n]:[],N=await Ts("yarn",["set","version","classic","--only-if-needed"],{cwd:t,env:I,stdin:l,stdout:c,stderr:u,end:sn.ErrorCode});if(N.code!==0)return N.code;await L.appendFilePromise(D.join(t,".npmignore"),`/.yarn
|
||||
`),c.write(`
|
||||
`);let O=await Ts("yarn",["install"],{cwd:t,env:I,stdin:l,stdout:c,stderr:u,end:sn.ErrorCode});if(O.code!==0)return O.code;c.write(`
|
||||
`);let P=await Ts("yarn",[...F,"pack","--filename",T.fromPortablePath(e)],{cwd:t,env:I,stdin:l,stdout:c,stderr:u});return P.code!==0?P.code:0}],[cs.Yarn2,async()=>{let F=n!==null?["workspace",n]:[];I.YARN_ENABLE_INLINE_BUILDS="1";let N=D.join(t,xt.lockfile);await L.existsPromise(N)||await L.writeFilePromise(N,"");let O=await Ts("yarn",[...F,"pack","--install-if-needed","--filename",T.fromPortablePath(e)],{cwd:t,env:I,stdin:l,stdout:c,stderr:u});return O.code!==0?O.code:0}],[cs.Npm,async()=>{if(n!==null)throw new Error(`Workspaces aren't supported by npm, which has been detected as the primary package manager for ${t}`);delete I.npm_config_user_agent;let F=await Ts("npm",["install"],{cwd:t,env:I,stdin:l,stdout:c,stderr:u,end:sn.ErrorCode});if(F.code!==0)return F.code;let N=new vc.PassThrough,O=af(N);N.pipe(c);let P=await Ts("npm",["pack","--silent"],{cwd:t,env:I,stdin:l,stdout:N,stderr:u});if(P.code!==0)return P.code;let J=(await O).toString().trim(),oe=D.resolve(t,T.toPortablePath(J));return await L.renamePromise(oe,e),0}]]).get(p);if(typeof B=="undefined")throw new Error("Assertion failed: Unsupported workflow");let x=await B();if(!(x===0||typeof x=="undefined"))throw L.detachTemp(o),new _e(z.PACKAGE_PREPARATION_FAILED,`Packing the package failed (exit code ${x}, logs can be found here: ${a})`)})})})}async function YQe(t,e,{project:r}){let i=r.tryWorkspaceByLocator(t);if(i!==null)return vS(i,e);let n=r.storedPackages.get(t.locatorHash);if(!n)throw new Error(`Package for ${nt(r.configuration,t)} not found in the project`);return await nn.openPromise(async s=>{let o=r.configuration,a=r.configuration.getLinkers(),l={project:r,report:new xe({stdout:new vc.PassThrough,configuration:o})},c=a.find(h=>h.supportsPackage(n,l));if(!c)throw new Error(`The package ${nt(r.configuration,n)} isn't supported by any of the available linkers`);let u=await c.findPackageLocation(n,l),g=new yt(u,{baseFs:s});return(await ze.find(we.dot,{baseFs:g})).scripts.has(e)},{libzip:await gi()})}async function VI(t,e,r,{cwd:i,project:n,stdin:s,stdout:o,stderr:a}){return await L.mktempPromise(async l=>{let{manifest:c,env:u,cwd:g}=await KW(t,{project:n,binFolder:l,cwd:i,lifecycleScript:e}),f=c.scripts.get(e);if(typeof f=="undefined")return 1;let h=async()=>await xc(f,r,{cwd:g,env:u,stdin:s,stdout:o,stderr:a});return await(await n.configuration.reduceHook(m=>m.wrapScriptExecution,h,n,t,e,{script:f,args:r,cwd:g,env:u,stdin:s,stdout:o,stderr:a}))()})}async function PS(t,e,r,{cwd:i,project:n,stdin:s,stdout:o,stderr:a}){return await L.mktempPromise(async l=>{let{env:c,cwd:u}=await KW(t,{project:n,binFolder:l,cwd:i});return await xc(e,r,{cwd:u,env:c,stdin:s,stdout:o,stderr:a})})}async function jQe(t,{binFolder:e,cwd:r,lifecycleScript:i}){let n=await $f({project:t.project,locator:t.anchoredLocator,binFolder:e,lifecycleScript:i});return await Promise.all(Array.from(await UW(t),([s,[,o]])=>io(e,rr(s),process.execPath,[o]))),typeof r=="undefined"&&(r=D.dirname(await L.realpathPromise(D.join(t.cwd,"package.json")))),{manifest:t.manifest,binFolder:e,env:n,cwd:r}}async function KW(t,{project:e,binFolder:r,cwd:i,lifecycleScript:n}){let s=e.tryWorkspaceByLocator(t);if(s!==null)return jQe(s,{binFolder:r,cwd:i,lifecycleScript:n});let o=e.storedPackages.get(t.locatorHash);if(!o)throw new Error(`Package for ${nt(e.configuration,t)} not found in the project`);return await nn.openPromise(async a=>{let l=e.configuration,c=e.configuration.getLinkers(),u={project:e,report:new xe({stdout:new vc.PassThrough,configuration:l})},g=c.find(I=>I.supportsPackage(o,u));if(!g)throw new Error(`The package ${nt(e.configuration,o)} isn't supported by any of the available linkers`);let f=await $f({project:e,locator:t,binFolder:r,lifecycleScript:n});await Promise.all(Array.from(await XI(t,{project:e}),([I,[,y]])=>io(r,rr(I),process.execPath,[y])));let h=await g.findPackageLocation(o,u),p=new yt(h,{baseFs:a}),m=await ze.find(we.dot,{baseFs:p});return typeof i=="undefined"&&(i=h),{manifest:m,binFolder:r,env:f,cwd:i}},{libzip:await gi()})}async function HW(t,e,r,{cwd:i,stdin:n,stdout:s,stderr:o}){return await VI(t.anchoredLocator,e,r,{cwd:i,project:t.project,stdin:n,stdout:s,stderr:o})}function vS(t,e){return t.manifest.scripts.has(e)}async function YW(t,e,{cwd:r,report:i}){let{configuration:n}=t.project,s=null;await L.mktempPromise(async o=>{let a=D.join(o,`${e}.log`),l=`# This file contains the result of Yarn calling the "${e}" lifecycle script inside a workspace ("${t.cwd}")
|
||||
`,{stdout:c,stderr:u}=n.getSubprocessStreams(a,{report:i,prefix:nt(n,t.anchoredLocator),header:l});i.reportInfo(z.LIFECYCLE_SCRIPT,`Calling the "${e}" lifecycle script`);let g=await HW(t,e,[],{cwd:r,stdin:s,stdout:c,stderr:u});if(c.end(),u.end(),g!==0)throw L.detachTemp(o),new _e(z.LIFECYCLE_SCRIPT,`${(0,TW.default)(e)} script failed (exit code ${qe(n,g,Pe.NUMBER)}, logs can be found here: ${qe(n,a,Pe.PATH)}); run ${qe(n,`yarn ${e}`,Pe.CODE)} to investigate`)})}async function GQe(t,e,r){vS(t,e)&&await YW(t,e,r)}async function XI(t,{project:e}){let r=e.configuration,i=new Map,n=e.storedPackages.get(t.locatorHash);if(!n)throw new Error(`Package for ${nt(r,t)} not found in the project`);let s=new vc.Writable,o=r.getLinkers(),a={project:e,report:new xe({configuration:r,stdout:s})},l=new Set([t.locatorHash]);for(let u of n.dependencies.values()){let g=e.storedResolutions.get(u.descriptorHash);if(!g)throw new Error(`Assertion failed: The resolution (${Ut(r,u)}) should have been registered`);l.add(g)}let c=await Promise.all(Array.from(l,async u=>{let g=e.storedPackages.get(u);if(!g)throw new Error(`Assertion failed: The package (${u}) should have been registered`);if(g.bin.size===0)return sA.skip;let f=o.find(p=>p.supportsPackage(g,a));if(!f)return sA.skip;let h=null;try{h=await f.findPackageLocation(g,a)}catch(p){if(p.code==="LOCATOR_NOT_INSTALLED")return sA.skip;throw p}return{dependency:g,packageLocation:h}}));for(let u of c){if(u===sA.skip)continue;let{dependency:g,packageLocation:f}=u;for(let[h,p]of g.bin)i.set(h,[g,T.fromPortablePath(D.resolve(f,p))])}return i}async function UW(t){return await XI(t.anchoredLocator,{project:t.project})}async function jW(t,e,r,{cwd:i,project:n,stdin:s,stdout:o,stderr:a,nodeArgs:l=[],packageAccessibleBinaries:c}){c!=null||(c=await XI(t,{project:n}));let u=c.get(e);if(!u)throw new Error(`Binary not found (${e}) for ${nt(n.configuration,t)}`);return await L.mktempPromise(async g=>{let[,f]=u,h=await $f({project:n,locator:t,binFolder:g});await Promise.all(Array.from(c,([m,[,I]])=>io(h.BERRY_BIN_FOLDER,rr(m),process.execPath,[I])));let p;try{p=await Ts(process.execPath,[...l,f,...r],{cwd:i,env:h,stdin:s,stdout:o,stderr:a})}finally{await L.removePromise(h.BERRY_BIN_FOLDER)}return p.code})}async function qQe(t,e,r,{cwd:i,stdin:n,stdout:s,stderr:o,packageAccessibleBinaries:a}){return await jW(t.anchoredLocator,e,r,{project:t.project,cwd:i,stdin:n,stdout:s,stderr:o,packageAccessibleBinaries:a})}var hr={};et(hr,{convertToZip:()=>lDe,extractArchiveTo:()=>uDe,makeArchiveFromDirectory:()=>ADe,safeTime:()=>zi});var W4=te(require("stream")),z4=te(k4());var Y4=te(require("os")),j4=te(H4()),G4=te(require("worker_threads")),Vx=class{constructor(e){this.source=e;this.pool=[];this.queue=new j4.default({concurrency:Math.max(1,(0,Y4.cpus)().length)});let r=setTimeout(()=>{if(!(this.queue.size!==0||this.queue.pending!==0)){for(let i of this.pool)i.terminate();this.pool=[]}},1e3).unref();this.queue.on("idle",()=>{r.refresh()})}run(e){return this.queue.add(()=>{var i;let r=(i=this.pool.pop())!=null?i:new G4.Worker(this.source,{eval:!0,execArgv:[...process.execArgv,"--unhandled-rejections=strict"]});return r.ref(),new Promise((n,s)=>{let o=a=>{a!==0&&s(new Error(`Worker exited with code ${a}`))};r.once("message",a=>{this.pool.push(r),r.unref(),r.off("error",s),r.off("exit",o),n(a)}),r.once("error",s),r.once("exit",o),r.postMessage(e)})})}};var V4=te(J4()),zi=456789e3;async function ADe(t,{baseFs:e=new Ft,prefixPath:r=we.root,compressionLevel:i,inMemory:n=!1}={}){let s=await gi(),o;if(n)o=new Qr(null,{libzip:s,level:i});else{let l=await L.mktempPromise(),c=D.join(l,"archive.zip");o=new Qr(c,{create:!0,libzip:s,level:i})}let a=D.resolve(we.root,r);return await o.copyPromise(a,t,{baseFs:e,stableTime:!0,stableSort:!0}),o}var X4;async function lDe(t,e){let r=await L.mktempPromise(),i=D.join(r,"archive.zip");return X4||(X4=new Vx((0,V4.getContent)())),await X4.run({tmpFile:i,tgz:t,opts:e}),new Qr(i,{libzip:await gi(),level:e.compressionLevel})}async function*cDe(t){let e=new z4.default.Parse,r=new W4.PassThrough({objectMode:!0,autoDestroy:!0,emitClose:!0});e.on("entry",i=>{r.write(i)}),e.on("error",i=>{r.destroy(i)}),e.on("close",()=>{r.destroy()}),e.end(t);for await(let i of r){let n=i;yield n,n.resume()}}async function uDe(t,e,{stripComponents:r=0,prefixPath:i=we.dot}={}){var s,o;function n(a){if(a.path[0]==="/")return!0;let l=a.path.split(/\//g);return!!(l.some(c=>c==="..")||l.length<=r)}for await(let a of cDe(t)){if(n(a))continue;let l=D.normalize(T.toPortablePath(a.path)).replace(/\/$/,"").split(/\//g);if(l.length<=r)continue;let c=l.slice(r).join("/"),u=D.join(i,c),g=420;switch((a.type==="Directory"||(((s=a.mode)!=null?s:0)&73)!=0)&&(g|=73),a.type){case"Directory":e.mkdirpSync(D.dirname(u),{chmod:493,utimes:[zi,zi]}),e.mkdirSync(u),e.chmodSync(u,g),e.utimesSync(u,zi,zi);break;case"OldFile":case"File":e.mkdirpSync(D.dirname(u),{chmod:493,utimes:[zi,zi]}),e.writeFileSync(u,await af(a)),e.chmodSync(u,g),e
Line truncated
|
||||
`);return}let s=(0,$4.asTree)(ez(t,{configuration:e}),!1,!1);if(n>=1&&(s=s.replace(/^([├└]─)/gm,`\u2502
|
||||
$1`).replace(/^│\n/,"")),n>=2)for(let a=0;a<2;++a)s=s.replace(/^([│ ].{2}[├│ ].{2}[^\n]+\n)(([│ ]).{2}[├└].{2}[^\n]*\n[│ ].{2}[│ ].{2}[├└]─)/gm,`$1$3 \u2502
|
||||
$2`).replace(/^│\n/,"");if(n>=3)throw new Error("Only the first two levels are accepted by treeUtils.emitTree");r.write(s)}var _x=te(require("fs"));var fDe=8,ft=class{constructor(e,{configuration:r,immutable:i=r.get("enableImmutableCache"),check:n=!1}){this.markedFiles=new Set;this.mutexes=new Map;this.configuration=r,this.cwd=e,this.immutable=i,this.check=n;let s=r.get("cacheKeyOverride");if(s!==null)this.cacheKey=`${s}`;else{let o=r.get("compressionLevel"),a=o!==qa?`c${o}`:"";this.cacheKey=[fDe,a].join("")}}static async find(e,{immutable:r,check:i}={}){let n=new ft(e.get("cacheFolder"),{configuration:e,immutable:r,check:i});return await n.setup(),n}get mirrorCwd(){if(!this.configuration.get("enableMirror"))return null;let e=`${this.configuration.get("globalFolder")}/cache`;return e!==this.cwd?e:null}getVersionFilename(e){return`${$l(e)}-${this.cacheKey}.zip`}getChecksumFilename(e,r){let n=hDe(r).slice(0,10);return`${$l(e)}-${n}.zip`}getLocatorPath(e,r){return this.mirrorCwd===null?D.resolve(this.cwd,this.getVersionFilename(e)):r===null||$x(r)!==this.cacheKey?null:D.resolve(this.cwd,this.getChecksumFilename(e,r))}getLocatorMirrorPath(e){let r=this.mirrorCwd;return r!==null?D.resolve(r,this.getVersionFilename(e)):null}async setup(){if(!this.configuration.get("enableGlobalCache"))if(this.immutable){if(!await L.existsPromise(this.cwd))throw new _e(z.IMMUTABLE_CACHE,"Cache path does not exist.")}else{await L.mkdirPromise(this.cwd,{recursive:!0});let e=D.resolve(this.cwd,".gitignore");await L.changeFilePromise(e,`/.gitignore
|
||||
*.flock
|
||||
`)}(this.mirrorCwd||!this.immutable)&&await L.mkdirPromise(this.mirrorCwd||this.cwd,{recursive:!0})}async fetchPackageFromCache(e,r,{onHit:i,onMiss:n,loader:s,skipIntegrityCheck:o}){let a=this.getLocatorMirrorPath(e),l=new Ft,c=async(N,O=null)=>{let P=!o||!r?`${this.cacheKey}/${await Pm(N)}`:r;if(O!==null){let J=!o||!r?`${this.cacheKey}/${await Pm(O)}`:r;if(P!==J)throw new _e(z.CACHE_CHECKSUM_MISMATCH,"The remote archive doesn't match the local checksum - has the local cache been corrupted?")}if(r!==null&&P!==r){let J;switch(this.check?J="throw":$x(r)!==$x(P)?J="update":J=this.configuration.get("checksumBehavior"),J){case"ignore":return r;case"update":return P;default:case"throw":throw new _e(z.CACHE_CHECKSUM_MISMATCH,"The remote archive doesn't match the expected checksum")}}return P},u=async N=>{if(!s)throw new Error(`Cache check required but no loader configured for ${nt(this.configuration,e)}`);let O=await s(),P=O.getRealPath();return O.saveAndClose(),await L.chmodPromise(P,420),await c(N,P)},g=async()=>{if(a===null||!await L.existsPromise(a)){let P=await s(),J=P.getRealPath();return P.saveAndClose(),{source:"loader",path:J}}let N=await L.mktempPromise(),O=D.join(N,this.getVersionFilename(e));return await L.copyFilePromise(a,O,_x.default.constants.COPYFILE_FICLONE),{source:"mirror",path:O}},f=async()=>{if(!s)throw new Error(`Cache entry required but missing for ${nt(this.configuration,e)}`);if(this.immutable)throw new _e(z.IMMUTABLE_CACHE,`Cache entry required but missing for ${nt(this.configuration,e)}`);let{path:N,source:O}=await g();await L.chmodPromise(N,420);let P=await c(N),J=this.getLocatorPath(e,P);if(!J)throw new Error("Assertion failed: Expected the cache path to be available");let oe=null;if(O!=="mirror"&&a!==null){let K=await L.mktempPromise();oe=D.join(K,this.getVersionFilename(e)),await L.copyFilePromise(N,oe,_x.default.constants.COPYFILE_FICLONE)}return await this.writeFileWithLock(J,async()=>await this.writeFileWithLock(O==="mirror"?null:a,async()=>(await L.movePromise(N,J),oe&&a&&await L.movePromise(oe,a),[J,P])))},h=async()=>{let O=(async()=>{let P=this.getLocatorPath(e,r),J=P!==null?await l.existsPromise(P):!1,oe=J?i:n;if(oe&&oe(),J){let K=null,A=P;return this.check?K=await u(A):K=await c(A),[A,K]}else return f()})();this.mutexes.set(e.locatorHash,O);try{return await O}finally{this.mutexes.delete(e.locatorHash)}};for(let N;N=this.mutexes.get(e.locatorHash);)await N;let[p,m]=await h();this.markedFiles.add(p);let I=null,y=await gi(),B=new bg(()=>zQ(()=>I=new Qr(p,{baseFs:l,libzip:y,readOnly:!0}),N=>`Failed to open the cache entry for ${nt(this.configuration,e)}: ${N}`),D);return[new Ja(p,{baseFs:B,pathUtils:D}),()=>{I!==null&&I.discardAndClose()},m]}async writeFileWithLock(e,r){return e===null?await r():await L.lockPromise(e,async()=>await r())}};function $x(t){let e=t.indexOf("/");return e!==-1?t.slice(0,e):null}function hDe(t){let e=t.indexOf("/");return e!==-1?t.slice(e+1):t}var lz=te(nz()),jE=te(Ng());var cz=te(GI()),nk=te(require("stream"));var sz={hooks:{reduceDependency:(t,e,r,i,{resolver:n,resolveOptions:s})=>{for(let{pattern:o,reference:a}of e.topLevelWorkspace.manifest.resolutions){if(o.from&&o.from.fullName!==dt(r)||o.from&&o.from.description&&o.from.description!==r.reference||o.descriptor.fullName!==dt(t)||o.descriptor.description&&o.descriptor.description!==t.range)continue;return n.bindDescriptor(zt(t,a),e.topLevelWorkspace.anchoredLocator,s)}return t},validateProject:async(t,e)=>{for(let r of t.workspaces){let i=Ef(t.configuration,r);await t.configuration.triggerHook(n=>n.validateWorkspace,r,{reportWarning:(n,s)=>e.reportWarning(n,`${i}: ${s}`),reportError:(n,s)=>e.reportError(n,`${i}: ${s}`)})}},validateWorkspace:async(t,e)=>{let{manifest:r}=t;r.resolutions.length&&t.cwd!==t.project.cwd&&r.errors.push(new Error("Resolutions field will be ignored"));for(let i of r.errors)e.reportWarning(z.INVALID_MANIFEST,i.message)}}};var tk=class{constructor(e){this.fetchers=e}supports(e,r){return!!this.tryFetcher(e,r)}getLocalPath(e,r){return this.getFetcher(e,r).getLocalPath(e,r)}async fetch(e,r){return await this.getFetcher(e,r).fetch(e,r)}tryFetcher(e,r){let i=this.fetchers.find(n=>n.supports(e,r));return i||null}getFetcher(e,r){let i=this.fetchers.find(n=>n.supports(e,r));if(!i)throw new _e(z.FETCHER_NOT_FOUND,`${nt(r.project.configuration,e)} isn't supported by any available fetcher`);return i}};var Xc=class{constructor(e){this.resolvers=e.filter(r=>r)}supportsDescriptor(e,r){return!!this.tryResolverByDescriptor(e,r)}supportsLocator(e,r){return!!this.tryResolverByLocator(e,r)}shouldPersistResolution(e,r){return this.getResolverByLocator(e,r).shouldPersistResolution(e,r)}bindDescriptor(e,r,i){return this.getResolverByDescriptor(e,i).bindDescriptor(e,r,i)}getResolutionDependencies(e,r){return this.getResolverByDescriptor(e,r).getResolutionDependencies(e,r)}async getCandidates(e,r,i){return await this.getResolverByDescriptor(e,i).getCandidates(e,r,i)}async getSatisfying(e,r,i){retur
Line truncated
|
||||
`);return{stdout:s,stderr:o}}makeResolver(){let e=[];for(let r of this.plugins.values())for(let i of r.resolvers||[])e.push(new i);return new Xc([new YE,new Ci,new rk,...e])}makeFetcher(){let e=[];for(let r of this.plugins.values())for(let i of r.fetchers||[])e.push(new i);return new tk([new Ih,new ik,...e])}getLinkers(){let e=[];for(let r of this.plugins.values())for(let i of r.linkers||[])e.push(new i);return e}async refreshPackageExtensions(){this.packageExtensions=new Map;let e=this.packageExtensions,r=(i,n,{userProvided:s=!1}={})=>{if(!Kn(i.range))throw new Error("Only semver ranges are allowed as keys for the lockfileExtensions setting");let o=new ze;o.load(n,{yamlCompatibilityMode:!0});let a=Yl(e,i.identHash),l=[];a.push([i.range,l]);let c={status:qr.Inactive,userProvided:s,parentDescriptor:i};for(let u of o.dependencies.values())l.push(V(v({},c),{type:Dr.Dependency,descriptor:u}));for(let u of o.peerDependencies.values())l.push(V(v({},c),{type:Dr.PeerDependency,descriptor:u}));for(let[u,g]of o.peerDependenciesMeta)for(let[f,h]of Object.entries(g))l.push(V(v({},c),{type:Dr.PeerDependencyMeta,selector:u,key:f,value:h}))};await this.triggerHook(i=>i.registerPackageExtensions,this,r);for(let[i,n]of this.get("packageExtensions"))r(Jo(i,!0),nm(n),{userProvided:!0})}normalizePackage(e){let r=hf(e);if(this.packageExtensions==null)throw new Error("refreshPackageExtensions has to be called before normalizing packages");let i=this.packageExtensions.get(e.identHash);if(typeof i!="undefined"){let s=e.version;if(s!==null){for(let[o,a]of i)if(!!_f(s,o))for(let l of a)switch(l.status===qr.Inactive&&(l.status=qr.Redundant),l.type){case Dr.Dependency:typeof r.dependencies.get(l.descriptor.identHash)=="undefined"&&(l.status=qr.Active,r.dependencies.set(l.descriptor.identHash,l.descriptor));break;case Dr.PeerDependency:typeof r.peerDependencies.get(l.descriptor.identHash)=="undefined"&&(l.status=qr.Active,r.peerDependencies.set(l.descriptor.identHash,l.descriptor));break;case Dr.PeerDependencyMeta:{let c=r.peerDependenciesMeta.get(l.selector);(typeof c=="undefined"||!Object.prototype.hasOwnProperty.call(c,l.key)||c[l.key]!==l.value)&&(l.status=qr.Active,Ys(r.peerDependenciesMeta,l.selector,()=>({}))[l.key]=l.value)}break;default:JQ(l);break}}}let n=s=>s.scope?`${s.scope}__${s.name}`:`${s.name}`;for(let s of r.peerDependencies.values()){if(s.scope==="types")continue;let o=n(s),a=Go("types",o),l=dt(a);r.peerDependencies.has(a.identHash)||r.peerDependenciesMeta.has(l)||r.peerDependenciesMeta.set(l,{optional:!0})}for(let s of r.peerDependenciesMeta.keys()){let o=Si(s);r.peerDependencies.has(o.identHash)||r.peerDependencies.set(o.identHash,zt(o,"*"))}return r.dependencies=new Map(bi(r.dependencies,([,s])=>xi(s))),r.peerDependencies=new Map(bi(r.peerDependencies,([,s])=>xi(s))),r}getLimit(e){return Ys(this.limits,e,()=>(0,cz.default)(this.get(e)))}async triggerHook(e,...r){for(let i of this.plugins.values()){let n=i.hooks;if(!n)continue;let s=e(n);!s||await s(...r)}}async triggerMultipleHooks(e,r){for(let i of r)await this.triggerHook(e,...i)}async reduceHook(e,r,...i){let n=r;for(let s of this.plugins.values()){let o=s.hooks;if(!o)continue;let a=e(o);!a||(n=await a(n,...i))}return n}async firstHook(e,...r){for(let i of this.plugins.values()){let n=i.hooks;if(!n)continue;let s=e(n);if(!s)continue;let o=await s(...r);if(typeof o!="undefined")return o}return null}},le=co;le.telemetry=null;var Vi;(function(r){r[r.SCRIPT=0]="SCRIPT",r[r.SHELLCODE=1]="SHELLCODE"})(Vi||(Vi={}));var uo=class extends ci{constructor({configuration:e,stdout:r,suggestInstall:i=!0}){super();this.errorCount=0;Bf(this,{configuration:e}),this.configuration=e,this.stdout=r,this.suggestInstall=i}static async start(e,r){let i=new this(e);try{await r(i)}catch(n){i.reportExceptionOnce(n)}finally{await i.finalize()}return i}hasErrors(){return this.errorCount>0}exitCode(){return this.hasErrors()?1:0}reportCacheHit(e){}reportCacheMiss(e){}startTimerSync(e,r,i){return(typeof r=="function"?r:i)()}async startTimerPromise(e,r,i){return await(typeof r=="function"?r:i)()}async startCacheReport(e){return await e()}reportSeparator(){}reportInfo(e,r){}reportWarning(e,r){}reportError(e,r){this.errorCount+=1,this.stdout.write(`${qe(this.configuration,"\u27A4","redBright")} ${this.formatNameWithHyperlink(e)}: ${r}
|
||||
`)}reportProgress(e){let r=Promise.resolve().then(async()=>{for await(let{}of e);}),i=()=>{};return V(v({},r),{stop:i})}reportJson(e){}async finalize(){this.errorCount>0&&(this.stdout.write(`
|
||||
`),this.stdout.write(`${qe(this.configuration,"\u27A4","redBright")} Errors happened when preparing the environment required to run this command.
|
||||
`),this.suggestInstall&&this.stdout.write(`${qe(this.configuration,"\u27A4","redBright")} This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help.
|
||||
`))}formatNameWithHyperlink(e){return kS(e,{configuration:this.configuration,json:!1})}};var uy=te(require("crypto")),r6=te(Wz()),gy=te(e6()),i6=te(GI()),n6=te(cr()),Tk=te(require("util")),Ok=te(require("v8")),Kk=te(require("zlib"));var iPe=[[/^(git(?:\+(?:https|ssh))?:\/\/.*(?:\.git)?)#(.*)$/,(t,e,r,i)=>`${r}#commit=${i}`],[/^https:\/\/((?:[^/]+?)@)?codeload\.github\.com\/([^/]+\/[^/]+)\/tar\.gz\/([0-9a-f]+)$/,(t,e,r="",i,n)=>`https://${r}github.com/${i}.git#commit=${n}`],[/^https:\/\/((?:[^/]+?)@)?github\.com\/([^/]+\/[^/]+?)(?:\.git)?#([0-9a-f]+)$/,(t,e,r="",i,n)=>`https://${r}github.com/${i}.git#commit=${n}`],[/^https?:\/\/[^/]+\/(?:[^/]+\/)*(?:@.+(?:\/|(?:%2f)))?([^/]+)\/(?:-|download)\/\1-[^/]+\.tgz(?:#|$)/,t=>`npm:${t}`],[/^https:\/\/npm\.pkg\.github\.com\/download\/(?:@[^/]+)\/(?:[^/]+)\/(?:[^/]+)\/(?:[0-9a-f]+)$/,t=>`npm:${t}`],[/^https:\/\/npm\.fontawesome\.com\/(?:@[^/]+)\/([^/]+)\/-\/([^/]+)\/\1-\2.tgz(?:#|$)/,t=>`npm:${t}`],[/^https?:\/\/(?:[^\\.]+)\.jfrog\.io\/.*\/(@[^/]+)\/([^/]+)\/-\/\1\/\2-(?:[.\d\w-]+)\.tgz(?:#|$)/,(t,e)=>Tm({protocol:"npm:",source:null,selector:t,params:{__archiveUrl:e}})],[/^[^/]+\.tgz#[0-9a-f]+$/,t=>`npm:${t}`]],Lk=class{constructor(){this.resolutions=null}async setup(e,{report:r}){let i=D.join(e.cwd,e.configuration.get("lockfileFilename"));if(!L.existsSync(i))return;let n=await L.readFilePromise(i,"utf8"),s=Kr(n);if(Object.prototype.hasOwnProperty.call(s,"__metadata"))return;let o=this.resolutions=new Map;for(let a of Object.keys(s)){let l=mf(a);if(!l){r.reportWarning(z.YARN_IMPORT_FAILED,`Failed to parse the string "${a}" into a proper descriptor`);continue}Kn(l.range)&&(l=zt(l,`npm:${l.range}`));let{version:c,resolved:u}=s[a];if(!u)continue;let g;for(let[h,p]of iPe){let m=u.match(h);if(m){g=p(c,...m);break}}if(!g){r.reportWarning(z.YARN_IMPORT_FAILED,`${Ut(e.configuration,l)}: Only some patterns can be imported from legacy lockfiles (not "${u}")`);continue}let f=l;try{let h=_l(l.range),p=mf(h.selector,!0);p&&(f=p)}catch{}o.set(l.descriptorHash,Ai(f,g))}}supportsDescriptor(e,r){return this.resolutions?this.resolutions.has(e.descriptorHash):!1}supportsLocator(e,r){return!1}shouldPersistResolution(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}bindDescriptor(e,r,i){return e}getResolutionDependencies(e,r){return[]}async getCandidates(e,r,i){if(!this.resolutions)throw new Error("Assertion failed: The resolution store should have been setup");let n=this.resolutions.get(e.descriptorHash);if(!n)throw new Error("Assertion failed: The resolution should have been registered");return[n]}async getSatisfying(e,r,i){return null}async resolve(e,r){throw new Error("Assertion failed: This resolver doesn't support resolving locators to packages")}};var cy=class{supportsDescriptor(e,r){return!!(r.project.storedResolutions.get(e.descriptorHash)||r.project.originalPackages.has(Lm(e).locatorHash))}supportsLocator(e,r){return!!r.project.originalPackages.has(e.locatorHash)}shouldPersistResolution(e,r){throw new Error("The shouldPersistResolution method shouldn't be called on the lockfile resolver, which would always answer yes")}bindDescriptor(e,r,i){return e}getResolutionDependencies(e,r){return[]}async getCandidates(e,r,i){let n=i.project.originalPackages.get(Lm(e).locatorHash);if(n)return[n];let s=i.project.storedResolutions.get(e.descriptorHash);if(!s)throw new Error("Expected the resolution to have been successful - resolution not found");if(n=i.project.originalPackages.get(s),!n)throw new Error("Expected the resolution to have been successful - package not found");return[n]}async getSatisfying(e,r,i){return null}async resolve(e,r){let i=r.project.originalPackages.get(e.locatorHash);if(!i)throw new Error("The lockfile resolver isn't meant to resolve packages - they should already have been stored into a cache");return i}};var Mk=class{constructor(e){this.resolver=e}supportsDescriptor(e,r){return this.resolver.supportsDescriptor(e,r)}supportsLocator(e,r){return this.resolver.supportsLocator(e,r)}shouldPersistResolution(e,r){return this.resolver.shouldPersistResolution(e,r)}bindDescriptor(e,r,i){return this.resolver.bindDescriptor(e,r,i)}getResolutionDependencies(e,r){return this.resolver.getResolutionDependencies(e,r)}async getCandidates(e,r,i){throw new _e(z.MISSING_LOCKFILE_ENTRY,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async getSatisfying(e,r,i){throw new _e(z.MISSING_LOCKFILE_ENTRY,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}async resolve(e,r){throw new _e(z.MISSING_LOCKFILE_ENTRY,`This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile`)}};var Br=class extends ci{reportCacheHit(e){}reportCacheMiss(e){}startTimerSync(e,r,i){return(typeof r=="function"?r:i)()}async startTimerPromise(e,r,i){return await(typeof r=="function"?r:i)()}async startCacheReport(e){return awai
Line truncated
|
||||
`;await L.changeFilePromise(r,i,{automaticNewlines:!0}),this.manifest.raw=e}};var Uk=4,nPe=1,sPe=/ *, */g,s6=/\/$/,oPe=32,aPe=(0,Tk.promisify)(Kk.default.gzip),APe=(0,Tk.promisify)(Kk.default.gunzip),kr;(function(r){r.UpdateLockfile="update-lockfile",r.SkipBuild="skip-build"})(kr||(kr={}));var Hk={restoreInstallersCustomData:["installersCustomData"],restoreResolutions:["accessibleLocators","optionalBuilds","storedDescriptors","storedResolutions","storedPackages","lockFileChecksum"],restoreBuildState:["storedBuildState"]},Fe=class{constructor(e,{configuration:r}){this.resolutionAliases=new Map;this.workspaces=[];this.workspacesByCwd=new Map;this.workspacesByIdent=new Map;this.storedResolutions=new Map;this.storedDescriptors=new Map;this.storedPackages=new Map;this.storedChecksums=new Map;this.storedBuildState=new Map;this.accessibleLocators=new Set;this.originalPackages=new Map;this.optionalBuilds=new Set;this.peerRequirements=new Map;this.installersCustomData=new Map;this.lockFileChecksum=null;this.installStateChecksum=null;this.configuration=r,this.cwd=e}static async find(e,r){var c,u,g;if(!e.projectCwd)throw new me(`No project found in ${r}`);let i=e.projectCwd,n=r,s=null;for(;s!==e.projectCwd;){if(s=n,L.existsSync(D.join(s,xt.manifest))){i=s;break}n=D.dirname(s)}let o=new Fe(e.projectCwd,{configuration:e});(c=le.telemetry)==null||c.reportProject(o.cwd),await o.setupResolutions(),await o.setupWorkspaces(),(u=le.telemetry)==null||u.reportWorkspaceCount(o.workspaces.length),(g=le.telemetry)==null||g.reportDependencyCount(o.workspaces.reduce((f,h)=>f+h.manifest.dependencies.size+h.manifest.devDependencies.size,0));let a=o.tryWorkspaceByCwd(i);if(a)return{project:o,workspace:a,locator:a.anchoredLocator};let l=await o.findLocatorForLocation(`${i}/`,{strict:!0});if(l)return{project:o,locator:l,workspace:null};throw new me(`The nearest package directory (${qe(e,i,Pe.PATH)}) doesn't seem to be part of the project declared in ${qe(e,o.cwd,Pe.PATH)}.
|
||||
|
||||
- If the project directory is right, it might be that you forgot to list ${qe(e,D.relative(o.cwd,i),Pe.PATH)} as a workspace.
|
||||
- If it isn't, it's likely because you have a yarn.lock or package.json file there, confusing the project root detection.`)}async setupResolutions(){this.storedResolutions=new Map,this.storedDescriptors=new Map,this.storedPackages=new Map,this.lockFileChecksum=null;let e=D.join(this.cwd,this.configuration.get("lockfileFilename")),r=this.configuration.get("defaultLanguageName");if(L.existsSync(e)){let i=await L.readFilePromise(e,"utf8");this.lockFileChecksum=ai(`${nPe}`,i);let n=Kr(i);if(n.__metadata){let s=n.__metadata.version,o=n.__metadata.cacheKey;for(let a of Object.keys(n)){if(a==="__metadata")continue;let l=n[a];if(typeof l.resolution=="undefined")throw new Error(`Assertion failed: Expected the lockfile entry to have a resolution field (${a})`);let c=hA(l.resolution,!0),u=new ze;u.load(l,{yamlCompatibilityMode:!0});let g=u.version,f=u.languageName||r,h=l.linkType.toUpperCase(),p=u.dependencies,m=u.peerDependencies,I=u.dependenciesMeta,y=u.peerDependenciesMeta,B=u.bin;if(l.checksum!=null){let x=typeof o!="undefined"&&!l.checksum.includes("/")?`${o}/${l.checksum}`:l.checksum;this.storedChecksums.set(c.locatorHash,x)}if(s>=Uk){let x=V(v({},c),{version:g,languageName:f,linkType:h,dependencies:p,peerDependencies:m,dependenciesMeta:I,peerDependenciesMeta:y,bin:B});this.originalPackages.set(x.locatorHash,x)}for(let x of a.split(sPe)){let F=Jo(x);if(this.storedDescriptors.set(F.descriptorHash,F),s>=Uk)this.storedResolutions.set(F.descriptorHash,c.locatorHash);else{let N=Mm(c);N.descriptorHash!==F.descriptorHash&&(this.storedDescriptors.set(N.descriptorHash,N),this.resolutionAliases.set(F.descriptorHash,N.descriptorHash))}}}}}}async setupWorkspaces(){this.workspaces=[],this.workspacesByCwd=new Map,this.workspacesByIdent=new Map;let e=[this.cwd];for(;e.length>0;){let r=e;e=[];for(let i of r){if(this.workspacesByCwd.has(i))continue;let n=await this.addWorkspace(i),s=this.storedPackages.get(n.anchoredLocator.locatorHash);s&&(n.dependencies=s.dependencies);for(let o of n.workspacesCwds)e.push(o)}}}async addWorkspace(e){let r=new Lh(e,{project:this});await r.setup();let i=this.workspacesByIdent.get(r.locator.identHash);if(typeof i!="undefined")throw new Error(`Duplicate workspace name ${Cr(this.configuration,r.locator)}: ${T.fromPortablePath(e)} conflicts with ${T.fromPortablePath(i.cwd)}`);return this.workspaces.push(r),this.workspacesByCwd.set(e,r),this.workspacesByIdent.set(r.locator.identHash,r),r}get topLevelWorkspace(){return this.getWorkspaceByCwd(this.cwd)}tryWorkspaceByCwd(e){D.isAbsolute(e)||(e=D.resolve(this.cwd,e)),e=D.normalize(e).replace(/\/+$/,"");let r=this.workspacesByCwd.get(e);return r||null}getWorkspaceByCwd(e){let r=this.tryWorkspaceByCwd(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByFilePath(e){let r=null;for(let i of this.workspaces)D.relative(i.cwd,e).startsWith("../")||r&&r.cwd.length>=i.cwd.length||(r=i);return r||null}getWorkspaceByFilePath(e){let r=this.tryWorkspaceByFilePath(e);if(!r)throw new Error(`Workspace not found (${e})`);return r}tryWorkspaceByIdent(e){let r=this.workspacesByIdent.get(e.identHash);return typeof r=="undefined"?null:r}getWorkspaceByIdent(e){let r=this.tryWorkspaceByIdent(e);if(!r)throw new Error(`Workspace not found (${Cr(this.configuration,e)})`);return r}tryWorkspaceByDescriptor(e){let r=this.tryWorkspaceByIdent(e);return r===null||(qo(e)&&(e=pf(e)),!r.accepts(e.range))?null:r}getWorkspaceByDescriptor(e){let r=this.tryWorkspaceByDescriptor(e);if(r===null)throw new Error(`Workspace not found (${Ut(this.configuration,e)})`);return r}tryWorkspaceByLocator(e){let r=this.tryWorkspaceByIdent(e);return r===null||(ss(e)&&(e=df(e)),r.locator.locatorHash!==e.locatorHash&&r.anchoredLocator.locatorHash!==e.locatorHash)?null:r}getWorkspaceByLocator(e){let r=this.tryWorkspaceByLocator(e);if(!r)throw new Error(`Workspace not found (${nt(this.configuration,e)})`);return r}refreshWorkspaceDependencies(){for(let e of this.workspaces){let r=this.storedPackages.get(e.anchoredLocator.locatorHash);if(!r)throw new Error(`Assertion failed: Expected workspace ${Ef(this.configuration,e)} (${qe(this.configuration,D.join(e.cwd,xt.manifest),Pe.PATH)}) to have been resolved. Run "yarn install" to update the lockfile`);e.dependencies=new Map(r.dependencies)}}forgetResolution(e){let r=n=>{this.storedResolutions.delete(n),this.storedDescriptors.delete(n)},i=n=>{this.originalPackages.delete(n),this.storedPackages.delete(n),this.accessibleLocators.delete(n)};if("descriptorHash"in e){let n=this.storedResolutions.get(e.descriptorHash);r(e.descriptorHash);let s=new Set(this.storedResolutions.values());typeof n!="undefined"&&!s.has(n)&&i(n)}if("locatorHash"in e){i(e.locatorHash);for(let[n,s]of this.storedResolutions)s===e.locatorHash&&r(n)}}forgetTransientResolutions(){let e=this.configuration.makeResolver();for(let r of this.originalPackages.values()){let i;try{i=e.shouldPersistResolution(r,{project:this,resolver:e})}catch{i=!1}i||this.forgetResolution(r)}}forgetVirt
Line truncated
|
||||
`;switch(Ne){case Vi.SCRIPT:Ke+=`# Script name: ${Je}
|
||||
`;break;case Vi.SHELLCODE:Ke+=`# Script code: ${Je}
|
||||
`;break}let ie=null;if(!await L.mktempPromise(async Se=>{let fe=D.join(Se,"build.log"),{stdout:Ie,stderr:pe}=this.configuration.getSubprocessStreams(fe,{header:Ke,prefix:nt(this.configuration,ee),report:r}),Qe;try{switch(Ne){case Vi.SCRIPT:Qe=await VI(ee,Je,[],{cwd:ve,project:this,stdin:ie,stdout:Ie,stderr:pe});break;case Vi.SHELLCODE:Qe=await PS(ee,Je,[],{cwd:ve,project:this,stdin:ie,stdout:Ie,stderr:pe});break}}catch(X){pe.write(X.stack),Qe=1}if(Ie.end(),pe.end(),Qe===0)return P.set(ee.locatorHash,R),!0;L.detachTemp(Se);let Z=`${nt(this.configuration,ee)} couldn't be built successfully (exit code ${qe(this.configuration,Qe,Pe.NUMBER)}, logs can be found here: ${qe(this.configuration,fe,Pe.PATH)})`;return this.optionalBuilds.has(ee.locatorHash)?(r.reportInfo(z.BUILD_FAILED,Z),P.set(ee.locatorHash,R),!0):(r.reportError(z.BUILD_FAILED,Z),!1)}))return}})())}}if(await Promise.all(A),K===y.size){let W=Array.from(y).map(ee=>{let re=this.storedPackages.get(ee);if(!re)throw new Error("Assertion failed: The package should have been registered");return nt(this.configuration,re)}).join(", ");r.reportError(z.CYCLIC_DEPENDENCIES,`Some packages have circular dependencies that make their build order unsatisfiable - as a result they won't be built (affected packages are: ${W})`);break}}this.storedBuildState=P}async install(e){var a,l;let r=this.configuration.get("nodeLinker");(a=le.telemetry)==null||a.reportInstall(r),await e.report.startTimerPromise("Project validation",{skipIfEmpty:!0},async()=>{await this.configuration.triggerHook(c=>c.validateProject,this,{reportWarning:e.report.reportWarning.bind(e.report),reportError:e.report.reportError.bind(e.report)})});for(let c of this.configuration.packageExtensions.values())for(let[,u]of c)for(let g of u)g.status=qr.Inactive;let i=D.join(this.cwd,this.configuration.get("lockfileFilename")),n=null;if(e.immutable)try{n=await L.readFilePromise(i,"utf8")}catch(c){throw c.code==="ENOENT"?new _e(z.FROZEN_LOCKFILE_EXCEPTION,"The lockfile would have been created by this install, which is explicitly forbidden."):c}await e.report.startTimerPromise("Resolution step",async()=>{await this.resolveEverything(e)}),await e.report.startTimerPromise("Post-resolution validation",{skipIfEmpty:!0},async()=>{for(let[,c]of this.configuration.packageExtensions)for(let[,u]of c)for(let g of u)if(g.userProvided){let f=qe(this.configuration,g,Pe.PACKAGE_EXTENSION);switch(g.status){case qr.Inactive:e.report.reportWarning(z.UNUSED_PACKAGE_EXTENSION,`${f}: No matching package in the dependency tree; you may not need this rule anymore.`);break;case qr.Redundant:e.report.reportWarning(z.REDUNDANT_PACKAGE_EXTENSION,`${f}: This rule seems redundant when applied on the original package; the extension may have been applied upstream.`);break}}if(n!==null){let c=Dl(n,this.generateLockfile());if(c!==n){let u=(0,r6.structuredPatch)(i,i,n,c);e.report.reportSeparator();for(let g of u.hunks){e.report.reportInfo(null,`@@ -${g.oldStart},${g.oldLines} +${g.newStart},${g.newLines} @@`);for(let f of g.lines)f.startsWith("+")?e.report.reportError(z.FROZEN_LOCKFILE_EXCEPTION,qe(this.configuration,f,Pe.ADDED)):f.startsWith("-")?e.report.reportError(z.FROZEN_LOCKFILE_EXCEPTION,qe(this.configuration,f,Pe.REMOVED)):e.report.reportInfo(null,qe(this.configuration,f,"grey"))}throw e.report.reportSeparator(),new _e(z.FROZEN_LOCKFILE_EXCEPTION,"The lockfile would have been modified by this install, which is explicitly forbidden.")}}});for(let c of this.configuration.packageExtensions.values())for(let[,u]of c)for(let g of u)g.userProvided&&g.status===qr.Active&&((l=le.telemetry)==null||l.reportPackageExtension(rc(g,Pe.PACKAGE_EXTENSION)));await e.report.startTimerPromise("Fetch step",async()=>{await this.fetchEverything(e),(typeof e.persistProject=="undefined"||e.persistProject)&&e.mode!==kr.UpdateLockfile&&await this.cacheCleanup(e)});let s=e.immutable?[...new Set(this.configuration.get("immutablePatterns"))].sort():[],o=await Promise.all(s.map(async c=>Fm(c,{cwd:this.cwd})));(typeof e.persistProject=="undefined"||e.persistProject)&&await this.persist(),await e.report.startTimerPromise("Link step",async()=>{if(e.mode===kr.UpdateLockfile){e.report.reportWarning(z.UPDATE_LOCKFILE_ONLY_SKIP_LINK,`Skipped due to ${qe(this.configuration,"mode=update-lockfile",Pe.CODE)}`);return}await this.linkEverything(e);let c=await Promise.all(s.map(async u=>Fm(u,{cwd:this.cwd})));for(let u=0;u<s.length;++u)o[u]!==c[u]&&e.report.reportError(z.FROZEN_ARTIFACT_EXCEPTION,`The checksum for ${s[u]} has been modified by this install, which is explicitly forbidden.`)}),await this.persistInstallStateFile(),await this.configuration.triggerHook(c=>c.afterAllInstalled,this,e)}generateLockfile(){let e=new Map;for(let[n,s]of this.storedResolutions.entries()){let o=e.get(s);o||e.set(s,o=new Set),o.add(n)}let r={};r.__metadata={version:Uk};for(let[n,s]of e.entries()){let o=this.originalPackages.get(n);if(!o)continue;let a=[];for(let f of s){let h=this.storedDescriptor
Line truncated
|
||||
`,`# Manual changes might be lost - proceed with caution!
|
||||
`].join("")}
|
||||
`+ro(r)}async persistLockfile(){let e=D.join(this.cwd,this.configuration.get("lockfileFilename")),r=this.generateLockfile();await L.changeFilePromise(e,r,{automaticNewlines:!0})}async persistInstallStateFile(){let e=[];for(let o of Object.values(Hk))e.push(...o);let r=(0,gy.default)(this,e),i=Ok.default.serialize(r),n=ai(i);if(this.installStateChecksum===n)return;let s=this.configuration.get("installStatePath");await L.mkdirPromise(D.dirname(s),{recursive:!0}),await L.writeFilePromise(s,await aPe(i)),this.installStateChecksum=n}async restoreInstallState({restoreInstallersCustomData:e=!0,restoreResolutions:r=!0,restoreBuildState:i=!0}={}){let n=this.configuration.get("installStatePath");if(!L.existsSync(n)){r&&await this.applyLightResolution();return}let s=await APe(await L.readFilePromise(n));this.installStateChecksum=ai(s);let o=Ok.default.deserialize(s);e&&typeof o.installersCustomData!="undefined"&&(this.installersCustomData=o.installersCustomData),i&&Object.assign(this,(0,gy.default)(o,Hk.restoreBuildState)),r&&(o.lockFileChecksum===this.lockFileChecksum?(Object.assign(this,(0,gy.default)(o,Hk.restoreResolutions)),this.refreshWorkspaceDependencies()):await this.applyLightResolution())}async applyLightResolution(){await this.resolveEverything({lockfileOnly:!0,report:new Br}),await this.persistInstallStateFile()}async persist(){await this.persistLockfile();for(let e of this.workspacesByCwd.values())await e.persistManifest()}async cacheCleanup({cache:e,report:r}){let i=new Set([".gitignore"]);if(!Gw(e.cwd,this.cwd)||!await L.existsPromise(e.cwd))return;let n=this.configuration.get("preferAggregateCacheInfo"),s=0,o=null;for(let a of await L.readdirPromise(e.cwd)){if(i.has(a))continue;let l=D.resolve(e.cwd,a);e.markedFiles.has(l)||(o=a,e.immutable?r.reportError(z.IMMUTABLE_CACHE,`${qe(this.configuration,D.basename(l),"magenta")} appears to be unused and would be marked for deletion, but the cache is immutable`):(n?s+=1:r.reportInfo(z.UNUSED_CACHE_ENTRY,`${qe(this.configuration,D.basename(l),"magenta")} appears to be unused - removing`),await L.removePromise(l)))}n&&s!==0&&r.reportInfo(z.UNUSED_CACHE_ENTRY,s>1?`${s} packages appeared to be unused and were removed`:`${o} appeared to be unused and was removed`),e.markedFiles.clear()}};function lPe({project:t,allDescriptors:e,allResolutions:r,allPackages:i,accessibleLocators:n=new Set,optionalBuilds:s=new Set,volatileDescriptors:o=new Set,peerRequirements:a=new Map,report:l,tolerateMissingPackages:c=!1}){var oe;let u=new Map,g=[],f=new Map,h=new Map,p=new Map,m=new Map,I=new Map,y=new Map(t.workspaces.map(K=>{let A=K.anchoredLocator.locatorHash,W=i.get(A);if(typeof W=="undefined"){if(c)return[A,null];throw new Error("Assertion failed: The workspace should have an associated package")}return[A,hf(W)]})),B=()=>{let K=L.mktempSync(),A=D.join(K,"stacktrace.log"),W=String(g.length+1).length,ee=g.map((re,H)=>`${`${H+1}.`.padStart(W," ")} ${gn(re)}
|
||||
`).join("");throw L.writeFileSync(A,ee),L.detachTemp(K),new _e(z.STACK_OVERFLOW_RESOLUTION,`Encountered a stack overflow when resolving peer dependencies; cf ${T.fromPortablePath(A)}`)},x=K=>{let A=r.get(K.descriptorHash);if(typeof A=="undefined")throw new Error("Assertion failed: The resolution should have been registered");let W=i.get(A);if(!W)throw new Error("Assertion failed: The package could not be found");return W},F=(K,A,{top:W,optional:ee})=>{g.length>1e3&&B(),g.push(K);let re=N(K,A,{top:W,optional:ee});return g.pop(),re},N=(K,A,{top:W,optional:ee})=>{if(n.has(K.locatorHash))return;n.add(K.locatorHash),ee||s.delete(K.locatorHash);let re=i.get(K.locatorHash);if(!re){if(c)return;throw new Error(`Assertion failed: The package (${nt(t.configuration,K)}) should have been registered`)}let H=[],R=[],ve=[],Ne=[],Je=[];for(let ie of Array.from(re.dependencies.values())){if(re.peerDependencies.has(ie.identHash)&&re.locatorHash!==W)continue;if(qo(ie))throw new Error("Assertion failed: Virtual packages shouldn't be encountered when virtualizing a branch");o.delete(ie.descriptorHash);let ce=ee;if(!ce){let ae=re.dependenciesMeta.get(dt(ie));if(typeof ae!="undefined"){let ue=ae.get(null);typeof ue!="undefined"&&ue.optional&&(ce=!0)}}let Se=r.get(ie.descriptorHash);if(!Se){if(c)continue;throw new Error(`Assertion failed: The resolution (${Ut(t.configuration,ie)}) should have been registered`)}let fe=y.get(Se)||i.get(Se);if(!fe)throw new Error(`Assertion failed: The package (${Se}, resolved from ${Ut(t.configuration,ie)}) should have been registered`);if(fe.peerDependencies.size===0){F(fe,new Map,{top:W,optional:ce});continue}let Ie=u.get(fe.locatorHash);typeof Ie=="number"&&Ie>=2&&B();let pe,Qe,Z=new Set,X;R.push(()=>{pe=nb(ie,K.locatorHash),Qe=sb(fe,K.locatorHash),re.dependencies.delete(ie.identHash),re.dependencies.set(pe.identHash,pe),r.set(pe.descriptorHash,Qe.locatorHash),e.set(pe.descriptorHash,pe),i.set(Qe.locatorHash,Qe),H.push([fe,pe,Qe])}),ve.push(()=>{var ae;X=new Map;for(let ue of Qe.peerDependencies.values()){let Be=re.dependencies.get(ue.identHash);if(!Be&&Cf(K,ue)&&(Be=Mm(K),e.set(Be.descriptorHash,Be),r.set(Be.descriptorHash,K.locatorHash),o.delete(Be.descriptorHash)),(!Be||Be.range==="missing:")&&Qe.dependencies.has(ue.identHash)){Qe.peerDependencies.delete(ue.identHash);continue}Be||(Be=zt(ue,"missing:")),Qe.dependencies.set(Be.identHash,Be),qo(Be)&&oA(p,Be.descriptorHash).add(Qe.locatorHash),f.set(Be.identHash,Be),Be.range==="missing:"&&Z.add(Be.identHash),X.set(ue.identHash,(ae=A.get(ue.identHash))!=null?ae:Qe.locatorHash)}Qe.dependencies=new Map(bi(Qe.dependencies,([ue,Be])=>dt(Be)))}),Ne.push(()=>{if(!i.has(Qe.locatorHash))return;let ae=u.get(fe.locatorHash),ue=typeof ae!="undefined"?ae+1:1;u.set(fe.locatorHash,ue),F(Qe,X,{top:W,optional:ce}),u.set(fe.locatorHash,ue-1)}),Je.push(()=>{let ae=re.dependencies.get(ie.identHash);if(typeof ae=="undefined")throw new Error("Assertion failed: Expected the peer dependency to have been turned into a dependency");let ue=r.get(ae.descriptorHash);if(typeof ue=="undefined")throw new Error("Assertion failed: Expected the descriptor to be registered");if(oA(I,ue).add(K.locatorHash),!!i.has(Qe.locatorHash)){for(let Be of Qe.peerDependencies.values()){let ct=X.get(Be.identHash);if(typeof ct=="undefined")throw new Error("Assertion failed: Expected the peer dependency ident to be registered");Yl(jl(m,ct),dt(Be)).push(Qe.locatorHash)}for(let Be of Z)Qe.dependencies.delete(Be)}})}for(let ie of[...R,...ve])ie();let Ke;do{Ke=!0;for(let[ie,ce,Se]of H){if(!i.has(Se.locatorHash))continue;let fe=jl(h,ie.locatorHash),Ie=ai(...[...Se.dependencies.values()].map(X=>{let ae=X.range!=="missing:"?r.get(X.descriptorHash):"missing:";if(typeof ae=="undefined")throw new Error(`Assertion failed: Expected the resolution for ${Ut(t.configuration,X)} to have been registered`);return ae===W?`${ae} (top)`:ae}),ce.identHash),pe=fe.get(Ie);if(typeof pe=="undefined"){fe.set(Ie,ce);continue}if(pe===ce)continue;Ke=!1,i.delete(Se.locatorHash),e.delete(ce.descriptorHash),r.delete(ce.descriptorHash),n.delete(Se.locatorHash);let Qe=p.get(ce.descriptorHash)||[],Z=[re.locatorHash,...Qe];p.delete(ce.descriptorHash);for(let X of Z){let ae=i.get(X);typeof ae!="undefined"&&ae.dependencies.set(ce.identHash,pe)}}}while(!Ke);for(let ie of[...Ne,...Je])ie()};for(let K of t.workspaces){let A=K.anchoredLocator;o.delete(K.anchoredDescriptor.descriptorHash),F(A,new Map,{top:A.locatorHash,optional:!1})}var O;(function(W){W[W.NotProvided=0]="NotProvided",W[W.NotCompatible=1]="NotCompatible"})(O||(O={}));let P=[];for(let[K,A]of I){let W=i.get(K);if(typeof W=="undefined")throw new Error("Assertion failed: Expected the root to be registered");let ee=m.get(K);if(typeof ee!="undefined")for(let re of A){let H=i.get(re);if(typeof H!="undefined")for(let[R,ve]of ee){let Ne=Si(R);if(H.peerDependencies.has(Ne.identHash))continue;let Je=`p${ai(re,R,K).slice(0,5)}`;a.set(Je,{subject:re,requested:Ne,rootRequester:K,allReques
Line truncated
|
||||
`),(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout,includeLogs:!this.context.quiet},async I=>{await r.install({cache:n,report:I,mode:this.mode})})).exitCode()}};hp.paths=[["add"]],hp.usage=he.Usage({description:"add dependencies to the project",details:"\n This command adds a package to the package.json for the nearest workspace.\n\n - If it didn't exist before, the package will by default be added to the regular `dependencies` field, but this behavior can be overriden thanks to the `-D,--dev` flag (which will cause the dependency to be added to the `devDependencies` field instead) and the `-P,--peer` flag (which will do the same but for `peerDependencies`).\n\n - If the package was already listed in your dependencies, it will by default be upgraded whether it's part of your `dependencies` or `devDependencies` (it won't ever update `peerDependencies`, though).\n\n - If set, the `--prefer-dev` flag will operate as a more flexible `-D,--dev` in that it will add the package to your `devDependencies` if it isn't already listed in either `dependencies` or `devDependencies`, but it will also happily upgrade your `dependencies` if that's what you already use (whereas `-D,--dev` would throw an exception).\n\n - If set, the `-O,--optional` flag will add the package to the `optionalDependencies` field and, in combination with the `-P,--peer` flag, it will add the package as an optional peer dependency. If the package was already listed in your `dependencies`, it will be upgraded to `optionalDependencies`. If the package was already listed in your `peerDependencies`, in combination with the `-P,--peer` flag, it will be upgraded to an optional peer dependency: `\"peerDependenciesMeta\": { \"<package>\": { \"optional\": true } }`\n\n - If the added package doesn't specify a range at all its `latest` tag will be resolved and the returned version will be used to generate a new semver range (using the `^` modifier by default unless otherwise configured via the `defaultSemverRangePrefix` configuration, or the `~` modifier if `-T,--tilde` is specified, or no modifier at all if `-E,--exact` is specified). Two exceptions to this rule: the first one is that if the package is a workspace then its local version will be used, and the second one is that if you use `-P,--peer` the default range will be `*` and won't be resolved at all.\n\n - If the added package specifies a range (such as `^1.0.0`, `latest`, or `rc`), Yarn will add this range as-is in the resulting package.json entry (in particular, tags such as `rc` will be encoded as-is rather than being converted into a semver range).\n\n If the `--cached` option is used, Yarn will preferably reuse the highest version already used somewhere within the project, even if through a transitive dependency.\n\n If the `-i,--interactive` option is used (or if the `preferInteractive` settings is toggled on) the command will first try to check whether other workspaces in the project use the specified package and, if so, will offer to reuse them.\n\n If the `--mode=<mode>` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n For a compilation of all the supported protocols, please consult the dedicated page from our website: https://yarnpkg.com/features/protocols.\n ",examples:[["Add a regular package to the current workspace","$0 add lodash"],["Add a specific version for a package to the current workspace","$0 add [email protected]"],["Add a package from a GitHub repository (the master branch) to the current workspace using a URL","$0 add lodash@https://github.com/lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol","$0 add lodash@github:lodash/lodash"],["Add a package from a GitHub repository (the master branch) to the current workspace using the GitHub protocol (shorthand)","$0 add lodash@lodash/lodash"],["Add a package from a specific branch of a GitHub repository to the current workspace using the GitHub protocol (shorthand)","$0 add lodash-es@lodash/lodash#es"]]});var k$=hp;function TKe(t,e,{dev:r,peer:i,preferDev:n,optional:s}){let o=t.manifest[er.REGULAR].has(e.identHash),a=t.manifest[er.DEVELOPMENT].has(e.identHash),l=t.manifest[er.PEER].has(e.iLine truncated
|
||||
`),0}return(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async s=>{let o=await Qt.getPackageAccessibleBinaries(i,{project:r}),l=Array.from(o.keys()).reduce((c,u)=>Math.max(c,u.length),0);for(let[c,[u,g]]of o)s.reportJson({name:c,source:w.stringifyIdent(u),path:g});if(this.verbose)for(let[c,[u]]of o)s.reportInfo(null,`${c.padEnd(l," ")} ${w.prettyLocator(e,u)}`);else for(let c of o.keys())s.reportInfo(null,c)})).exitCode()}};pp.paths=[["bin"]],pp.usage=he.Usage({description:"get the path to a binary script",details:`
|
||||
When used without arguments, this command will print the list of all the binaries available in the current workspace. Adding the \`-v,--verbose\` flag will cause the output to contain both the binary name and the locator of the package that provides the binary.
|
||||
|
||||
When an argument is specified, this command will just print the path to the binary on the standard output and exit. Note that the reported path may be stored within a zip archive.
|
||||
`,examples:[["List all the available binaries","$0 bin"],["Print the path to a specific binary","$0 bin eslint"]]});var v$=pp;var dp=class extends ye{constructor(){super(...arguments);this.mirror=j.Boolean("--mirror",!1,{description:"Remove the global cache files instead of the local cache files"});this.all=j.Boolean("--all",!1,{description:"Remove both the global cache files and the local cache files of the current project"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=await ft.find(e);return(await xe.start({configuration:e,stdout:this.context.stdout},async()=>{let n=(this.all||this.mirror)&&r.mirrorCwd!==null,s=!this.mirror;n&&(await L.removePromise(r.mirrorCwd),await e.triggerHook(o=>o.cleanGlobalArtifacts,e)),s&&await L.removePromise(r.cwd)})).exitCode()}};dp.paths=[["cache","clean"],["cache","clear"]],dp.usage=he.Usage({description:"remove the shared cache files",details:`
|
||||
This command will remove all the files from the cache.
|
||||
`,examples:[["Remove all the local archives","$0 cache clean"],["Remove all the archives stored in the ~/.yarn directory","$0 cache clean --mirror"]]});var P$=dp;var F$=te(by()),hP=te(require("util")),Cp=class extends ye{constructor(){super(...arguments);this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.unsafe=j.Boolean("--no-redacted",!1,{description:"Don't redact secrets (such as tokens) from the output"});this.name=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=this.name.replace(/[.[].*$/,""),i=this.name.replace(/^[^.[]*/,"");if(typeof e.settings.get(r)=="undefined")throw new me(`Couldn't find a configuration settings named "${r}"`);let s=e.getSpecial(r,{hideSecrets:!this.unsafe,getNativePaths:!0}),o=de.convertMapsToIndexableObjects(s),a=i?(0,F$.default)(o,i):o,l=await xe.start({configuration:e,includeFooter:!1,json:this.json,stdout:this.context.stdout},async c=>{c.reportJson(a)});if(!this.json){if(typeof a=="string")return this.context.stdout.write(`${a}
|
||||
`),l.exitCode();hP.inspect.styles.name="cyan",this.context.stdout.write(`${(0,hP.inspect)(a,{depth:Infinity,colors:e.get("enableColors"),compact:!1})}
|
||||
`)}return l.exitCode()}};Cp.paths=[["config","get"]],Cp.usage=he.Usage({description:"read a configuration settings",details:`
|
||||
This command will print a configuration setting.
|
||||
|
||||
Secrets (such as tokens) will be redacted from the output by default. If this behavior isn't desired, set the \`--no-redacted\` to get the untransformed value.
|
||||
`,examples:[["Print a simple configuration setting","yarn config get yarnPath"],["Print a complex configuration setting","yarn config get packageExtensions"],["Print a nested field from the configuration",`yarn config get 'npmScopes["my-company"].npmRegistryServer'`],["Print a token from the configuration","yarn config get npmAuthToken --no-redacted"],["Print a configuration setting as JSON","yarn config get packageExtensions --json"]]});var R$=Cp;var qee=te(EP()),Jee=te(by()),Wee=te(Gee()),yP=te(require("util")),Ip=class extends ye{constructor(){super(...arguments);this.json=j.Boolean("--json",!1,{description:"Set complex configuration settings to JSON values"});this.home=j.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=j.String();this.value=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=()=>{if(!e.projectCwd)throw new me("This command must be run from within a project folder");return e.projectCwd},i=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof e.settings.get(i)=="undefined")throw new me(`Couldn't find a configuration settings named "${i}"`);let o=this.json?JSON.parse(this.value):this.value;await(this.home?h=>le.updateHomeConfiguration(h):h=>le.updateConfiguration(r(),h))(h=>{if(n){let p=(0,qee.default)(h);return(0,Wee.default)(p,this.name,o),p}else return V(v({},h),{[i]:o})});let c=(await le.find(this.context.cwd,this.context.plugins)).getSpecial(i,{hideSecrets:!0,getNativePaths:!0}),u=de.convertMapsToIndexableObjects(c),g=n?(0,Jee.default)(u,n):u;return(await xe.start({configuration:e,includeFooter:!1,stdout:this.context.stdout},async h=>{yP.inspect.styles.name="cyan",h.reportInfo(z.UNNAMED,`Successfully set ${this.name} to ${(0,yP.inspect)(g,{depth:Infinity,colors:e.get("enableColors"),compact:!1})}`)})).exitCode()}};Ip.paths=[["config","set"]],Ip.usage=he.Usage({description:"change a configuration settings",details:`
|
||||
This command will set a configuration setting.
|
||||
|
||||
When used without the \`--json\` flag, it can only set a simple configuration setting (a string, a number, or a boolean).
|
||||
|
||||
When used with the \`--json\` flag, it can set both simple and complex configuration settings, including Arrays and Objects.
|
||||
`,examples:[["Set a simple configuration setting (a string, a number, or a boolean)","yarn config set initScope myScope"],["Set a simple configuration setting (a string, a number, or a boolean) using the `--json` flag",'yarn config set initScope --json \\"myScope\\"'],["Set a complex configuration setting (an Array) using the `--json` flag",`yarn config set unsafeHttpWhitelist --json '["*.example.com", "example.com"]'`],["Set a complex configuration setting (an Object) using the `--json` flag",`yarn config set packageExtensions --json '{ "@babel/parser@*": { "dependencies": { "@babel/types": "*" } } }'`],["Set a nested configuration setting",'yarn config set npmScopes.company.npmRegistryServer "https://npm.example.com"'],["Set a nested configuration setting using indexed access for non-simple keys",`yarn config set 'npmRegistries["//npm.example.com"].npmAuthToken' "ffffffff-ffff-ffff-ffff-ffffffffffff"`]]});var zee=Ip;var ite=te(EP()),nte=te(Kh()),ste=te(rte()),Ep=class extends ye{constructor(){super(...arguments);this.home=j.Boolean("-H,--home",!1,{description:"Update the home configuration instead of the project configuration"});this.name=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=()=>{if(!e.projectCwd)throw new me("This command must be run from within a project folder");return e.projectCwd},i=this.name.replace(/[.[].*$/,""),n=this.name.replace(/^[^.[]*\.?/,"");if(typeof e.settings.get(i)=="undefined")throw new me(`Couldn't find a configuration settings named "${i}"`);let o=this.home?l=>le.updateHomeConfiguration(l):l=>le.updateConfiguration(r(),l);return(await xe.start({configuration:e,includeFooter:!1,stdout:this.context.stdout},async l=>{let c=!1;await o(u=>{if(!(0,nte.default)(u,this.name))return l.reportWarning(z.UNNAMED,`Configuration doesn't contain setting ${this.name}; there is nothing to unset`),c=!0,u;let g=n?(0,ite.default)(u):v({},u);return(0,ste.default)(g,this.name),g}),c||l.reportInfo(z.UNNAMED,`Successfully unset ${this.name}`)})).exitCode()}};Ep.paths=[["config","unset"]],Ep.usage=he.Usage({description:"unset a configuration setting",details:`
|
||||
This command will unset a configuration setting.
|
||||
`,examples:[["Unset a simple configuration setting","yarn config unset initScope"],["Unset a complex configuration setting","yarn config unset packageExtensions"],["Unset a nested configuration setting","yarn config unset npmScopes.company.npmRegistryServer"]]});var ote=Ep;var BP=te(require("util")),yp=class extends ye{constructor(){super(...arguments);this.verbose=j.Boolean("-v,--verbose",!1,{description:"Print the setting description on top of the regular key/value information"});this.why=j.Boolean("--why",!1,{description:"Print the reason why a setting is set a particular way"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins,{strict:!1});return(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async i=>{if(e.invalid.size>0&&!this.json){for(let[n,s]of e.invalid)i.reportError(z.INVALID_CONFIGURATION_KEY,`Invalid configuration key "${n}" in ${s}`);i.reportSeparator()}if(this.json){let n=de.sortMap(e.settings.keys(),s=>s);for(let s of n){let o=e.settings.get(s),a=e.getSpecial(s,{hideSecrets:!0,getNativePaths:!0}),l=e.sources.get(s);this.verbose?i.reportJson({key:s,effective:a,source:l}):i.reportJson(v({key:s,effective:a,source:l},o))}}else{let n=de.sortMap(e.settings.keys(),a=>a),s=n.reduce((a,l)=>Math.max(a,l.length),0),o={breakLength:Infinity,colors:e.get("enableColors"),maxArrayLength:2};if(this.why||this.verbose){let a=n.map(c=>{let u=e.settings.get(c);if(!u)throw new Error(`Assertion failed: This settings ("${c}") should have been registered`);let g=this.why?e.sources.get(c)||"<default>":u.description;return[c,g]}),l=a.reduce((c,[,u])=>Math.max(c,u.length),0);for(let[c,u]of a)i.reportInfo(null,`${c.padEnd(s," ")} ${u.padEnd(l," ")} ${(0,BP.inspect)(e.getSpecial(c,{hideSecrets:!0,getNativePaths:!0}),o)}`)}else for(let a of n)i.reportInfo(null,`${a.padEnd(s," ")} ${(0,BP.inspect)(e.getSpecial(a,{hideSecrets:!0,getNativePaths:!0}),o)}`)}})).exitCode()}};yp.paths=[["config"]],yp.usage=he.Usage({description:"display the current configuration",details:`
|
||||
This command prints the current active configuration settings.
|
||||
`,examples:[["Print the active configuration settings","$0 config"]]});var ate=yp;Pn();var wP={};et(wP,{Strategy:()=>cl,acceptedStrategies:()=>U2e,dedupe:()=>QP});var Ate=te(Yi()),cl;(function(e){e.HIGHEST="highest"})(cl||(cl={}));var U2e=new Set(Object.values(cl)),H2e={highest:async(t,e,{resolver:r,fetcher:i,resolveOptions:n,fetchOptions:s})=>{let o=new Map;for(let[a,l]of t.storedResolutions){let c=t.storedDescriptors.get(a);if(typeof c=="undefined")throw new Error(`Assertion failed: The descriptor (${a}) should have been registered`);de.getSetWithDefault(o,c.identHash).add(l)}return Array.from(t.storedDescriptors.values(),async a=>{if(e.length&&!Ate.default.isMatch(w.stringifyIdent(a),e))return null;let l=t.storedResolutions.get(a.descriptorHash);if(typeof l=="undefined")throw new Error(`Assertion failed: The resolution (${a.descriptorHash}) should have been registered`);let c=t.originalPackages.get(l);if(typeof c=="undefined"||!r.shouldPersistResolution(c,n))return null;let u=o.get(a.identHash);if(typeof u=="undefined")throw new Error(`Assertion failed: The resolutions (${a.identHash}) should have been registered`);if(u.size===1)return null;let g=[...u].map(I=>{let y=t.originalPackages.get(I);if(typeof y=="undefined")throw new Error(`Assertion failed: The package (${I}) should have been registered`);return y.reference}),f=await r.getSatisfying(a,g,n),h=f==null?void 0:f[0];if(typeof h=="undefined")return null;let p=h.locatorHash,m=t.originalPackages.get(p);if(typeof m=="undefined")throw new Error(`Assertion failed: The package (${p}) should have been registered`);return p===l?null:{descriptor:a,currentPackage:c,updatedPackage:m}})}};async function QP(t,{strategy:e,patterns:r,cache:i,report:n}){let{configuration:s}=t,o=new Br,a=s.makeResolver(),l=s.makeFetcher(),c={cache:i,checksums:t.storedChecksums,fetcher:l,project:t,report:o,skipIntegrityCheck:!0},u={project:t,resolver:a,report:o,fetchOptions:c};return await n.startTimerPromise("Deduplication step",async()=>{let f=await H2e[e](t,r,{resolver:a,resolveOptions:u,fetcher:l,fetchOptions:c}),h=ci.progressViaCounter(f.length);n.reportProgress(h);let p=0;await Promise.all(f.map(y=>y.then(B=>{if(B===null)return;p++;let{descriptor:x,currentPackage:F,updatedPackage:N}=B;n.reportInfo(z.UNNAMED,`${w.prettyDescriptor(s,x)} can be deduped from ${w.prettyLocator(s,F)} to ${w.prettyLocator(s,N)}`),n.reportJson({descriptor:w.stringifyDescriptor(x),currentResolution:w.stringifyLocator(F),updatedResolution:w.stringifyLocator(N)}),t.storedResolutions.set(x.descriptorHash,N.locatorHash)}).finally(()=>h.tick())));let m;switch(p){case 0:m="No packages";break;case 1:m="One package";break;default:m=`${p} packages`}let I=Ae.pretty(s,e,Ae.Type.CODE);return n.reportInfo(z.UNNAMED,`${m} can be deduped using the ${I} strategy`),p})}var Bp=class extends ye{constructor(){super(...arguments);this.strategy=j.String("-s,--strategy",cl.HIGHEST,{description:"The strategy to use when deduping dependencies",validator:ni(cl)});this.check=j.Boolean("-c,--check",!1,{description:"Exit with exit code 1 when duplicates are found, without persisting the dependency tree"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.mode=j.String("--mode",{description:"Change what artifacts installs generate",validator:ni(kr)});this.patterns=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd),i=await ft.find(e);await r.restoreInstallState({restoreResolutions:!1});let n=0,s=await xe.start({configuration:e,includeFooter:!1,stdout:this.context.stdout,json:this.json},async o=>{n=await QP(r,{strategy:this.strategy,patterns:this.patterns,cache:i,report:o})});return s.hasErrors()?s.exitCode():this.check?n?1:0:(await xe.start({configuration:e,stdout:this.context.stdout,json:this.json},async a=>{await r.install({cache:i,report:a,mode:this.mode})})).exitCode()}};Bp.paths=[["dedupe"]],Bp.usage=he.Usage({description:"deduplicate dependencies with overlapping ranges",details:"\n Duplicates are defined as descriptors with overlapping ranges being resolved and locked to different locators. They are a natural consequence of Yarn's deterministic installs, but they can sometimes pile up and unnecessarily increase the size of your project.\n\n This command dedupes dependencies in the current project using different strategies (only one is implemented at the moment):\n\n - `highest`: Reuses (where possible) the locators with the highest versions. This means that dependencies can only be upgraded, never downgraded. It's also guaranteed that it never takes more than a single pass to dedupe the entire dependency tree.\n\n **Note:** Even though it never produces a wrong dependency tree, this command should be used with caution, as it modifies the dependency tree, which can sometimes cause problems when packages don't strictly follow semver recommendations. Because of this, it is recommended
Line truncated
|
||||
`)}};eB.paths=[["--clipanion=definitions"]];var gte=eB;var tB=class extends he{async execute(){this.context.stdout.write(this.cli.usage(null))}};tB.paths=[["help"],["--help"],["-h"]];var fte=tB;var bP=class extends he{constructor(){super(...arguments);this.leadingArgument=j.String();this.args=j.Proxy()}async execute(){if(this.leadingArgument.match(/[\\/]/)&&!w.tryParseIdent(this.leadingArgument)){let e=D.resolve(this.context.cwd,T.toPortablePath(this.leadingArgument));return await this.cli.run(this.args,{cwd:e})}else return await this.cli.run(["run",this.leadingArgument,...this.args])}},hte=bP;var rB=class extends he{async execute(){this.context.stdout.write(`${Er||"<unknown>"}
|
||||
`)}};rB.paths=[["-v"],["--version"]];var pte=rB;var wp=class extends ye{constructor(){super(...arguments);this.commandName=j.String();this.args=j.Proxy()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,locator:i}=await Fe.find(e,this.context.cwd);return await L.mktempPromise(async n=>await xc(this.commandName,this.args,{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,env:await Qt.makeScriptEnv({project:r,locator:i,binFolder:n})}))}};wp.paths=[["exec"]],wp.usage=he.Usage({description:"execute a shell script",details:`
|
||||
This command simply executes a shell script within the context of the root directory of the active workspace using the portable shell.
|
||||
|
||||
It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
|
||||
`,examples:[["Execute a single shell command","$0 exec echo Hello World"],["Execute a shell script",'$0 exec "tsc & babel src --out-dir lib"']]});var dte=wp;Pn();var Qp=class extends ye{constructor(){super(...arguments);this.hash=j.String({required:!1,validator:QQ(wQ(),[bQ(/^p[0-9a-f]{5}$/)])})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd);return await r.restoreInstallState({restoreResolutions:!1}),await r.applyLightResolution(),typeof this.hash!="undefined"?await Y2e(this.hash,r,{stdout:this.context.stdout}):(await xe.start({configuration:e,stdout:this.context.stdout,includeFooter:!1},async n=>{var o;let s=[([,a])=>w.stringifyLocator(r.storedPackages.get(a.subject)),([,a])=>w.stringifyIdent(a.requested)];for(let[a,l]of de.sortMap(r.peerRequirements,s)){let c=r.storedPackages.get(l.subject);if(typeof c=="undefined")throw new Error("Assertion failed: Expected the subject package to have been registered");let u=r.storedPackages.get(l.rootRequester);if(typeof u=="undefined")throw new Error("Assertion failed: Expected the root package to have been registered");let g=(o=c.dependencies.get(l.requested.identHash))!=null?o:null,f=Ae.pretty(e,a,Ae.Type.CODE),h=w.prettyLocator(e,c),p=w.prettyIdent(e,l.requested),m=w.prettyIdent(e,u),I=l.allRequesters.length-1,y=`descendant${I===1?"":"s"}`,B=I>0?` and ${I} ${y}`:"",x=g!==null?"provides":"doesn't provide";n.reportInfo(null,`${f} \u2192 ${h} ${x} ${p} to ${m}${B}`)}})).exitCode()}};Qp.paths=[["explain","peer-requirements"]],Qp.usage=he.Usage({description:"explain a set of peer requirements",details:`
|
||||
A set of peer requirements represents all peer requirements that a dependent must satisfy when providing a given peer request to a requester and its descendants.
|
||||
|
||||
When the hash argument is specified, this command prints a detailed explanation of all requirements of the set corresponding to the hash and whether they're satisfied or not.
|
||||
|
||||
When used without arguments, this command lists all sets of peer requirements and the corresponding hash that can be used to get detailed information about a given set.
|
||||
|
||||
**Note:** A hash is a six-letter p-prefixed code that can be obtained from peer dependency warnings or from the list of all peer requirements (\`yarn explain peer-requirements\`).
|
||||
`,examples:[["Explain the corresponding set of peer requirements for a hash","$0 explain peer-requirements p1a4ed"],["List all sets of peer requirements","$0 explain peer-requirements"]]});var Cte=Qp;async function Y2e(t,e,r){let{configuration:i}=e,n=e.peerRequirements.get(t);if(typeof n=="undefined")throw new Error(`No peerDependency requirements found for hash: "${t}"`);return(await xe.start({configuration:i,stdout:r.stdout,includeFooter:!1},async o=>{var y,B;let a=e.storedPackages.get(n.subject);if(typeof a=="undefined")throw new Error("Assertion failed: Expected the subject package to have been registered");let l=e.storedPackages.get(n.rootRequester);if(typeof l=="undefined")throw new Error("Assertion failed: Expected the root package to have been registered");let c=(y=a.dependencies.get(n.requested.identHash))!=null?y:null,u=c!==null?e.storedResolutions.get(c.descriptorHash):null;if(typeof u=="undefined")throw new Error("Assertion failed: Expected the resolution to have been registered");let g=u!==null?e.storedPackages.get(u):null;if(typeof g=="undefined")throw new Error("Assertion failed: Expected the provided package to have been registered");let f=[...n.allRequesters.values()].map(x=>{let F=e.storedPackages.get(x);if(typeof F=="undefined")throw new Error("Assertion failed: Expected the package to be registered");let N=w.devirtualizeLocator(F),O=e.storedPackages.get(N.locatorHash);if(typeof O=="undefined")throw new Error("Assertion failed: Expected the package to be registered");let P=O.peerDependencies.get(n.requested.identHash);if(typeof P=="undefined")throw new Error("Assertion failed: Expected the peer dependency to be registered");return{pkg:F,peerDependency:P}});if(g!==null){let x=f.every(({peerDependency:F})=>vt.satisfiesWithPrereleases(g.version,F.range));o.reportInfo(z.UNNAMED,`${w.prettyLocator(i,a)} provides ${w.prettyLocator(i,g)} with version ${w.prettyReference(i,(B=g.version)!=null?B:"<missing>")}, which ${x?"satisfies":"doesn't satisfy"} the following requirements:`)}else o.reportInfo(z.UNNAMED,`${w.prettyLocator(i,a)} doesn't provide ${w.prettyIdent(i,n.requested)}, breaking the following requirements:`);o.reportSeparator();let h=Ae.mark(i),p=[];for(let{pkg:x,peerDependency:F}of de.sortMap(f,N=>w.stringifyLocator(N.pkg))){let O=(g!==null?vt.satisfiesWithPrereleases(g.version,F.range):!1)?h.Check:h.Cross;p.push({stringifiedLocator:w.stringifyLocator(x),prettyLocator:w.prettyLocator(i,x),prettyRange:w.prettyRange(i,F.range),mark:O})}let m=Math.max(...p.map(({stringifiedLocator:x})=>x.length)),I=Math.max(...p.map(({prettyRange:x})=>x.length));for(let{stringifiedLocator:x,prettyLocator:F,prettyRange:N,mark:O}of de.sortMap(p,({stringifiedLocator:P})=>P))o.reportInfo(null,`${F.padEnd(m+(F.length-x.length)," ")} \u2192 ${N.padEnd(I," ")} ${O}`);p.length>1&&(o.reportSeparator(),o.reportInfo(z.UNNAMED,`Note: these requirements start with ${w.prettyLocator(e.configuration,l)}`))})).exitCode()}var mte=te(Yi()),bp=class extends ye{constructor(){super(...arguments);this.all=j.Boolean("-A,--all",!1,{description:"Print versions of a package from the whole project"});this.recursive=j.Boolean("-R,--recursive",!1,{description:"Print information for all packages, including transitive dependencies"});this.extra=j.Array("-X,--extra",[],{description:"An array of requests of extra data provided by plugins"});this.cache=j.Boolean("--cache",!1,{description:"Print information about the cache entry of a package (path, size, checksum)"});this.dependents=j.Boolean("--dependents",!1,{description:"Print all dependents for each matching package"});this.manifest=j.Boolean("--manifest",!1,{description:"Print data obtained by looking at the package archive (license, homepage, ...)"});this.nameOnly=j.Boolean("--name-only",!1,{description:"Only print the name for the matching packages"});this.virtuals=j.Boolean("--virtuals",!1,{description:"Print each instance of the virtual packages"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.patterns=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i&&!this.all)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState();let s=new Set(this.extra);this.cache&&s.add("cache"),this.dependents&&s.add("dependents"),this.manifest&&s.add("manifest");let o=(x,{recursive:F})=>{let N=x.anchoredLocator.locatorHash,O=new Map,P=[N];for(;P.length>0;){let J=P.shift();if(O.has(J))continue;let oe=r.storedPackages.get(J);if(typeof oe=="undefined")throw new Error("Assertion failed: Expected the package to be registered");if(O.set(J,oe),w.isVirtualLocator(oe)&&P.push(w.devirtualizeLocator(oe).locatorHash),!(!F&&J!==N))for(let K of oe.dependencies.values()){let A=r.storedResolutions.get(K.descriptorHash);if(typeof A=="undefined")throw new Error("Assertion failed: Expected the resolution to be registered");P.push(A)}}return O.values
Line truncated
|
||||
This command setup your project if needed. The installation is splitted in four different steps that each have their own characteristics:
|
||||
|
||||
- **Resolution:** First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).
|
||||
|
||||
- **Fetch:** Then we download all the dependencies if needed, and make sure that they're all stored within our cache (check the value of \`cacheFolder\` in \`yarn config\` to see where are stored the cache files).
|
||||
|
||||
- **Link:** Then we send the dependency tree information to internal plugins tasked from writing them on the disk in some form (for example by generating the .pnp.cjs file you might know).
|
||||
|
||||
- **Build:** Once the dependency tree has been written on the disk, the package manager will now be free to run the build scripts for all packages that might need it, in a topological order compatible with the way they depend on one another.
|
||||
|
||||
Note that running this command is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
|
||||
|
||||
If the \`--immutable\` option is set (defaults to true on CI), Yarn will abort with an error exit code if the lockfile was to be modified (other paths can be added using the \`immutablePatterns\` configuration setting). For backward compatibility we offer an alias under the name of \`--frozen-lockfile\`, but it will be removed in a later release.
|
||||
|
||||
If the \`--immutable-cache\` option is set, Yarn will abort with an error exit code if the cache folder was to be modified (either because files would be added, or because they'd be removed).
|
||||
|
||||
If the \`--check-cache\` option is set, Yarn will always refetch the packages and will ensure that their checksum matches what's 1/ described in the lockfile 2/ inside the existing cache files (if present). This is recommended as part of your CI workflow if you're both following the Zero-Installs model and accepting PRs from third-parties, as they'd otherwise have the ability to alter the checked-in packages before submitting them.
|
||||
|
||||
If the \`--inline-builds\` option is set, Yarn will verbosely print the output of the build steps of your dependencies (instead of writing them into individual files). This is likely useful mostly for debug purposes only when using Docker-like environments.
|
||||
|
||||
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
||||
|
||||
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
|
||||
|
||||
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
|
||||
`,examples:[["Install the project","$0 install"],["Validate a project when using Zero-Installs","$0 install --immutable --immutable-cache"],["Validate a project when using Zero-Installs (slightly safer if you accept external PRs)","$0 install --immutable --immutable-cache --check-cache"]]});var Ete=Dp,G2e="|||||||",q2e=">>>>>>>",J2e="=======",yte="<<<<<<<";async function j2e(t,e){if(!t.projectCwd)return!1;let r=D.join(t.projectCwd,t.get("lockfileFilename"));if(!await L.existsPromise(r))return!1;let i=await L.readFilePromise(r,"utf8");if(!i.includes(yte))return!1;if(e)throw new _e(z.AUTOMERGE_IMMUTABLE,"Cannot autofix a lockfile when running an immutable install");let[n,s]=W2e(i),o,a;try{o=Kr(n),a=Kr(s)}catch(c){throw new _e(z.AUTOMERGE_FAILED_TO_PARSE,"The individual variants of the lockfile failed to parse")}let l=v(v({},o),a);for(let[c,u]of Object.entries(l))typeof u=="string"&&delete l[c];return await L.changeFilePromise(r,ro(l),{automaticNewlines:!0}),!0}function W2e(t){let e=[[],[]],r=t.split(/\r?\n/g),i=!1;for(;r.length>0;){let n=r.shift();if(typeof n=="undefined")throw new Error("Assertion failed: Some lines should remain");if(n.startsWith(yte)){for(;r.length>0;){let s=r.shift();if(typeof s=="undefined")throw new Error("Assertion failed: Some lines should remain");if(s===J2e){i=!1;break}else if(i||s.startsWith(G2e)){i=!0;continue}else e[0].push(s)}for(;r.length>0;){let s=r.shift();if(typeof s=="undefined")throw new Error("Assertion failed: Some lines should remain");if(s.startsWith(q2e))break;e[1].push(s)}}else e[0].push(n),e[1].push(n)}return[e[0].join(`
|
||||
`),e[1].join(`
|
||||
`)]}var Sp=class extends ye{constructor(){super(...arguments);this.all=j.Boolean("-A,--all",!1,{description:"Link all workspaces belonging to the target project to the current one"});this.private=j.Boolean("-p,--private",!1,{description:"Also link private workspaces belonging to the target project to the current one"});this.relative=j.Boolean("-r,--relative",!1,{description:"Link workspaces using relative paths instead of absolute paths"});this.destination=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState({restoreResolutions:!1});let s=D.resolve(this.context.cwd,T.toPortablePath(this.destination)),o=await le.find(s,this.context.plugins,{useRc:!1,strict:!1}),{project:a,workspace:l}=await Fe.find(o,s);if(r.cwd===a.cwd)throw new me("Invalid destination; Can't link the project to itself");if(!l)throw new Ze(a.cwd,s);let c=r.topLevelWorkspace,u=[];if(this.all){for(let f of a.workspaces)f.manifest.name&&(!f.manifest.private||this.private)&&u.push(f);if(u.length===0)throw new me("No workspace found to be linked in the target project")}else{if(!l.manifest.name)throw new me("The target workspace doesn't have a name and thus cannot be linked");if(l.manifest.private&&!this.private)throw new me("The target workspace is marked private - use the --private flag to link it anyway");u.push(l)}for(let f of u){let h=w.stringifyIdent(f.locator),p=this.relative?D.relative(r.cwd,f.cwd):f.cwd;c.manifest.resolutions.push({pattern:{descriptor:{fullName:h}},reference:`portal:${p}`})}return(await xe.start({configuration:e,stdout:this.context.stdout},async f=>{await r.install({cache:n,report:f})})).exitCode()}};Sp.paths=[["link"]],Sp.usage=he.Usage({description:"connect the local project to another one",details:"\n This command will set a new `resolutions` field in the project-level manifest and point it to the workspace at the specified location (even if part of another project).\n ",examples:[["Register a remote workspace for use in the current project","$0 link ~/ts-loader"],["Register all workspaces from a remote project for use in the current project","$0 link ~/jest --all"]]});var Bte=Sp;var xp=class extends ye{constructor(){super(...arguments);this.args=j.Proxy()}async execute(){return this.cli.run(["exec","node",...this.args])}};xp.paths=[["node"]],xp.usage=he.Usage({description:"run node with the hook already setup",details:`
|
||||
This command simply runs Node. It also makes sure to call it in a way that's compatible with the current project (for example, on PnP projects the environment will be setup in such a way that PnP will be correctly injected into the environment).
|
||||
|
||||
The Node process will use the exact same version of Node as the one used to run Yarn itself, which might be a good way to ensure that your commands always use a consistent Node version.
|
||||
`,examples:[["Run a Node script","$0 node ./my-script.js"]]});var wte=xp;var Lte=te(require("os"));var xte=te(require("os"));var z2e="https://raw.githubusercontent.com/yarnpkg/berry/master/plugins.yml";async function ul(t){let e=await Rt.get(z2e,{configuration:t});return Kr(e.toString())}var kp=class extends ye{constructor(){super(...arguments);this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins);return(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async i=>{let n=await ul(e);for(let s of Object.entries(n)){let[l,o]=s,a=o,{experimental:c}=a,u=Rr(a,["experimental"]);let g=l;c&&(g+=" [experimental]"),i.reportJson(v({name:l,experimental:c},u)),i.reportInfo(null,g)}})).exitCode()}};kp.paths=[["plugin","list"]],kp.usage=he.Usage({category:"Plugin-related commands",description:"list the available official plugins",details:"\n This command prints the plugins available directly from the Yarn repository. Only those plugins can be referenced by name in `yarn plugin import`.\n ",examples:[["List the official plugins","$0 plugin list"]]});var Qte=kp;var bte=te(cr()),vp=class extends ye{constructor(){super(...arguments);this.onlyIfNeeded=j.Boolean("--only-if-needed",!1,{description:"Only lock the Yarn version if it isn't already locked"});this.version=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins);if(e.get("yarnPath")&&this.onlyIfNeeded)return 0;let r=()=>{if(typeof Er=="undefined")throw new me("The --install flag can only be used without explicit version specifier from the Yarn CLI");return`file://${process.argv[1]}`},i;if(this.version==="self")i=r();else if(this.version==="latest"||this.version==="berry"||this.version==="stable")i=`https://repo.yarnpkg.com/${await Dte(e,"stable")}/packages/yarnpkg-cli/bin/yarn.js`;else if(this.version==="canary")i=`https://repo.yarnpkg.com/${await Dte(e,"canary")}/packages/yarnpkg-cli/bin/yarn.js`;else if(this.version==="classic")i="https://nightly.yarnpkg.com/latest.js";else if(this.version.match(/^\.{0,2}[\\/]/)||T.isAbsolute(this.version))i=`file://${T.resolve(this.version)}`;else if(vt.satisfiesWithPrereleases(this.version,">=2.0.0"))i=`https://repo.yarnpkg.com/${this.version}/packages/yarnpkg-cli/bin/yarn.js`;else if(vt.satisfiesWithPrereleases(this.version,"^0.x || ^1.x"))i=`https://github.com/yarnpkg/yarn/releases/download/v${this.version}/yarn-${this.version}.js`;else if(vt.validRange(this.version))i=`https://repo.yarnpkg.com/${await V2e(e,this.version)}/packages/yarnpkg-cli/bin/yarn.js`;else throw new me(`Invalid version descriptor "${this.version}"`);return(await xe.start({configuration:e,stdout:this.context.stdout,includeLogs:!this.context.quiet},async s=>{let o="file://",a;i.startsWith(o)?(s.reportInfo(z.UNNAMED,`Downloading ${Ae.pretty(e,i,ds.URL)}`),a=await L.readFilePromise(T.toPortablePath(i.slice(o.length)))):(s.reportInfo(z.UNNAMED,`Retrieving ${Ae.pretty(e,i,ds.PATH)}`),a=await Rt.get(i,{configuration:e})),await DP(e,null,a,{report:s})})).exitCode()}};vp.paths=[["set","version"]],vp.usage=he.Usage({description:"lock the Yarn version used by the project",details:"\n This command will download a specific release of Yarn directly from the Yarn GitHub repository, will store it inside your project, and will change the `yarnPath` settings from your project `.yarnrc.yml` file to point to the new file.\n\n A very good use case for this command is to enforce the version of Yarn used by the any single member of your team inside a same project - by doing this you ensure that you have control on Yarn upgrades and downgrades (including on your deployment servers), and get rid of most of the headaches related to someone using a slightly different version and getting a different behavior than you.\n\n The version specifier can be:\n\n - a tag:\n - `latest` / `berry` / `stable` -> the most recent stable berry (`>=2.0.0`) release\n - `canary` -> the most recent canary (release candidate) berry (`>=2.0.0`) release\n - `classic` -> the most recent classic (`^0.x || ^1.x`) release\n\n - a semver range (e.g. `2.x`) -> the most recent version satisfying the range (limited to berry releases)\n\n - a semver version (e.g. `2.4.1`, `1.22.1`)\n\n - a local file referenced through either a relative or absolute path\n\n - `self` -> the version used to invoke the command\n ",examples:[["Download the latest release from the Yarn repository","$0 set version latest"],["Download the latest canary release from the Yarn repository","$0 set version canary"],["Download the latest classic release from the Yarn repository","$0 set version classic"],["Download the most recent Yarn 3 build","$0 set version 3.x"],["Download a specific Yarn 2 build","$0 set version 2.0.0-rc.30"],["Switch back to a specific Yarn 1 release","$0 set version 1.22.1"],["Use a relea
Line truncated
|
||||
${e}`)});let n=(g=t.projectCwd)!=null?g:t.startingCwd,s=D.resolve(n,".yarn/releases"),o=D.resolve(s,`yarn-${e}.cjs`),a=D.relative(t.startingCwd,o),l=D.relative(n,o),c=t.get("yarnPath"),u=c===null||c.startsWith(`${s}/`);if(i.reportInfo(z.UNNAMED,`Saving the new release in ${Ae.pretty(t,a,"magenta")}`),await L.removePromise(D.dirname(o)),await L.mkdirPromise(D.dirname(o),{recursive:!0}),await L.writeFilePromise(o,r),await L.chmodPromise(o,493),u){await le.updateConfiguration(n,{yarnPath:l});let f=await ze.tryFind(n)||new ze;e&&de.isTaggedYarnVersion(e)&&(f.packageManager=`yarn@${e}`);let h={};f.exportTo(h);let p=D.join(n,ze.fileName),m=`${JSON.stringify(h,null,f.indent)}
|
||||
`;await L.changeFilePromise(p,m,{automaticNewlines:!0})}}var X2e=/^[0-9]+$/;function kte(t){return X2e.test(t)?`pull/${t}/head`:t}var Z2e=({repository:t,branch:e},r)=>[["git","init",T.fromPortablePath(r)],["git","remote","add","origin",t],["git","fetch","origin",kte(e)],["git","reset","--hard","FETCH_HEAD"]],_2e=({branch:t})=>[["git","fetch","origin",kte(t),"--force"],["git","reset","--hard","FETCH_HEAD"],["git","clean","-dfx"]],$2e=({plugins:t,noMinify:e},r)=>[["yarn","build:cli",...new Array().concat(...t.map(i=>["--plugin",D.resolve(r,i)])),...e?["--no-minify"]:[],"|"]],Pp=class extends ye{constructor(){super(...arguments);this.installPath=j.String("--path",{description:"The path where the repository should be cloned to"});this.repository=j.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=j.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.plugins=j.Array("--plugin",[],{description:"An array of additional plugins that should be included in the bundle"});this.noMinify=j.Boolean("--no-minify",!1,{description:"Build a bundle for development (debugging) - non-minified and non-mangled"});this.force=j.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.skipPlugins=j.Boolean("--skip-plugins",!1,{description:"Skip updating the contrib plugins"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd),i=typeof this.installPath!="undefined"?D.resolve(this.context.cwd,T.toPortablePath(this.installPath)):D.resolve(T.toPortablePath((0,xte.tmpdir)()),"yarnpkg-sources",Di.makeHash(this.repository).slice(0,6));return(await xe.start({configuration:e,stdout:this.context.stdout},async s=>{await xP(this,{configuration:e,report:s,target:i}),s.reportSeparator(),s.reportInfo(z.UNNAMED,"Building a fresh bundle"),s.reportSeparator(),await Fp($2e(this,i),{configuration:e,context:this.context,target:i}),s.reportSeparator();let o=D.resolve(i,"packages/yarnpkg-cli/bundles/yarn.js"),a=await L.readFilePromise(o);await DP(e,"sources",a,{report:s}),this.skipPlugins||await eHe(this,{project:r,report:s,target:i})})).exitCode()}};Pp.paths=[["set","version","from","sources"]],Pp.usage=he.Usage({description:"build Yarn from master",details:`
|
||||
This command will clone the Yarn repository into a temporary folder, then build it. The resulting bundle will then be copied into the local project.
|
||||
|
||||
By default, it also updates all contrib plugins to the same commit the bundle is built from. This behavior can be disabled by using the \`--skip-plugins\` flag.
|
||||
`,examples:[["Build Yarn from master","$0 set version from sources"]]});var vte=Pp;async function Fp(t,{configuration:e,context:r,target:i}){for(let[n,...s]of t){let o=s[s.length-1]==="|";if(o&&s.pop(),o)await Lr.pipevp(n,s,{cwd:i,stdin:r.stdin,stdout:r.stdout,stderr:r.stderr,strict:!0});else{r.stdout.write(`${Ae.pretty(e,` $ ${[n,...s].join(" ")}`,"grey")}
|
||||
`);try{await Lr.execvp(n,s,{cwd:i,strict:!0})}catch(a){throw r.stdout.write(a.stdout||a.stack),a}}}}async function xP(t,{configuration:e,report:r,target:i}){let n=!1;if(!t.force&&L.existsSync(D.join(i,".git"))){r.reportInfo(z.UNNAMED,"Fetching the latest commits"),r.reportSeparator();try{await Fp(_2e(t),{configuration:e,context:t.context,target:i}),n=!0}catch(s){r.reportSeparator(),r.reportWarning(z.UNNAMED,"Repository update failed; we'll try to regenerate it")}}n||(r.reportInfo(z.UNNAMED,"Cloning the remote repository"),r.reportSeparator(),await L.removePromise(i),await L.mkdirPromise(i,{recursive:!0}),await Fp(Z2e(t,i),{configuration:e,context:t.context,target:i}))}async function eHe(t,{project:e,report:r,target:i}){let n=await ul(e.configuration),s=new Set(Object.keys(n));for(let o of e.configuration.plugins.keys())!s.has(o)||await SP(o,t,{project:e,report:r,target:i})}var Pte=te(cr()),Fte=te(require("url")),Rte=te(require("vm"));var Rp=class extends ye{constructor(){super(...arguments);this.name=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins);return(await xe.start({configuration:e,stdout:this.context.stdout},async i=>{let{project:n}=await Fe.find(e,this.context.cwd),s,o;if(this.name.match(/^\.{0,2}[\\/]/)||T.isAbsolute(this.name)){let a=D.resolve(this.context.cwd,T.toPortablePath(this.name));i.reportInfo(z.UNNAMED,`Reading ${Ae.pretty(e,a,Ae.Type.PATH)}`),s=D.relative(n.cwd,a),o=await L.readFilePromise(a)}else{let a;if(this.name.match(/^https?:/)){try{new Fte.URL(this.name)}catch{throw new _e(z.INVALID_PLUGIN_REFERENCE,`Plugin specifier "${this.name}" is neither a plugin name nor a valid url`)}s=this.name,a=this.name}else{let l=w.parseLocator(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-"));if(l.reference!=="unknown"&&!Pte.default.valid(l.reference))throw new _e(z.UNNAMED,"Official plugins only accept strict version references. Use an explicit URL if you wish to download them from another location.");let c=w.stringifyIdent(l),u=await ul(e);if(!Object.prototype.hasOwnProperty.call(u,c))throw new _e(z.PLUGIN_NAME_NOT_FOUND,`Couldn't find a plugin named "${c}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be referenced by their name; any other plugin will have to be referenced through its public url (for example https://github.com/yarnpkg/berry/raw/master/packages/plugin-typescript/bin/%40yarnpkg/plugin-typescript.js).`);s=c,a=u[c].url,l.reference!=="unknown"?a=a.replace(/\/master\//,`/${c}/${l.reference}/`):Er!==null&&(a=a.replace(/\/master\//,`/@yarnpkg/cli/${Er}/`))}i.reportInfo(z.UNNAMED,`Downloading ${Ae.pretty(e,a,"green")}`),o=await Rt.get(a,{configuration:e})}await kP(s,o,{project:n,report:i})})).exitCode()}};Rp.paths=[["plugin","import"]],Rp.usage=he.Usage({category:"Plugin-related commands",description:"download a plugin",details:`
|
||||
This command downloads the specified plugin from its remote location and updates the configuration to reference it in further CLI invocations.
|
||||
|
||||
Three types of plugin references are accepted:
|
||||
|
||||
- If the plugin is stored within the Yarn repository, it can be referenced by name.
|
||||
- Third-party plugins can be referenced directly through their public urls.
|
||||
- Local plugins can be referenced by their path on the disk.
|
||||
|
||||
Plugins cannot be downloaded from the npm registry, and aren't allowed to have dependencies (they need to be bundled into a single file, possibly thanks to the \`@yarnpkg/builder\` package).
|
||||
`,examples:[['Download and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import @yarnpkg/plugin-exec"],['Download and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import exec"],["Download and activate a community plugin","$0 plugin import https://example.org/path/to/plugin.js"],["Activate a local plugin","$0 plugin import ./path/to/plugin.js"]]});var Nte=Rp;async function kP(t,e,{project:r,report:i}){let{configuration:n}=r,s={},o={exports:s};(0,Rte.runInNewContext)(e.toString(),{module:o,exports:s});let a=o.exports.name,l=`.yarn/plugins/${a}.cjs`,c=D.resolve(r.cwd,l);i.reportInfo(z.UNNAMED,`Saving the new plugin in ${Ae.pretty(n,l,"magenta")}`),await L.mkdirPromise(D.dirname(c),{recursive:!0}),await L.writeFilePromise(c,e);let u={path:l,spec:t};await le.updateConfiguration(r.cwd,g=>{let f=[],h=!1;for(let p of g.plugins||[]){let m=typeof p!="string"?p.path:p,I=D.resolve(r.cwd,T.toPortablePath(m)),{name:y}=de.dynamicRequire(I);y!==a?f.push(p):(f.push(u),h=!0)}return h||f.push(u),V(v({},g),{plugins:f})})}var tHe=({pluginName:t,noMinify:e},r)=>[["yarn",`build:${t}`,...e?["--no-minify"]:[],"|"]],Np=class extends ye{constructor(){super(...arguments);this.installPath=j.String("--path",{description:"The path where the repository should be cloned to"});this.repository=j.String("--repository","https://github.com/yarnpkg/berry.git",{description:"The repository that should be cloned"});this.branch=j.String("--branch","master",{description:"The branch of the repository that should be cloned"});this.noMinify=j.Boolean("--no-minify",!1,{description:"Build a plugin for development (debugging) - non-minified and non-mangled"});this.force=j.Boolean("-f,--force",!1,{description:"Always clone the repository instead of trying to fetch the latest commits"});this.name=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=typeof this.installPath!="undefined"?D.resolve(this.context.cwd,T.toPortablePath(this.installPath)):D.resolve(T.toPortablePath((0,Lte.tmpdir)()),"yarnpkg-sources",Di.makeHash(this.repository).slice(0,6));return(await xe.start({configuration:e,stdout:this.context.stdout},async n=>{let{project:s}=await Fe.find(e,this.context.cwd),o=w.parseIdent(this.name.replace(/^((@yarnpkg\/)?plugin-)?/,"@yarnpkg/plugin-")),a=w.stringifyIdent(o),l=await ul(e);if(!Object.prototype.hasOwnProperty.call(l,a))throw new _e(z.PLUGIN_NAME_NOT_FOUND,`Couldn't find a plugin named "${a}" on the remote registry. Note that only the plugins referenced on our website (https://github.com/yarnpkg/berry/blob/master/plugins.yml) can be built and imported from sources.`);let c=a;await xP(this,{configuration:e,report:n,target:r}),await SP(c,this,{project:s,report:n,target:r})})).exitCode()}};Np.paths=[["plugin","import","from","sources"]],Np.usage=he.Usage({category:"Plugin-related commands",description:"build a plugin from sources",details:`
|
||||
This command clones the Yarn repository into a temporary folder, builds the specified contrib plugin and updates the configuration to reference it in further CLI invocations.
|
||||
|
||||
The plugins can be referenced by their short name if sourced from the official Yarn repository.
|
||||
`,examples:[['Build and activate the "@yarnpkg/plugin-exec" plugin',"$0 plugin import from sources @yarnpkg/plugin-exec"],['Build and activate the "@yarnpkg/plugin-exec" plugin (shorthand)',"$0 plugin import from sources exec"]]});var Mte=Np;async function SP(t,{context:e,noMinify:r},{project:i,report:n,target:s}){let o=t.replace(/@yarnpkg\//,""),{configuration:a}=i;n.reportSeparator(),n.reportInfo(z.UNNAMED,`Building a fresh ${o}`),n.reportSeparator(),await Fp(tHe({pluginName:o,noMinify:r},s),{configuration:a,context:e,target:s}),n.reportSeparator();let l=D.resolve(s,`packages/${o}/bundles/${t}.js`),c=await L.readFilePromise(l);await kP(t,c,{project:i,report:n})}var Lp=class extends ye{constructor(){super(...arguments);this.name=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd);return(await xe.start({configuration:e,stdout:this.context.stdout},async n=>{let s=this.name,o=w.parseIdent(s);if(!e.plugins.has(s))throw new me(`${w.prettyIdent(e,o)} isn't referenced by the current configuration`);let a=`.yarn/plugins/${s}.cjs`,l=D.resolve(r.cwd,a);L.existsSync(l)&&(n.reportInfo(z.UNNAMED,`Removing ${Ae.pretty(e,a,Ae.Type.PATH)}...`),await L.removePromise(l)),n.reportInfo(z.UNNAMED,"Updating the configuration..."),await le.updateConfiguration(r.cwd,c=>{if(!Array.isArray(c.plugins))return c;let u=c.plugins.filter(g=>g.path!==a);return c.plugins.length===u.length?c:V(v({},c),{plugins:u})})})).exitCode()}};Lp.paths=[["plugin","remove"]],Lp.usage=he.Usage({category:"Plugin-related commands",description:"remove a plugin",details:`
|
||||
This command deletes the specified plugin from the .yarn/plugins folder and removes it from the configuration.
|
||||
|
||||
**Note:** The plugins have to be referenced by their name property, which can be obtained using the \`yarn plugin runtime\` command. Shorthands are not allowed.
|
||||
`,examples:[["Remove a plugin imported from the Yarn repository","$0 plugin remove @yarnpkg/plugin-typescript"],["Remove a plugin imported from a local file","$0 plugin remove my-local-plugin"]]});var Tte=Lp;var Mp=class extends ye{constructor(){super(...arguments);this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins);return(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async i=>{for(let n of e.plugins.keys()){let s=this.context.plugins.plugins.has(n),o=n;s&&(o+=" [builtin]"),i.reportJson({name:n,builtin:s}),i.reportInfo(null,`${o}`)}})).exitCode()}};Mp.paths=[["plugin","runtime"]],Mp.usage=he.Usage({category:"Plugin-related commands",description:"list the active plugins",details:`
|
||||
This command prints the currently active plugins. Will be displayed both builtin plugins and external plugins.
|
||||
`,examples:[["List the currently active plugins","$0 plugin runtime"]]});var Ote=Mp;var Tp=class extends ye{constructor(){super(...arguments);this.idents=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);let s=new Set;for(let a of this.idents)s.add(w.parseIdent(a).identHash);if(await r.restoreInstallState({restoreResolutions:!1}),await r.resolveEverything({cache:n,report:new Br}),s.size>0)for(let a of r.storedPackages.values())s.has(a.identHash)&&r.storedBuildState.delete(a.locatorHash);else r.storedBuildState.clear();return(await xe.start({configuration:e,stdout:this.context.stdout,includeLogs:!this.context.quiet},async a=>{await r.install({cache:n,report:a})})).exitCode()}};Tp.paths=[["rebuild"]],Tp.usage=he.Usage({description:"rebuild the project's native packages",details:`
|
||||
This command will automatically cause Yarn to forget about previous compilations of the given packages and to run them again.
|
||||
|
||||
Note that while Yarn forgets the compilation, the previous artifacts aren't erased from the filesystem and may affect the next builds (in good or bad). To avoid this, you may remove the .yarn/unplugged folder, or any other relevant location where packages might have been stored (Yarn may offer a way to do that automatically in the future).
|
||||
|
||||
By default all packages will be rebuilt, but you can filter the list by specifying the names of the packages you want to clear from memory.
|
||||
`,examples:[["Rebuild all packages","$0 rebuild"],["Rebuild fsevents only","$0 rebuild fsevents"]]});var Kte=Tp;var vP=te(Yi());Pn();var Op=class extends ye{constructor(){super(...arguments);this.all=j.Boolean("-A,--all",!1,{description:"Apply the operation to all workspaces from the current project"});this.mode=j.String("--mode",{description:"Change what artifacts installs generate",validator:ni(kr)});this.patterns=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState({restoreResolutions:!1});let s=this.all?r.workspaces:[i],o=[er.REGULAR,er.DEVELOPMENT,er.PEER],a=[],l=!1,c=[];for(let h of this.patterns){let p=!1,m=w.parseIdent(h);for(let I of s){let y=[...I.manifest.peerDependenciesMeta.keys()];for(let B of(0,vP.default)(y,h))I.manifest.peerDependenciesMeta.delete(B),l=!0,p=!0;for(let B of o){let x=I.manifest.getForScope(B),F=[...x.values()].map(N=>w.stringifyIdent(N));for(let N of(0,vP.default)(F,w.stringifyIdent(m))){let{identHash:O}=w.parseIdent(N),P=x.get(O);if(typeof P=="undefined")throw new Error("Assertion failed: Expected the descriptor to be registered");I.manifest[B].delete(O),c.push([I,B,P]),l=!0,p=!0}}}p||a.push(h)}let u=a.length>1?"Patterns":"Pattern",g=a.length>1?"don't":"doesn't",f=this.all?"any":"this";if(a.length>0)throw new me(`${u} ${Ae.prettyList(e,a,ds.CODE)} ${g} match any packages referenced by ${f} workspace`);return l?(await e.triggerMultipleHooks(p=>p.afterWorkspaceDependencyRemoval,c),(await xe.start({configuration:e,stdout:this.context.stdout},async p=>{await r.install({cache:n,report:p,mode:this.mode})})).exitCode()):0}};Op.paths=[["remove"]],Op.usage=he.Usage({description:"remove dependencies from the project",details:`
|
||||
This command will remove the packages matching the specified patterns from the current workspace.
|
||||
|
||||
If the \`--mode=<mode>\` option is set, Yarn will change which artifacts are generated. The modes currently supported are:
|
||||
|
||||
- \`skip-build\` will not run the build scripts at all. Note that this is different from setting \`enableScripts\` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.
|
||||
|
||||
- \`update-lockfile\` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.
|
||||
|
||||
This command accepts glob patterns as arguments (if valid Idents and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.
|
||||
`,examples:[["Remove a dependency from the current project","$0 remove lodash"],["Remove a dependency from all workspaces at once","$0 remove lodash --all"],["Remove all dependencies starting with `eslint-`","$0 remove 'eslint-*'"],["Remove all dependencies with the `@babel` scope","$0 remove '@babel/*'"],["Remove all dependencies matching `react-dom` or `react-helmet`","$0 remove 'react-{dom,helmet}'"]]});var Ute=Op;var Hte=te(require("util")),iB=class extends ye{async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);return(await xe.start({configuration:e,stdout:this.context.stdout},async s=>{let o=i.manifest.scripts,a=de.sortMap(o.keys(),u=>u),l={breakLength:Infinity,colors:e.get("enableColors"),maxArrayLength:2},c=a.reduce((u,g)=>Math.max(u,g.length),0);for(let[u,g]of o.entries())s.reportInfo(null,`${u.padEnd(c," ")} ${(0,Hte.inspect)(g,l)}`)})).exitCode()}};iB.paths=[["run"]];var Yte=iB;var Kp=class extends ye{constructor(){super(...arguments);this.inspect=j.String("--inspect",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.inspectBrk=j.String("--inspect-brk",!1,{tolerateBoolean:!0,description:"Forwarded to the underlying Node process when executing a binary"});this.topLevel=j.Boolean("-T,--top-level",!1,{hidden:!0});this.binariesOnly=j.Boolean("-B,--binaries-only",!1,{hidden:!0});this.silent=j.Boolean("--silent",{hidden:!0});this.scriptName=j.String();this.args=j.Proxy()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i,locator:n}=await Fe.find(e,this.context.cwd);await r.restoreInstallState();let s=this.topLevel?r.topLevelWorkspace.anchoredLocator:n;if(!this.binariesOnly&&await Qt.hasPackageScript(s,this.scriptName,{project:r}))return await Qt.executePackageScript(s,this.scriptName,this.args,{project:r,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr});let o=await Qt.getPackageAccessibleBinaries(s,{project:r});if(o.get(this.scriptName)){let l=[];return this.inspect&&(typeof this.inspect=="string"?l.push(`--inspect=${this.inspect}`):l.push("--inspect")),this.inspectBrk&&(typeof this.inspectBrk=="string"?l.push(`--inspect-brk=${this.inspectBrk}`):l.push("--inspect-brk")),await Qt.executePackageAccessibleBinary(s,this.scriptName,this.args,{cwd:this.context.cwd,project:r,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,nodeArgs:l,packageAccessibleBinaries:o})}if(!this.topLevel&&!this.binariesOnly&&i&&this.scriptName.includes(":")){let c=(await Promise.all(r.workspaces.map(async u=>u.manifest.scripts.has(this.scriptName)?u:null))).filter(u=>u!==null);if(c.length===1)return await Qt.executeWorkspaceScript(c[0],this.scriptName,this.args,{stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})}if(this.topLevel)throw this.scriptName==="node-gyp"?new me(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${w.prettyLocator(e,n)}). This typically happens because some package depends on "node-gyp" to build itself, but didn't list it in their dependencies. To fix that, please run "yarn add node-gyp" into your top-level workspace. You also can open an issue on the repository of the specified package to suggest them to use an optional peer dependency.`):new me(`Couldn't find a script name "${this.scriptName}" in the top-level (used by ${w.prettyLocator(e,n)}).`);{if(this.scriptName==="global")throw new me("The 'yarn global' commands have been removed in 2.x - consider using 'yarn dlx' or a third-party plugin instead");let l=[this.scriptName].concat(this.args);for(let[c,u]of lu)for(let g of u)if(l.length>=g.length&&JSON.stringify(l.slice(0,g.length))===JSON.stringify(g))throw new me(`Couldn't find a script named "${this.scriptName}", but a matching command can be found in the ${c} plugin. You can install it with "yarn plugin import ${c}".`);throw new me(`Couldn't find a script named "${this.scriptName}".`)}}};Kp.paths=[["run"]],Kp.usage=he.Usage({description:"run a script defined in the package.json",details:`
|
||||
This command will run a tool. The exact tool that will be executed will depend on the current state of your workspace:
|
||||
|
||||
- If the \`scripts\` field from your local package.json contains a matching script name, its definition will get executed.
|
||||
|
||||
- Otherwise, if one of the local workspace's dependencies exposes a binary with a matching name, this binary will get executed.
|
||||
|
||||
- Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, then this script will get executed.
|
||||
|
||||
Whatever happens, the cwd of the spawned process will be the workspace that declares the script (which makes it possible to call commands cross-workspaces using the third syntax).
|
||||
`,examples:[["Run the tests from the local workspace","$0 run test"],['Same thing, but without the "run" keyword',"$0 test"],["Inspect Webpack while running","$0 run --inspect-brk webpack"]]});var jte=Kp;var Up=class extends ye{constructor(){super(...arguments);this.save=j.Boolean("-s,--save",!1,{description:"Persist the resolution inside the top-level manifest"});this.descriptor=j.String();this.resolution=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(await r.restoreInstallState({restoreResolutions:!1}),!i)throw new Ze(r.cwd,this.context.cwd);let s=w.parseDescriptor(this.descriptor,!0),o=w.makeDescriptor(s,this.resolution);return r.storedDescriptors.set(s.descriptorHash,s),r.storedDescriptors.set(o.descriptorHash,o),r.resolutionAliases.set(s.descriptorHash,o.descriptorHash),(await xe.start({configuration:e,stdout:this.context.stdout},async l=>{await r.install({cache:n,report:l})})).exitCode()}};Up.paths=[["set","resolution"]],Up.usage=he.Usage({description:"enforce a package resolution",details:'\n This command updates the resolution table so that `descriptor` is resolved by `resolution`.\n\n Note that by default this command only affect the current resolution table - meaning that this "manual override" will disappear if you remove the lockfile, or if the package disappear from the table. If you wish to make the enforced resolution persist whatever happens, add the `-s,--save` flag which will also edit the `resolutions` field from your top-level manifest.\n\n Note that no attempt is made at validating that `resolution` is a valid resolution entry for `descriptor`.\n ',examples:[["Force all instances of lodash@npm:^1.2.3 to resolve to 1.5.0","$0 set resolution lodash@npm:^1.2.3 1.5.0"]]});var Gte=Up;var qte=te(Yi()),Hp=class extends ye{constructor(){super(...arguments);this.all=j.Boolean("-A,--all",!1,{description:"Unlink all workspaces belonging to the target project from the current one"});this.leadingArguments=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);let s=r.topLevelWorkspace,o=new Set;if(this.leadingArguments.length===0&&this.all)for(let{pattern:l,reference:c}of s.manifest.resolutions)c.startsWith("portal:")&&o.add(l.descriptor.fullName);if(this.leadingArguments.length>0)for(let l of this.leadingArguments){let c=D.resolve(this.context.cwd,T.toPortablePath(l));if(de.isPathLike(l)){let u=await le.find(c,this.context.plugins,{useRc:!1,strict:!1}),{project:g,workspace:f}=await Fe.find(u,c);if(!f)throw new Ze(g.cwd,c);if(this.all){for(let h of g.workspaces)h.manifest.name&&o.add(w.stringifyIdent(h.locator));if(o.size===0)throw new me("No workspace found to be unlinked in the target project")}else{if(!f.manifest.name)throw new me("The target workspace doesn't have a name and thus cannot be unlinked");o.add(w.stringifyIdent(f.locator))}}else{let u=[...s.manifest.resolutions.map(({pattern:g})=>g.descriptor.fullName)];for(let g of(0,qte.default)(u,l))o.add(g)}}return s.manifest.resolutions=s.manifest.resolutions.filter(({pattern:l})=>!o.has(l.descriptor.fullName)),(await xe.start({configuration:e,stdout:this.context.stdout},async l=>{await r.install({cache:n,report:l})})).exitCode()}};Hp.paths=[["unlink"]],Hp.usage=he.Usage({description:"disconnect the local project from another one",details:`
|
||||
This command will remove any resolutions in the project-level manifest that would have been added via a yarn link with similar arguments.
|
||||
`,examples:[["Unregister a remote workspace in the current project","$0 unlink ~/ts-loader"],["Unregister all workspaces from a remote project in the current project","$0 unlink ~/jest --all"],["Unregister all previously linked workspaces","$0 unlink --all"],["Unregister all workspaces matching a glob","$0 unlink '@babel/*' 'pkg-{a,b}'"]]});var Jte=Hp;var Wte=te(up()),PP=te(Yi());Pn();var xu=class extends ye{constructor(){super(...arguments);this.interactive=j.Boolean("-i,--interactive",{description:"Offer various choices, depending on the detected upgrade paths"});this.exact=j.Boolean("-E,--exact",!1,{description:"Don't use any semver modifier on the resolved range"});this.tilde=j.Boolean("-T,--tilde",!1,{description:"Use the `~` semver modifier on the resolved range"});this.caret=j.Boolean("-C,--caret",!1,{description:"Use the `^` semver modifier on the resolved range"});this.recursive=j.Boolean("-R,--recursive",!1,{description:"Resolve again ALL resolutions for those packages"});this.mode=j.String("--mode",{description:"Change what artifacts installs generate",validator:ni(kr)});this.patterns=j.Rest()}async execute(){return this.recursive?await this.executeUpRecursive():await this.executeUpClassic()}async executeUpRecursive(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState({restoreResolutions:!1});let s=[...r.storedDescriptors.values()],o=s.map(u=>w.stringifyIdent(u)),a=new Set;for(let u of this.patterns){if(w.parseDescriptor(u).range!=="unknown")throw new me("Ranges aren't allowed when using --recursive");for(let g of(0,PP.default)(o,u)){let f=w.parseIdent(g);a.add(f.identHash)}}let l=s.filter(u=>a.has(u.identHash));for(let u of l)r.storedDescriptors.delete(u.descriptorHash),r.storedResolutions.delete(u.descriptorHash);return(await xe.start({configuration:e,stdout:this.context.stdout},async u=>{await r.install({cache:n,report:u})})).exitCode()}async executeUpClassic(){var m;let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd),n=await ft.find(e);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState({restoreResolutions:!1});let s=(m=this.interactive)!=null?m:e.get("preferInteractive"),o=gp(this,r),a=s?[or.KEEP,or.REUSE,or.PROJECT,or.LATEST]:[or.PROJECT,or.LATEST],l=[],c=[];for(let I of this.patterns){let y=!1,B=w.parseDescriptor(I);for(let x of r.workspaces)for(let F of[er.REGULAR,er.DEVELOPMENT]){let O=[...x.manifest.getForScope(F).values()].map(P=>w.stringifyIdent(P));for(let P of(0,PP.default)(O,w.stringifyIdent(B))){let J=w.parseIdent(P),oe=x.manifest[F].get(J.identHash);if(typeof oe=="undefined")throw new Error("Assertion failed: Expected the descriptor to be registered");let K=w.makeDescriptor(J,B.range);l.push(Promise.resolve().then(async()=>[x,F,oe,await fp(K,{project:r,workspace:x,cache:n,target:F,modifier:o,strategies:a})])),y=!0}}y||c.push(I)}if(c.length>1)throw new me(`Patterns ${Ae.prettyList(e,c,ds.CODE)} don't match any packages referenced by any workspace`);if(c.length>0)throw new me(`Pattern ${Ae.prettyList(e,c,ds.CODE)} doesn't match any packages referenced by any workspace`);let u=await Promise.all(l),g=await uo.start({configuration:e,stdout:this.context.stdout,suggestInstall:!1},async I=>{for(let[,,y,{suggestions:B,rejections:x}]of u){let F=B.filter(N=>N.descriptor!==null);if(F.length===0){let[N]=x;if(typeof N=="undefined")throw new Error("Assertion failed: Expected an error to have been set");let O=this.cli.error(N);r.configuration.get("enableNetwork")?I.reportError(z.CANT_SUGGEST_RESOLUTIONS,`${w.prettyDescriptor(e,y)} can't be resolved to a satisfying range
|
||||
|
||||
${O}`):I.reportError(z.CANT_SUGGEST_RESOLUTIONS,`${w.prettyDescriptor(e,y)} can't be resolved to a satisfying range (note: network resolution has been disabled)
|
||||
|
||||
${O}`)}else F.length>1&&!s&&I.reportError(z.CANT_SUGGEST_RESOLUTIONS,`${w.prettyDescriptor(e,y)} has multiple possible upgrade strategies; use -i to disambiguate manually`)}});if(g.hasErrors())return g.exitCode();let f=!1,h=[];for(let[I,y,,{suggestions:B}]of u){let x,F=B.filter(J=>J.descriptor!==null),N=F[0].descriptor,O=F.every(J=>w.areDescriptorsEqual(J.descriptor,N));F.length===1||O?x=N:(f=!0,{answer:x}=await(0,Wte.prompt)({type:"select",name:"answer",message:`Which range to you want to use in ${w.prettyWorkspace(e,I)} \u276F ${y}?`,choices:B.map(({descriptor:J,name:oe,reason:K})=>J?{name:oe,hint:K,descriptor:J}:{name:oe,hint:K,disabled:!0}),onCancel:()=>process.exit(130),result(J){return this.find(J,"descriptor")},stdin:this.context.stdin,stdout:this.context.stdout}));let P=I.manifest[y].get(x.identHash);if(typeof P=="undefined")throw new Error("Assertion failed: This descriptor should have a matching entry");if(P.descriptorHash!==x.descriptorHash)I.manifest[y].set(x.identHash,x),h.push([I,y,P,x]);else{let J=e.makeResolver(),oe={project:r,resolver:J},K=J.bindDescriptor(P,I.anchoredLocator,oe);r.forgetResolution(K)}}return await e.triggerMultipleHooks(I=>I.afterWorkspaceDependencyReplacement,h),f&&this.context.stdout.write(`
|
||||
`),(await xe.start({configuration:e,stdout:this.context.stdout},async I=>{await r.install({cache:n,report:I,mode:this.mode})})).exitCode()}};xu.paths=[["up"]],xu.usage=he.Usage({description:"upgrade dependencies across the project",details:"\n This command upgrades the packages matching the list of specified patterns to their latest available version across the whole project (regardless of whether they're part of `dependencies` or `devDependencies` - `peerDependencies` won't be affected). This is a project-wide command: all workspaces will be upgraded in the process.\n\n If `-R,--recursive` is set the command will change behavior and no other switch will be allowed. When operating under this mode `yarn up` will force all ranges matching the selected packages to be resolved again (often to the highest available versions) before being stored in the lockfile. It however won't touch your manifests anymore, so depending on your needs you might want to run both `yarn up` and `yarn up -R` to cover all bases.\n\n If `-i,--interactive` is set (or if the `preferInteractive` settings is toggled on) the command will offer various choices, depending on the detected upgrade paths. Some upgrades require this flag in order to resolve ambiguities.\n\n The, `-C,--caret`, `-E,--exact` and `-T,--tilde` options have the same meaning as in the `add` command (they change the modifier used when the range is missing or a tag, and are ignored when the range is explicitly set).\n\n If the `--mode=<mode>` option is set, Yarn will change which artifacts are generated. The modes currently supported are:\n\n - `skip-build` will not run the build scripts at all. Note that this is different from setting `enableScripts` to false because the later will disable build scripts, and thus affect the content of the artifacts generated on disk, whereas the former will just disable the build step - but not the scripts themselves, which just won't run.\n\n - `update-lockfile` will skip the link step altogether, and only fetch packages that are missing from the lockfile (or that have no associated checksums). This mode is typically used by tools like Renovate or Dependabot to keep a lockfile up-to-date without incurring the full install cost.\n\n Generally you can see `yarn up` as a counterpart to what was `yarn upgrade --latest` in Yarn 1 (ie it ignores the ranges previously listed in your manifests), but unlike `yarn upgrade` which only upgraded dependencies in the current workspace, `yarn up` will upgrade all workspaces at the same time.\n\n This command accepts glob patterns as arguments (if valid Descriptors and supported by [micromatch](https://github.com/micromatch/micromatch)). Make sure to escape the patterns, to prevent your own shell from trying to expand them.\n\n **Note:** The ranges have to be static, only the package scopes and names can contain glob patterns.\n ",examples:[["Upgrade all instances of lodash to the latest release","$0 up lodash"],["Upgrade all instances of lodash to the latest release, but ask confirmation for each","$0 up lodash -i"],["Upgrade all instances of lodash to 1.2.3","$0 up [email protected]"],["Upgrade all instances of packages with the `@babel` scope to the latest release","$0 up '@babel/*'"],["Upgrade all instances of packages containing the word `jest` to the latest release","$0 up '*jest*'"],["Upgrade all instances of packages with the `@babel` scope to 7.0.0","$0 up '@babel/*@7.0.0'"]]}),xu.schema=[DQ("recursive",$a.Forbids,["interactive","exact","tilde","caret"],{ignore:[void 0,!1]})];var zte=xu;var Yp=class extends ye{constructor(){super(...arguments);this.recursive=j.Boolean("-R,--recursive",!1,{description:"List, for each workspace, what are all the paths that lead to the dependency"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.peers=j.Boolean("--peers",!1,{description:"Also print the peer dependencies that match the specified name"});this.package=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState();let n=w.parseIdent(this.package).identHash,s=this.recursive?iHe(r,n,{configuration:e,peers:this.peers}):rHe(r,n,{configuration:e,peers:this.peers});Un.emitTree(s,{configuration:e,stdout:this.context.stdout,json:this.json,separators:1})}};Yp.paths=[["why"]],Yp.usage=he.Usage({description:"display the reason why a package is needed",details:`
|
||||
This command prints the exact reasons why a package appears in the dependency tree.
|
||||
|
||||
If \`-R,--recursive\` is set, the listing will go in depth and will list, for each workspaces, what are all the paths that lead to the dependency. Note that the display is somewhat optimized in that it will not print the package listing twice for a single package, so if you see a leaf named "Foo" when looking for "Bar", it means that "Foo" already got printed higher in the tree.
|
||||
`,examples:[["Explain why lodash is used in your project","$0 why lodash"]]});var Vte=Yp;function rHe(t,e,{configuration:r,peers:i}){let n=de.sortMap(t.storedPackages.values(),a=>w.stringifyLocator(a)),s={},o={children:s};for(let a of n){let l={},c=null;for(let u of a.dependencies.values()){if(!i&&a.peerDependencies.has(u.identHash))continue;let g=t.storedResolutions.get(u.descriptorHash);if(!g)throw new Error("Assertion failed: The resolution should have been registered");let f=t.storedPackages.get(g);if(!f)throw new Error("Assertion failed: The package should have been registered");if(f.identHash!==e)continue;if(c===null){let p=w.stringifyLocator(a);s[p]={value:[a,Ae.Type.LOCATOR],children:l}}let h=w.stringifyLocator(f);l[h]={value:[{descriptor:u,locator:f},Ae.Type.DEPENDENT]}}}return o}function iHe(t,e,{configuration:r,peers:i}){let n=de.sortMap(t.workspaces,f=>w.stringifyLocator(f.anchoredLocator)),s=new Set,o=new Set,a=f=>{if(s.has(f.locatorHash))return o.has(f.locatorHash);if(s.add(f.locatorHash),f.identHash===e)return o.add(f.locatorHash),!0;let h=!1;f.identHash===e&&(h=!0);for(let p of f.dependencies.values()){if(!i&&f.peerDependencies.has(p.identHash))continue;let m=t.storedResolutions.get(p.descriptorHash);if(!m)throw new Error("Assertion failed: The resolution should have been registered");let I=t.storedPackages.get(m);if(!I)throw new Error("Assertion failed: The package should have been registered");a(I)&&(h=!0)}return h&&o.add(f.locatorHash),h};for(let f of n){let h=t.storedPackages.get(f.anchoredLocator.locatorHash);if(!h)throw new Error("Assertion failed: The package should have been registered");a(h)}let l=new Set,c={},u={children:c},g=(f,h,p)=>{if(!o.has(f.locatorHash))return;let m=p!==null?Ae.tuple(Ae.Type.DEPENDENT,{locator:f,descriptor:p}):Ae.tuple(Ae.Type.LOCATOR,f),I={},y={value:m,children:I},B=w.stringifyLocator(f);if(h[B]=y,!l.has(f.locatorHash)&&(l.add(f.locatorHash),!(p!==null&&t.tryWorkspaceByLocator(f))))for(let x of f.dependencies.values()){if(!i&&f.peerDependencies.has(x.identHash))continue;let F=t.storedResolutions.get(x.descriptorHash);if(!F)throw new Error("Assertion failed: The resolution should have been registered");let N=t.storedPackages.get(F);if(!N)throw new Error("Assertion failed: The package should have been registered");g(N,I,x)}};for(let f of n){let h=t.storedPackages.get(f.anchoredLocator.locatorHash);if(!h)throw new Error("Assertion failed: The package should have been registered");g(h,c,null)}return u}var jp=class extends ye{constructor(){super(...arguments);this.verbose=j.Boolean("-v,--verbose",!1,{description:"Also return the cross-dependencies between workspaces"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd);return(await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async n=>{for(let s of r.workspaces){let{manifest:o}=s,a;if(this.verbose){let l=new Set,c=new Set;for(let u of ze.hardDependencies)for(let[g,f]of o.getForScope(u)){let h=r.tryWorkspaceByDescriptor(f);h===null?r.workspacesByIdent.has(g)&&c.add(f):l.add(h)}a={workspaceDependencies:Array.from(l).map(u=>u.relativeCwd),mismatchedWorkspaceDependencies:Array.from(c).map(u=>w.stringifyDescriptor(u))}}n.reportInfo(null,`${s.relativeCwd}`),n.reportJson(v({location:s.relativeCwd,name:o.name?w.stringifyIdent(o.name):null},a))}})).exitCode()}};jp.paths=[["workspaces","list"]],jp.usage=he.Usage({category:"Workspace-related commands",description:"list all available workspaces",details:"\n This command will print the list of all workspaces in the project. If both the `-v,--verbose` and `--json` options are set, Yarn will also return the cross-dependencies between each workspaces (useful when you wish to automatically generate Buck / Bazel rules).\n "});var Xte=jp;var Gp=class extends he{constructor(){super(...arguments);this.workspaceName=j.String();this.commandName=j.String();this.args=j.Proxy()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);let n=r.workspaces,s=new Map(n.map(a=>{let l=w.convertToIdent(a.locator);return[w.stringifyIdent(l),a]})),o=s.get(this.workspaceName);if(o===void 0){let a=Array.from(s.keys()).sort();throw new me(`Workspace '${this.workspaceName}' not found. Did you mean any of the following:
|
||||
- ${a.join(`
|
||||
- `)}?`)}return this.cli.run([this.commandName,...this.args],{cwd:o.cwd})}};Gp.paths=[["workspace"]],Gp.usage=he.Usage({category:"Workspace-related commands",description:"run a command within the specified workspace",details:`
|
||||
This command will run a given sub-command on a single workspace.
|
||||
`,examples:[["Add a package to a single workspace","yarn workspace components add -D react"],["Run build script on a single workspace","yarn workspace components run build"]]});var Zte=Gp;var nHe={configuration:{enableImmutableInstalls:{description:"If true (the default on CI), prevents the install command from modifying the lockfile",type:ge.BOOLEAN,default:_te.isCI},defaultSemverRangePrefix:{description:"The default save prefix: '^', '~' or ''",type:ge.STRING,values:["^","~",""],default:ll.CARET}},commands:[P$,R$,zee,ote,Gte,vte,Ste,Xte,gte,fte,hte,pte,k$,v$,ate,lte,dte,Cte,Ite,Ete,Bte,Jte,wte,Mte,Nte,Tte,Qte,Ote,Kte,Ute,Yte,jte,zte,Vte,Zte]},sHe=nHe;var MP={};et(MP,{default:()=>aHe});var Me={optional:!0},$te=[["@tailwindcss/aspect-ratio@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@tailwindcss/line-clamp@<0.2.1",{peerDependencies:{tailwindcss:"^2.0.2"}}],["@fullhuman/[email protected] || 3.1.3-alpha.0",{peerDependencies:{postcss:"^8.0.0"}}],["@samverschueren/stream-to-observable@<0.3.1",{peerDependenciesMeta:{rxjs:Me,zenObservable:Me}}],["any-observable@<0.5.1",{peerDependenciesMeta:{rxjs:Me,zenObservable:Me}}],["@pm2/agent@<1.0.4",{dependencies:{debug:"*"}}],["debug@<4.2.0",{peerDependenciesMeta:{["supports-color"]:Me}}],["got@<11",{dependencies:{["@types/responselike"]:"^1.0.0",["@types/keyv"]:"^3.1.1"}}],["cacheable-lookup@<4.1.2",{dependencies:{["@types/keyv"]:"^3.1.1"}}],["http-link-dataloader@*",{peerDependencies:{graphql:"^0.13.1 || ^14.0.0"}}],["typescript-language-server@*",{dependencies:{["vscode-jsonrpc"]:"^5.0.1",["vscode-languageserver-protocol"]:"^3.15.0"}}],["postcss-syntax@*",{peerDependenciesMeta:{["postcss-html"]:Me,["postcss-jsx"]:Me,["postcss-less"]:Me,["postcss-markdown"]:Me,["postcss-scss"]:Me}}],["jss-plugin-rule-value-function@<=10.1.1",{dependencies:{["tiny-warning"]:"^1.0.2"}}],["ink-select-input@<4.1.0",{peerDependencies:{react:"^16.8.2"}}],["license-webpack-plugin@<2.3.18",{peerDependenciesMeta:{webpack:Me}}],["snowpack@>=3.3.0",{dependencies:{["node-gyp"]:"^7.1.0"}}],["promise-inflight@*",{peerDependenciesMeta:{bluebird:Me}}],["reactcss@*",{peerDependencies:{react:"*"}}],["react-color@<=2.19.0",{peerDependencies:{react:"*"}}],["gatsby-plugin-i18n@*",{dependencies:{ramda:"^0.24.1"}}],["useragent@^2.0.0",{dependencies:{request:"^2.88.0",yamlparser:"0.0.x",semver:"5.5.x"}}],["@apollographql/apollo-tools@*",{peerDependencies:{graphql:"^14.2.1 || ^15.0.0"}}],["material-table@^2.0.0",{dependencies:{"@babel/runtime":"^7.11.2"}}],["@babel/parser@*",{dependencies:{"@babel/types":"^7.8.3"}}],["fork-ts-checker-webpack-plugin@*",{peerDependencies:{eslint:">= 6",typescript:">= 2.7",webpack:">= 4","vue-template-compiler":"*"},peerDependenciesMeta:{eslint:Me,"vue-template-compiler":Me}}],["rc-animate@<=3.1.1",{peerDependencies:{react:">=16.9.0","react-dom":">=16.9.0"}}],["react-bootstrap-table2-paginator@*",{dependencies:{classnames:"^2.2.6"}}],["react-draggable@<=4.4.3",{peerDependencies:{react:">= 16.3.0","react-dom":">= 16.3.0"}}],["apollo-upload-client@<14",{peerDependencies:{graphql:"14 - 15"}}],["react-instantsearch-core@<=6.7.0",{peerDependencies:{algoliasearch:">= 3.1 < 5"}}],["react-instantsearch-dom@<=6.7.0",{dependencies:{"react-fast-compare":"^3.0.0"}}],["ws@<7.2.1",{peerDependencies:{bufferutil:"^4.0.1","utf-8-validate":"^5.0.2"},peerDependenciesMeta:{bufferutil:Me,"utf-8-validate":Me}}],["react-portal@*",{peerDependencies:{"react-dom":"^15.0.0-0 || ^16.0.0-0 || ^17.0.0-0"}}],["react-scripts@<=4.0.1",{peerDependencies:{react:"*"}}],["testcafe@<=1.10.1",{dependencies:{"@babel/plugin-transform-for-of":"^7.12.1","@babel/runtime":"^7.12.5"}}],["testcafe-legacy-api@<=4.2.0",{dependencies:{"testcafe-hammerhead":"^17.0.1","read-file-relative":"^1.2.0"}}],["@google-cloud/firestore@<=4.9.3",{dependencies:{protobufjs:"^6.8.6"}}],["gatsby-source-apiserver@*",{dependencies:{["babel-polyfill"]:"^6.26.0"}}],["@webpack-cli/package-utils@<=1.0.1-alpha.4",{dependencies:{["cross-spawn"]:"^7.0.3"}}],["gatsby-remark-prismjs@<3.3.28",{dependencies:{lodash:"^4"}}],["gatsby-plugin-favicon@*",{peerDependencies:{webpack:"*"}}],["gatsby-plugin-sharp@*",{dependencies:{debug:"^4.3.1"}}],["gatsby-react-router-scroll@*",{dependencies:{["prop-types"]:"^15.7.2"}}],["@rebass/forms@*",{dependencies:{["@styled-system/should-forward-prop"]:"^5.0.0"},peerDependencies:{react:"^16.8.6"}}],["rebass@*",{peerDependencies:{react:"^16.8.6"}}],["@ant-design/react-slick@<=0.28.3",{peerDependencies:{react:">=16.0.0"}}],["mqtt@<4.2.7",{dependencies:{duplexify:"^4.1.1"}}],["vue-cli-plugin-vuetify@<=2.0.3",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Me,"vuetify-loader":Me}}],["vue-cli-plugin-vuetify@<=2.0.4",{dependencies:{"null-loader":"^3.0.0"}}],["@vuetify/cli-plugin-utils@<=0.0.4",{dependencies:{semver:"^6.3.0"},peerDependenciesMeta:{"sass-loader":Me}}],["@vue/cli-plugin-typescript@<=5.0.0-alpha.0",{dependencies:{"babel-loader":"^8.1.0"}}],["@vue/cli-plugin-typescript@<=5.0.0-beta.
Line truncated
|
||||
`),await L.writeFilePromise(D.join(r,"yarn.lock"),"");let i=D.join(r,".yarnrc.yml"),n=await le.findProjectCwd(this.context.cwd,xt.lockfile),s=!(await le.find(this.context.cwd,null,{strict:!1})).get("enableGlobalCache"),o=n!==null?D.join(n,".yarnrc.yml"):null;o!==null&&L.existsSync(o)?(await L.copyFilePromise(o,i),await le.updateConfiguration(r,m=>{let I=V(v({},m),{enableGlobalCache:s,enableTelemetry:!1});return Array.isArray(m.plugins)&&(I.plugins=m.plugins.map(y=>{let B=typeof y=="string"?y:y.path,x=T.isAbsolute(B)?B:T.resolve(T.fromPortablePath(n),B);return typeof y=="string"?x:{path:x,spec:y.spec}})),I})):await L.writeFilePromise(i,`enableGlobalCache: ${s}
|
||||
enableTelemetry: false
|
||||
`);let a=(p=this.packages)!=null?p:[this.command],l=w.parseDescriptor(this.command).name,c=await this.cli.run(["add","--",...a],{cwd:r,quiet:this.quiet});if(c!==0)return c;this.quiet||this.context.stdout.write(`
|
||||
`);let u=await le.find(r,this.context.plugins),{project:g,workspace:f}=await Fe.find(u,r);if(f===null)throw new Ze(g.cwd,r);await g.restoreInstallState();let h=await Qt.getWorkspaceAccessibleBinaries(f);return h.has(l)===!1&&h.size===1&&typeof this.packages=="undefined"&&(l=Array.from(h)[0][0]),await Qt.executeWorkspaceAccessibleBinary(f,l,this.args,{packageAccessibleBinaries:h,cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr})})}};qp.paths=[["dlx"]],qp.usage=he.Usage({description:"run a package in a temporary environment",details:"\n This command will install a package within a temporary environment, and run its binary script if it contains any. The binary will run within the current cwd.\n\n By default Yarn will download the package named `command`, but this can be changed through the use of the `-p,--package` flag which will instruct Yarn to still run the same command but from a different package.\n\n Using `yarn dlx` as a replacement of `yarn add` isn't recommended, as it makes your project non-deterministic (Yarn doesn't keep track of the packages installed through `dlx` - neither their name, nor their version).\n ",examples:[["Use create-react-app to create a new React app","yarn dlx create-react-app ./my-app"]]});var sre=qp;var AHe={commands:[nre,sre]},lHe=AHe;var JP={};et(JP,{default:()=>gHe,fileUtils:()=>OP});var ku=/^(?:[a-zA-Z]:[\\/]|\.{0,2}\/)/,Jp=/^[^?]*\.(?:tar\.gz|tgz)(?:::.*)?$/,ar="file:";var OP={};et(OP,{makeArchiveFromLocator:()=>sB,makeBufferFromLocator:()=>HP,makeLocator:()=>UP,makeSpec:()=>ore,parseSpec:()=>KP});function KP(t){let{params:e,selector:r}=w.parseRange(t),i=T.toPortablePath(r);return{parentLocator:e&&typeof e.locator=="string"?w.parseLocator(e.locator):null,path:i}}function ore({parentLocator:t,path:e,folderHash:r,protocol:i}){let n=t!==null?{locator:w.stringifyLocator(t)}:{},s=typeof r!="undefined"?{hash:r}:{};return w.makeRange({protocol:i,source:e,selector:e,params:v(v({},s),n)})}function UP(t,{parentLocator:e,path:r,folderHash:i,protocol:n}){return w.makeLocator(t,ore({parentLocator:e,path:r,folderHash:i,protocol:n}))}async function sB(t,{protocol:e,fetchOptions:r,inMemory:i=!1}){let{parentLocator:n,path:s}=w.parseFileStyleRange(t.reference,{protocol:e}),o=D.isAbsolute(s)?{packageFs:new yt(we.root),prefixPath:we.dot,localPath:we.root}:await r.fetcher.fetch(n,r),a=o.localPath?{packageFs:new yt(we.root),prefixPath:D.relative(we.root,o.localPath)}:o;o!==a&&o.releaseFs&&o.releaseFs();let l=a.packageFs,c=D.join(a.prefixPath,s);return await de.releaseAfterUseAsync(async()=>await hr.makeArchiveFromDirectory(c,{baseFs:l,prefixPath:w.getIdentVendorPath(t),compressionLevel:r.project.configuration.get("compressionLevel"),inMemory:i}),a.releaseFs)}async function HP(t,{protocol:e,fetchOptions:r}){return(await sB(t,{protocol:e,fetchOptions:r,inMemory:!0})).getBufferAndClose()}var YP=class{supports(e,r){return!!e.reference.startsWith(ar)}getLocalPath(e,r){let{parentLocator:i,path:n}=w.parseFileStyleRange(e.reference,{protocol:ar});if(D.isAbsolute(n))return n;let s=r.fetcher.getLocalPath(i,r);return s===null?null:D.resolve(s,n)}async fetch(e,r){let i=r.checksums.get(e.locatorHash)||null,[n,s,o]=await r.cache.fetchPackageFromCache(e,i,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${w.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.fetchFromDisk(e,r),skipIntegrityCheck:r.skipIntegrityCheck});return{packageFs:n,releaseFs:s,prefixPath:w.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:o}}async fetchFromDisk(e,r){return sB(e,{protocol:ar,fetchOptions:r})}};var cHe=1,jP=class{supportsDescriptor(e,r){return e.range.match(ku)?!0:!!e.range.startsWith(ar)}supportsLocator(e,r){return!!e.reference.startsWith(ar)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,i){return ku.test(e.range)&&(e=w.makeDescriptor(e,`${ar}${e.range}`)),w.bindDescriptor(e,{locator:w.stringifyLocator(r)})}getResolutionDependencies(e,r){return[]}async getCandidates(e,r,i){if(!i.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{path:n,parentLocator:s}=KP(e.range);if(s===null)throw new Error("Assertion failed: The descriptor should have been bound");let o=await HP(w.makeLocator(e,w.makeRange({protocol:ar,source:n,selector:n,params:{locator:w.stringifyLocator(s)}})),{protocol:ar,fetchOptions:i.fetchOptions}),a=Di.makeHash(`${cHe}`,o).slice(0,6);return[UP(e,{parentLocator:s,path:n,folderHash:a,protocol:ar})]}async getSatisfying(e,r,i){return null}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let i=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),n=await de.releaseAfterUseAsync(async()=>await ze.find(i.prefixPath,{baseFs:i.packageFs}),i.releaseFs);return V(v({},e),{version:n.versi
Line truncated
|
||||
`);let s=[];return this.private&&s.push("-p"),this.workspace&&s.push("-w"),this.yes&&s.push("-y"),await L.mktempPromise(async o=>{let{code:a}=await Lr.pipevp("yarn",["init",...s],{cwd:this.context.cwd,stdin:this.context.stdin,stdout:this.context.stdout,stderr:this.context.stderr,env:await Qt.makeScriptEnv({binFolder:o})});return a})}async executeRegular(e){var l;let r=null;try{r=(await Fe.find(e,this.context.cwd)).project}catch{r=null}L.existsSync(this.context.cwd)||await L.mkdirPromise(this.context.cwd,{recursive:!0});let i=await ze.tryFind(this.context.cwd)||new ze,n=Object.fromEntries(e.get("initFields").entries());i.load(n),i.name=(l=i.name)!=null?l:w.makeIdent(e.get("initScope"),D.basename(this.context.cwd)),i.packageManager=Er&&de.isTaggedYarnVersion(Er)?`yarn@${Er}`:null,typeof i.raw.private=="undefined"&&(this.private||this.workspace&&i.workspaceDefinitions.length===0)&&(i.private=!0),this.workspace&&i.workspaceDefinitions.length===0&&(await L.mkdirPromise(D.join(this.context.cwd,"packages"),{recursive:!0}),i.workspaceDefinitions=[{pattern:"packages/*"}]);let s={};i.exportTo(s),uF.inspect.styles.name="cyan",this.context.stdout.write(`${(0,uF.inspect)(s,{depth:Infinity,colors:!0,compact:!1})}
|
||||
`);let o=D.join(this.context.cwd,ze.fileName);await L.changeFilePromise(o,`${JSON.stringify(s,null,2)}
|
||||
`,{automaticNewlines:!0});let a=D.join(this.context.cwd,"README.md");if(L.existsSync(a)||await L.writeFilePromise(a,`# ${w.stringifyIdent(i.name)}
|
||||
`),!r||r.cwd===this.context.cwd){let c=D.join(this.context.cwd,xt.lockfile);L.existsSync(c)||await L.writeFilePromise(c,"");let g=["/.yarn/*","!/.yarn/patches","!/.yarn/plugins","!/.yarn/releases","!/.yarn/sdks","","# Swap the comments on the following lines if you don't wish to use zero-installs","# Documentation here: https://yarnpkg.com/features/zero-installs","!/.yarn/cache","#/.pnp.*"].map(I=>`${I}
|
||||
`).join(""),f=D.join(this.context.cwd,".gitignore");L.existsSync(f)||await L.writeFilePromise(f,g);let h={["*"]:{endOfLine:"lf",insertFinalNewline:!0},["*.{js,json,yml}"]:{charset:"utf-8",indentStyle:"space",indentSize:2}};(0,tie.default)(h,e.get("initEditorConfig"));let p=`root = true
|
||||
`;for(let[I,y]of Object.entries(h)){p+=`
|
||||
[${I}]
|
||||
`;for(let[B,x]of Object.entries(y))p+=`${B.replace(/[A-Z]/g,N=>`_${N.toLowerCase()}`)} = ${x}
|
||||
`}let m=D.join(this.context.cwd,".editorconfig");L.existsSync(m)||await L.writeFilePromise(m,p),L.existsSync(D.join(this.context.cwd,".git"))||await Lr.execvp("git",["init"],{cwd:this.context.cwd})}}};_p.paths=[["init"]],_p.usage=he.Usage({description:"create a new package",details:"\n This command will setup a new package in your local directory.\n\n If the `-p,--private` or `-w,--workspace` options are set, the package will be private by default.\n\n If the `-w,--workspace` option is set, the package will be configured to accept a set of workspaces in the `packages/` directory.\n\n If the `-i,--install` option is given a value, Yarn will first download it using `yarn set version` and only then forward the init call to the newly downloaded bundle. Without arguments, the downloaded bundle will be `latest`.\n\n The initial settings of the manifest can be changed by using the `initScope` and `initFields` configuration values. Additionally, Yarn will generate an EditorConfig file whose rules can be altered via `initEditorConfig`, and will initialize a Git repository in the current directory.\n ",examples:[["Create a new package in the local directory","yarn init"],["Create a new private package in the local directory","yarn init -p"],["Create a new package and store the Yarn release inside","yarn init -i=latest"],["Create a new private package and defines it as a workspace root","yarn init -w"]]});var rie=_p;var NYe={configuration:{initScope:{description:"Scope used when creating packages via the init command",type:ge.STRING,default:null},initFields:{description:"Additional fields to set when creating packages via the init command",type:ge.MAP,valueDefinition:{description:"",type:ge.ANY}},initEditorConfig:{description:"Extra rules to define in the generator editorconfig",type:ge.MAP,valueDefinition:{description:"",type:ge.ANY}}},commands:[rie]},LYe=NYe;var CF={};et(CF,{default:()=>TYe});var Io="portal:",Eo="link:";var fF=class{supports(e,r){return!!e.reference.startsWith(Io)}getLocalPath(e,r){let{parentLocator:i,path:n}=w.parseFileStyleRange(e.reference,{protocol:Io});if(D.isAbsolute(n))return n;let s=r.fetcher.getLocalPath(i,r);return s===null?null:D.resolve(s,n)}async fetch(e,r){let{parentLocator:i,path:n}=w.parseFileStyleRange(e.reference,{protocol:Io}),s=D.isAbsolute(n)?{packageFs:new yt(we.root),prefixPath:we.dot,localPath:we.root}:await r.fetcher.fetch(i,r),o=s.localPath?{packageFs:new yt(we.root),prefixPath:D.relative(we.root,s.localPath)}:s;s!==o&&s.releaseFs&&s.releaseFs();let a=o.packageFs,l=D.join(o.prefixPath,n);return s.localPath?{packageFs:new yt(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:we.dot,localPath:l}:{packageFs:new Ls(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:we.dot}}};var hF=class{supportsDescriptor(e,r){return!!e.range.startsWith(Io)}supportsLocator(e,r){return!!e.reference.startsWith(Io)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,i){return w.bindDescriptor(e,{locator:w.stringifyLocator(r)})}getResolutionDependencies(e,r){return[]}async getCandidates(e,r,i){let n=e.range.slice(Io.length);return[w.makeLocator(e,`${Io}${T.toPortablePath(n)}`)]}async getSatisfying(e,r,i){return null}async resolve(e,r){if(!r.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let i=await r.fetchOptions.fetcher.fetch(e,r.fetchOptions),n=await de.releaseAfterUseAsync(async()=>await ze.find(i.prefixPath,{baseFs:i.packageFs}),i.releaseFs);return V(v({},e),{version:n.version||"0.0.0",languageName:n.languageName||r.project.configuration.get("defaultLanguageName"),linkType:lt.SOFT,dependencies:new Map([...n.dependencies]),peerDependencies:n.peerDependencies,dependenciesMeta:n.dependenciesMeta,peerDependenciesMeta:n.peerDependenciesMeta,bin:n.bin})}};var pF=class{supports(e,r){return!!e.reference.startsWith(Eo)}getLocalPath(e,r){let{parentLocator:i,path:n}=w.parseFileStyleRange(e.reference,{protocol:Eo});if(D.isAbsolute(n))return n;let s=r.fetcher.getLocalPath(i,r);return s===null?null:D.resolve(s,n)}async fetch(e,r){let{parentLocator:i,path:n}=w.parseFileStyleRange(e.reference,{protocol:Eo}),s=D.isAbsolute(n)?{packageFs:new yt(we.root),prefixPath:we.dot,localPath:we.root}:await r.fetcher.fetch(i,r),o=s.localPath?{packageFs:new yt(we.root),prefixPath:D.relative(we.root,s.localPath)}:s;s!==o&&s.releaseFs&&s.releaseFs();let a=o.packageFs,l=D.join(o.prefixPath,n);return s.localPath?{packageFs:new yt(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:we.dot,discardFromLookup:!0,localPath:l}:{packageFs:new Ls(l,{baseFs:a}),releaseFs:o.releaseFs,prefixPath:we.dot,discardFromLookup:!0}}};var dF=class{supportsDescriptor(e,r){return!!e.range.startsWith(Eo)}supportsLocator(e,r){return!!e.reference.startsWith(Eo)}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,i){return w.bindDescriptor(e,{locator:w.stringifyLocator(r)})}getResolutionDependencies(e,r){return[]}async getCandidates(e,r,i){let n=e.range.slice(Eo.len
Line truncated
|
||||
${u}, next tree:
|
||||
${$p(a)}`);let f=nie(a);if(f)throw new Error(`${f}, after hoisting finished:
|
||||
${$p(a)}`)}return s.debugLevel>=2&&console.log($p(a)),KYe(a)},UYe=t=>{let e=t[t.length-1],r=new Map,i=new Set,n=s=>{if(!i.has(s)){i.add(s);for(let o of s.hoistedDependencies.values())r.set(o.name,o);for(let o of s.dependencies.values())s.peerNames.has(o.name)||n(o)}};return n(e),r},HYe=t=>{let e=t[t.length-1],r=new Map,i=new Set,n=new Map;for(let a of t)for(let l of a.dependencies.values())n.set(l.name,l);let s=new Set,o=(a,l)=>{if(i.has(a))return;i.add(a);for(let u of a.hoistedDependencies.values())if(!l.has(u.name)){let g=n.get(u.name);g&&r.set(g.name,g)}let c=new Set;for(let u of a.dependencies.values())c.add(u.name);for(let u of a.dependencies.values())a.peerNames.has(u.name)||o(u,c)};return o(e,s),r},oie=(t,e)=>{if(e.decoupled)return e;let{name:r,references:i,ident:n,locator:s,dependencies:o,originalDependencies:a,hoistedDependencies:l,peerNames:c,reasons:u,isHoistBorder:g}=e,f={name:r,references:new Set(i),ident:n,locator:s,dependencies:new Map(o),originalDependencies:new Map(a),hoistedDependencies:new Map(l),peerNames:new Set(c),reasons:new Map(u),decoupled:!0,isHoistBorder:g,hoistedFrom:[]},h=f.dependencies.get(r);return h&&h.ident==f.ident&&f.dependencies.set(r,f),t.dependencies.set(f.name,f),f},YYe=(t,e)=>{let r=new Map([[t.name,[t.ident]]]);for(let n of t.dependencies.values())t.peerNames.has(n.name)||r.set(n.name,[n.ident]);let i=Array.from(e.keys());i.sort((n,s)=>{let o=e.get(n),a=e.get(s);return a.peerDependents.size!==o.peerDependents.size?a.peerDependents.size-o.peerDependents.size:a.dependents.size-o.dependents.size});for(let n of i){let s=n.substring(0,n.indexOf("@",1)),o=n.substring(s.length+1);if(!t.peerNames.has(s)){let a=r.get(s);a||(a=[],r.set(s,a)),a.indexOf(o)<0&&a.push(o)}}return r},EF=t=>{let e=new Set,r=(i,n=new Set)=>{if(!n.has(i)){n.add(i);for(let s of i.peerNames)if(!t.peerNames.has(s)){let o=t.dependencies.get(s);o&&!e.has(o)&&r(o,n)}e.add(i)}};for(let i of t.dependencies.values())t.peerNames.has(i.name)||r(i);return e},IF=(t,e,r,i,n,s=new Set)=>{let o=e[e.length-1];if(s.has(o))return{anotherRoundNeeded:!1,isGraphChanged:!1};s.add(o);let a=GYe(o),l=YYe(o,a),c=t==o?new Map:n.fastLookupPossible?UYe(e):HYe(e),u,g=!1,f=!1,h=new Map(Array.from(l.entries()).map(([m,I])=>[m,I[0]])),p=new Map;do{let m=jYe(t,e,r,c,h,l,i,p,n);m.isGraphChanged&&(f=!0),m.anotherRoundNeeded&&(g=!0),u=!1;for(let[I,y]of l)y.length>1&&!o.dependencies.has(I)&&(h.delete(I),y.shift(),h.set(I,y[0]),u=!0)}while(u);for(let m of o.dependencies.values())if(!o.peerNames.has(m.name)&&!r.has(m.locator)){r.add(m.locator);let I=IF(t,[...e,m],r,p,n);I.isGraphChanged&&(f=!0),I.anotherRoundNeeded&&(g=!0),r.delete(m.locator)}return{anotherRoundNeeded:g,isGraphChanged:f}},qYe=(t,e,r,i,n,s,o,a,{outputReason:l})=>{let c,u=null,g=new Set;l&&(c=`${Array.from(e).map(m=>Li(m)).join("\u2192")}`);let f=r[r.length-1],p=!(i.ident===f.ident);if(l&&!p&&(u="- self-reference"),p&&(p=!t.peerNames.has(i.name),l&&!p&&(u=`- cannot shadow peer: ${Li(t.originalDependencies.get(i.name).locator)} at ${c}`)),p){let m=!1,I=n.get(i.name);if(m=!I||I.ident===i.ident,l&&!m&&(u=`- filled by: ${Li(I.locator)} at ${c}`),m)for(let y=r.length-1;y>=1;y--){let x=r[y].dependencies.get(i.name);if(x&&x.ident!==i.ident){m=!1;let F=a.get(f);F||(F=new Set,a.set(f,F)),F.add(i.name),l&&(u=`- filled by ${Li(x.locator)} at ${r.slice(0,y).map(N=>Li(N.locator)).join("\u2192")}`);break}}p=m}if(p&&(p=s.get(i.name)===i.ident,l&&!p&&(u=`- filled by: ${Li(o.get(i.name)[0])} at ${c}`)),p){let m=!0,I=new Set(i.peerNames);for(let y=r.length-1;y>=1;y--){let B=r[y];for(let x of I){if(B.peerNames.has(x)&&B.originalDependencies.has(x))continue;let F=B.dependencies.get(x);F&&t.dependencies.get(x)!==F&&(y===r.length-1?g.add(F):(g=null,m=!1,l&&(u=`- peer dependency ${Li(F.locator)} from parent ${Li(B.locator)} was not hoisted to ${c}`))),I.delete(x)}if(!m)break}p=m}return g!==null&&g.size>0?{isHoistable:2,dependsOn:g,reason:u}:{isHoistable:p?0:1,reason:u}},jYe=(t,e,r,i,n,s,o,a,l)=>{let c=e[e.length-1],u=new Set,g=!1,f=!1,h=(I,y,B,x)=>{if(u.has(B))return;let F=[...y,B.locator],N=new Map,O=new Map;for(let K of EF(B)){let A=qYe(c,r,[c,...I,B],K,i,n,s,a,{outputReason:l.debugLevel>=2});if(O.set(K,A),A.isHoistable===2)for(let W of A.dependsOn){let ee=N.get(W.name)||new Set;ee.add(K.name),N.set(W.name,ee)}}let P=new Set,J=(K,A,W)=>{if(!P.has(K)){P.add(K),O.set(K,{isHoistable:1,reason:W});for(let ee of N.get(K.name)||[])J(B.dependencies.get(ee),A,l.debugLevel>=2?`- peer dependency ${Li(K.locator)} from parent ${Li(B.locator)} was not hoisted`:"")}};for(let[K,A]of O)A.isHoistable===1&&J(K,A,A.reason);for(let K of O.keys())if(!P.has(K)){f=!0;let A=o.get(B);A&&A.has(K.name)&&(g=!0),B.dependencies.delete(K.name),B.hoistedDependencies.set(K.name,K),B.reasons.delete(K.name);let W=c.dependencies.get(K.name),ee=null;if(l.debugLevel>=2&&(ee=Array.from(y).concat([B.locator]).map(re=>Li(re)).join("\u2192")),!W)c.ident!==K.ident&&(c.dependencies.set(K.name,K),l.debugLevel>=2&&K.hoistedFrom.push(ee),x.add(
Line truncated
|
||||
${$p(t)}`)}let oe=EF(B);for(let K of oe)if(P.has(K)){let A=O.get(K);if((n.get(K.name)===K.ident||!B.reasons.has(K.name))&&A.isHoistable!==0&&B.reasons.set(K.name,A.reason),!K.isHoistBorder&&F.indexOf(K.locator)<0){u.add(B);let ee=oie(B,K);h([...I,B],[...y,B.locator],ee,m),u.delete(B)}}},p,m=new Set(EF(c));do{p=m,m=new Set;for(let I of p){if(I.locator===c.locator||I.isHoistBorder)continue;let y=oie(c,I);h([],Array.from(r),y,m)}}while(m.size>0);return{anotherRoundNeeded:g,isGraphChanged:f}},nie=t=>{let e=[],r=new Set,i=new Set,n=(s,o)=>{if(r.has(s)||(r.add(s),i.has(s)))return;let a=new Map(o);for(let l of s.dependencies.values())s.peerNames.has(l.name)||a.set(l.name,l);for(let l of s.originalDependencies.values()){let c=a.get(l.name),u=()=>`${Array.from(i).concat([s]).map(g=>Li(g.locator)).join("\u2192")}`;if(s.peerNames.has(l.name)){let g=o.get(l.name);(g!==c||!g||g.ident!==l.ident)&&e.push(`${u()} - broken peer promise: expected ${l.ident} but found ${g&&g.ident}`)}else c?c.ident!==l.ident&&e.push(`${u()} - broken require promise for ${l.name}: expected ${l.ident}, but found: ${c.ident}`):e.push(`${u()} - broken require promise: no required dependency ${l.locator} found`)}i.add(s);for(let l of s.dependencies.values())s.peerNames.has(l.name)||n(l,a);i.delete(s)};return n(t,t.dependencies),e.join(`
|
||||
`)},OYe=(t,e)=>{let{identName:r,name:i,reference:n,peerNames:s}=t,o={name:i,references:new Set([n]),locator:mF(r,n),ident:iie(r,n),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(s),reasons:new Map,decoupled:!0,isHoistBorder:!0,hoistedFrom:[]},a=new Map([[t,o]]),l=(c,u)=>{let g=a.get(c),f=!!g;if(!g){let{name:h,identName:p,reference:m,peerNames:I}=c,y=e.hoistingLimits.get(u.locator);g={name:h,references:new Set([m]),locator:mF(p,m),ident:iie(p,m),dependencies:new Map,originalDependencies:new Map,hoistedDependencies:new Map,peerNames:new Set(I),reasons:new Map,decoupled:!0,isHoistBorder:y?y.has(h):!1,hoistedFrom:[]},a.set(c,g)}if(u.dependencies.set(c.name,g),u.originalDependencies.set(c.name,g),f){let h=new Set,p=m=>{if(!h.has(m)){h.add(m),m.decoupled=!1;for(let I of m.dependencies.values())m.peerNames.has(I.name)||p(I)}};p(g)}else for(let h of c.dependencies)l(h,g)};for(let c of t.dependencies)l(c,o);return o},yF=t=>t.substring(0,t.indexOf("@",1)),KYe=t=>{let e={name:t.name,identName:yF(t.locator),references:new Set(t.references),dependencies:new Set},r=new Set([t]),i=(n,s,o)=>{let a=r.has(n),l;if(s===n)l=o;else{let{name:c,references:u,locator:g}=n;l={name:c,identName:yF(g),references:u,dependencies:new Set}}if(o.dependencies.add(l),!a){r.add(n);for(let c of n.dependencies.values())n.peerNames.has(c.name)||i(c,n,l);r.delete(n)}};for(let n of t.dependencies.values())i(n,t,e);return e},GYe=t=>{let e=new Map,r=new Set([t]),i=o=>`${o.name}@${o.ident}`,n=o=>{let a=i(o),l=e.get(a);return l||(l={dependents:new Set,peerDependents:new Set},e.set(a,l)),l},s=(o,a)=>{let l=!!r.has(a);if(n(a).dependents.add(o.ident),!l){r.add(a);for(let u of a.dependencies.values())a.peerNames.has(u.name)?n(u).peerDependents.add(a.ident):s(a,u)}};for(let o of t.dependencies.values())t.peerNames.has(o.name)||s(t,o);return e},Li=t=>{let e=t.indexOf("@",1),r=t.substring(0,e);r.endsWith("$wsroot$")&&(r=`wh:${r.replace("$wsroot$","")}`);let i=t.substring(e+1);if(i==="workspace:.")return".";if(i){let n=(i.indexOf("#")>0?i.split("#")[1]:i).replace("npm:","");return i.startsWith("virtual")&&(r=`v:${r}`),n.startsWith("workspace")&&(r=`w:${r}`,n=""),`${r}${n?`@${n}`:""}`}else return`${r}`},aie=5e4,$p=t=>{let e=0,r=(n,s,o="")=>{if(e>aie||s.has(n))return"";e++;let a=Array.from(n.dependencies.values()).sort((c,u)=>c.name.localeCompare(u.name)),l="";s.add(n);for(let c=0;c<a.length;c++){let u=a[c];if(!n.peerNames.has(u.name)&&u!==n){let g=n.reasons.get(u.name),f=yF(u.locator);l+=`${o}${c<a.length-1?"\u251C\u2500":"\u2514\u2500"}${(s.has(u)?">":"")+(f!==u.name?`a:${u.name}:`:"")+Li(u.locator)+(g?` ${g}`:"")+(u!==n&&u.hoistedFrom.length>0?`, hoisted from: ${u.hoistedFrom.join(", ")}`:"")}
|
||||
`,l+=r(u,s,`${o}${c<a.length-1?"\u2502 ":" "}`)}}return s.delete(n),l};return r(t,new Set)+(e>aie?`
|
||||
Tree is too large, part of the tree has been dunped
|
||||
`:"")};var ed;(function(r){r.HARD="HARD",r.SOFT="SOFT"})(ed||(ed={}));var Mi;(function(i){i.WORKSPACES="workspaces",i.DEPENDENCIES="dependencies",i.NONE="none"})(Mi||(Mi={}));var Aie="node_modules",oB="$wsroot$";var td=(t,e)=>{let{packageTree:r,hoistingLimits:i,errors:n,preserveSymlinksRequired:s}=JYe(t,e),o=null;if(n.length===0){let a=sie(r,{hoistingLimits:i});o=WYe(t,a,e)}return{tree:o,errors:n,preserveSymlinksRequired:s}},Bs=t=>`${t.name}@${t.reference}`,BF=t=>{let e=new Map;for(let[r,i]of t.entries())if(!i.dirList){let n=e.get(i.locator);n||(n={target:i.target,linkType:i.linkType,locations:[],aliases:i.aliases},e.set(i.locator,n)),n.locations.push(r)}for(let r of e.values())r.locations=r.locations.sort((i,n)=>{let s=i.split(D.delimiter).length,o=n.split(D.delimiter).length;return s!==o?o-s:n.localeCompare(i)});return e},lie=(t,e)=>{let r=w.isVirtualLocator(t)?w.devirtualizeLocator(t):t,i=w.isVirtualLocator(e)?w.devirtualizeLocator(e):e;return w.areLocatorsEqual(r,i)},JYe=(t,e)=>{let r=t.getDependencyTreeRoots(),i=[],n=!1,s=new Map,o=new Map,a=t.getPackageInformation(t.topLevel);if(a===null)throw new Error("Assertion failed: Expected the top-level package to have been registered");let l=t.findPackageLocator(a.packageLocation);if(l===null)throw new Error("Assertion failed: Expected the top-level package to have a physical locator");let c=T.toPortablePath(a.packageLocation),u=Bs(l);if(e.project){let I={children:new Map},y=e.project.cwd.split(D.sep);for(let[x,F]of e.project.workspacesByCwd){let N=x.split(D.sep).slice(y.length),O=I;for(let P of N){let J=O.children.get(P);J||(J={children:new Map},O.children.set(P,J)),O=J}O.workspaceLocator={name:w.stringifyIdent(F.anchoredLocator),reference:F.anchoredLocator.reference}}let B=(x,F)=>{if(x.workspaceLocator){let N=Bs(F),O=o.get(N);O||(O=new Set,o.set(N,O)),O.add(x.workspaceLocator)}for(let N of x.children.values())B(N,x.workspaceLocator||F)};for(let x of I.children.values())B(x,I.workspaceLocator)}else for(let I of r)if(I.name!==l.name||I.reference!==l.reference){let y=o.get(u);y||(y=new Set,o.set(u,y)),y.add(I)}let g={name:l.name,identName:l.name,reference:l.reference,peerNames:a.packagePeers,dependencies:new Set},f=new Map,h=(I,y)=>`${Bs(y)}:${I}`,p=(I,y)=>{if(I.linkType!==ed.SOFT||!e.project)return!1;let B=T.toPortablePath(t.resolveVirtual&&y.reference&&y.reference.startsWith("virtual:")?t.resolveVirtual(I.packageLocation):I.packageLocation);return D.contains(e.project.cwd,B)===null},m=(I,y,B,x,F,N,O)=>{var ee,re;let P=h(I,B),J=f.get(P),oe=!!J;if(!oe&&B.name===l.name&&B.reference===l.reference&&(J=g,f.set(P,g)),J||(J={name:I,identName:B.name,reference:B.reference,dependencies:new Set,peerNames:y.packagePeers},f.set(P,J)),O&&!p(y,B)){let H=Bs({name:x.identName,reference:x.reference}),R=s.get(H)||new Set;s.set(H,R),R.add(J.name)}let K=new Map(y.packageDependencies);if(e.project){let H=e.project.workspacesByCwd.get(T.toPortablePath(y.packageLocation.slice(0,-1)));if(H){let R=new Set([...Array.from(H.manifest.peerDependencies.values(),ve=>w.stringifyIdent(ve)),...Array.from(H.manifest.peerDependenciesMeta.keys())]);for(let ve of R)K.has(ve)||(K.set(ve,F.get(ve)||null),J.peerNames.add(ve))}}let A=Bs(B),W=o.get(A);if(W)for(let H of W)K.set(`${H.name}${oB}`,H.reference);if(x.dependencies.add(J),!oe){let H=new Map;for(let[R,ve]of K)if(ve!==null){let Ne=t.getLocator(R,ve),Je=t.getLocator(R.replace(oB,""),ve),Ke=t.getPackageInformation(Je);if(Ke===null)throw new Error("Assertion failed: Expected the package to have been registered");let ie=p(Ke,Ne);if(e.validateExternalSoftLinks&&e.project&&ie){Ke.packageDependencies.size>0&&(n=!0);for(let[pe,Qe]of Ke.packageDependencies)if(Qe!==null){let Z=w.parseLocator(Array.isArray(Qe)?`${Qe[0]}@${Qe[1]}`:`${pe}@${Qe}`);if(Bs(Z)!==Bs(Ne)){let X=K.get(pe);if(X){let ae=w.parseLocator(Array.isArray(X)?`${X[0]}@${X[1]}`:`${pe}@${X}`);lie(ae,Z)||i.push({messageName:z.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK,text:`Cannot link ${w.prettyIdent(e.project.configuration,w.parseIdent(Ne.name))} into ${w.prettyLocator(e.project.configuration,w.parseLocator(`${B.name}@${B.reference}`))} dependency ${w.prettyLocator(e.project.configuration,Z)} conflicts with parent dependency ${w.prettyLocator(e.project.configuration,ae)}`})}else{let ae=H.get(pe);if(ae){let ue=ae.target,Be=w.parseLocator(Array.isArray(ue)?`${ue[0]}@${ue[1]}`:`${pe}@${ue}`);lie(Be,Z)||i.push({messageName:z.NM_CANT_INSTALL_EXTERNAL_SOFT_LINK,text:`Cannot link ${w.prettyIdent(e.project.configuration,w.parseIdent(Ne.name))} into ${w.prettyLocator(e.project.configuration,w.parseLocator(`${B.name}@${B.reference}`))} dependency ${w.prettyLocator(e.project.configuration,Z)} conflicts with dependency ${w.prettyLocator(e.project.configuration,Be)} from sibling portal ${w.prettyIdent(e.project.configuration,w.parseIdent(ae.portal.name))}`})}else H.set(pe,{target:Z.reference,portal:Ne})}}}}let ce=(ee=e.hoistingLimitsByCwd)==null?void 0:ee.get(N),Se=ie?N:D.relative(c,T.toPortablePath(Ke.packageLoc
Line truncated
|
||||
`;for(let s=0,o=t.length;s<o;++s)n+=i+aB(String(s),t[s],e,i).replace(/^ +/,""),s+1<o&&(n+=","),n+=`
|
||||
`;return n+=r,n+="]",n}function ZYe(t,e,r){let i=Object.keys(t),n="";n+="{";for(let s=0,o=i.length;s<o;++s){let a=i[s],l=t[a];typeof l!="undefined"&&(n+=JSON.stringify(a),n+=": ",n+=aB(a,l,e,r).replace(/^ +/g,""),s+1<o&&(n+=", "))}return n+="}",n}function _Ye(t,e,r){let i=Object.keys(t),n=`${r} `,s="";s+=r,s+=`{
|
||||
`;for(let o=0,a=i.length;o<a;++o){let l=i[o],c=t[l];typeof c!="undefined"&&(s+=n,s+=JSON.stringify(l),s+=": ",s+=aB(l,c,e,n).replace(/^ +/g,""),o+1<a&&(s+=","),s+=`
|
||||
`)}return s+=r,s+="}",s}function aB(t,e,r,i){let{next:n}=uie[r],s=n[t]||n["*"];return gie(e,s,i)}function gie(t,e,r){let{collapsed:i}=uie[e];return Array.isArray(t)?i?VYe(t,e,r):XYe(t,e,r):typeof t=="object"&&t!==null?i?ZYe(t,e,r):_Ye(t,e,r):JSON.stringify(t)}function fie(t){return gie(t,Dt.TOP_LEVEL,"")}function rd(t,e){let r=Array.from(t);Array.isArray(e)||(e=[e]);let i=[];for(let s of e)i.push(r.map(o=>s(o)));let n=r.map((s,o)=>o);return n.sort((s,o)=>{for(let a of i){let l=a[s]<a[o]?-1:a[s]>a[o]?1:0;if(l!==0)return l}return 0}),n.map(s=>r[s])}function $Ye(t){let e=new Map,r=rd(t.fallbackExclusionList||[],[({name:i,reference:n})=>i,({name:i,reference:n})=>n]);for(let{name:i,reference:n}of r){let s=e.get(i);typeof s=="undefined"&&e.set(i,s=new Set),s.add(n)}return Array.from(e).map(([i,n])=>[i,Array.from(n)])}function eje(t){return rd(t.fallbackPool||[],([e])=>e)}function tje(t){let e=[];for(let[r,i]of rd(t.packageRegistry,([n])=>n===null?"0":`1${n}`)){let n=[];e.push([r,n]);for(let[s,{packageLocation:o,packageDependencies:a,packagePeers:l,linkType:c,discardFromLookup:u}]of rd(i,([g])=>g===null?"0":`1${g}`)){let g=[];r!==null&&s!==null&&!a.has(r)&&g.push([r,s]);for(let[p,m]of rd(a.entries(),([I])=>I))g.push([p,m]);let f=l&&l.size>0?Array.from(l):void 0,h=u||void 0;n.push([s,{packageLocation:o,packageDependencies:g,packagePeers:f,linkType:c,discardFromLookup:h}])}}return e}function id(t){return{__info:["This file is automatically generated. Do not touch it, or risk","your modifications being lost. We also recommend you not to read","it either without using the @yarnpkg/pnp package, as the data layout","is entirely unspecified and WILL change from a version to another."],dependencyTreeRoots:t.dependencyTreeRoots,enableTopLevelFallback:t.enableTopLevelFallback||!1,ignorePatternData:t.ignorePattern||null,fallbackExclusionList:$Ye(t),fallbackPool:eje(t),packageRegistryData:tje(t)}}var die=te(pie());function Cie(t,e){return[t?`${t}
|
||||
`:"",`/* eslint-disable */
|
||||
|
||||
`,`try {
|
||||
`,` Object.freeze({}).detectStrictMode = true;
|
||||
`,`} catch (error) {
|
||||
`," throw new Error(`The whole PnP file got strict-mode-ified, which is known to break (Emscripten libraries aren't strict mode). This usually happens when the file goes through Babel.`);\n",`}
|
||||
`,`
|
||||
`,`var __non_webpack_module__ = module;
|
||||
`,`
|
||||
`,`function $$SETUP_STATE(hydrateRuntimeState, basePath) {
|
||||
`,e.replace(/^/gm," "),`}
|
||||
`,`
|
||||
`,(0,die.default)()].join("")}function rje(t){return JSON.stringify(t,null,2)}function ije(t){return[`return hydrateRuntimeState(${fie(t)}, {basePath: basePath || __dirname});
|
||||
`].join("")}function nje(t){return[`var path = require('path');
|
||||
`,`var dataLocation = path.resolve(__dirname, ${JSON.stringify(t)});
|
||||
`,`return hydrateRuntimeState(require(dataLocation), {basePath: basePath || path.dirname(dataLocation)});
|
||||
`].join("")}function mie(t){let e=id(t),r=ije(e);return Cie(t.shebang,r)}function Iie(t){let e=id(t),r=nje(t.dataLocation),i=Cie(t.shebang,r);return{dataFile:rje(e),loaderFile:i}}var wie=te(require("fs")),Aje=te(require("path")),Qie=te(require("util"));function QF(t,{basePath:e}){let r=T.toPortablePath(e),i=D.resolve(r),n=t.ignorePatternData!==null?new RegExp(t.ignorePatternData):null,s=new Map,o=new Map(t.packageRegistryData.map(([g,f])=>[g,new Map(f.map(([h,p])=>{var x;if(g===null!=(h===null))throw new Error("Assertion failed: The name and reference should be null, or neither should");let m=(x=p.discardFromLookup)!=null?x:!1,I={name:g,reference:h},y=s.get(p.packageLocation);y?(y.discardFromLookup=y.discardFromLookup&&m,m||(y.locator=I)):s.set(p.packageLocation,{locator:I,discardFromLookup:m});let B=null;return[h,{packageDependencies:new Map(p.packageDependencies),packagePeers:new Set(p.packagePeers),linkType:p.linkType,discardFromLookup:m,get packageLocation(){return B||(B=D.join(i,p.packageLocation))}}]}))])),a=new Map(t.fallbackExclusionList.map(([g,f])=>[g,new Set(f)])),l=new Map(t.fallbackPool),c=t.dependencyTreeRoots,u=t.enableTopLevelFallback;return{basePath:r,dependencyTreeRoots:c,enableTopLevelFallback:u,fallbackExclusionList:a,fallbackPool:l,ignorePattern:n,packageLocatorsByLocations:s,packageRegistry:o}}var Ru=te(require("module")),Bie=te(yie()),DF=te(require("util"));var qt;(function(l){l.API_ERROR="API_ERROR",l.BUILTIN_NODE_RESOLUTION_FAILED="BUILTIN_NODE_RESOLUTION_FAILED",l.MISSING_DEPENDENCY="MISSING_DEPENDENCY",l.MISSING_PEER_DEPENDENCY="MISSING_PEER_DEPENDENCY",l.QUALIFIED_PATH_RESOLUTION_FAILED="QUALIFIED_PATH_RESOLUTION_FAILED",l.INTERNAL="INTERNAL",l.UNDECLARED_DEPENDENCY="UNDECLARED_DEPENDENCY",l.UNSUPPORTED="UNSUPPORTED"})(qt||(qt={}));var aje=new Set([qt.BUILTIN_NODE_RESOLUTION_FAILED,qt.MISSING_DEPENDENCY,qt.MISSING_PEER_DEPENDENCY,qt.QUALIFIED_PATH_RESOLUTION_FAILED,qt.UNDECLARED_DEPENDENCY]);function Pr(t,e,r={}){let i=aje.has(t)?"MODULE_NOT_FOUND":t,n={configurable:!0,writable:!0,enumerable:!1};return Object.defineProperties(new Error(e),{code:V(v({},n),{value:i}),pnpCode:V(v({},n),{value:t}),data:V(v({},n),{value:r})})}function Ba(t){return T.normalize(T.fromPortablePath(t))}function SF(t,e){let r=Number(process.env.PNP_ALWAYS_WARN_ON_FALLBACK)>0,i=Number(process.env.PNP_DEBUG_LEVEL),n=new Set(Ru.Module.builtinModules||Object.keys(process.binding("natives"))),s=ie=>n.has(ie)||ie.startsWith("node:"),o=/^(?![a-zA-Z]:[\\/]|\\\\|\.{0,2}(?:\/|$))((?:node:)?(?:@[^/]+\/)?[^/]+)\/*(.*|)$/,a=/^(\/|\.{1,2}(\/|$))/,l=/\/$/,c=/^\.{0,2}\//,u={name:null,reference:null},g=[],f=new Set;if(t.enableTopLevelFallback===!0&&g.push(u),e.compatibilityMode!==!1)for(let ie of["react-scripts","gatsby"]){let ce=t.packageRegistry.get(ie);if(ce)for(let Se of ce.keys()){if(Se===null)throw new Error("Assertion failed: This reference shouldn't be null");g.push({name:ie,reference:Se})}}let{ignorePattern:h,packageRegistry:p,packageLocatorsByLocations:m}=t;function I(ie,ce){return{fn:ie,args:ce,error:null,result:null}}function y(ie){var pe,Qe,Z,X,ae,ue;let ce=(Z=(Qe=(pe=process.stderr)==null?void 0:pe.hasColors)==null?void 0:Qe.call(pe))!=null?Z:process.stdout.isTTY,Se=(Be,ct)=>`[${Be}m${ct}[0m`,fe=ie.error;console.error(fe?Se("31;1",`\u2716 ${(X=ie.error)==null?void 0:X.message.replace(/\n.*/s,"")}`):Se("33;1","\u203C Resolution")),ie.args.length>0&&console.error();for(let Be of ie.args)console.error(` ${Se("37;1","In \u2190")} ${(0,DF.inspect)(Be,{colors:ce,compact:!0})}`);ie.result&&(console.error(),console.error(` ${Se("37;1","Out \u2192")} ${(0,DF.inspect)(ie.result,{colors:ce,compact:!0})}`));let Ie=(ue=(ae=new Error().stack.match(/(?<=^ +)at.*/gm))==null?void 0:ae.slice(2))!=null?ue:[];if(Ie.length>0){console.error();for(let Be of Ie)console.error(` ${Se("38;5;244",Be)}`)}console.error()}function B(ie,ce){if(e.allowDebug===!1)return ce;if(Number.isFinite(i)){if(i>=2)return(...Se)=>{let fe=I(ie,Se);try{return fe.result=ce(...Se)}catch(Ie){throw fe.error=Ie}finally{y(fe)}};if(i>=1)return(...Se)=>{try{return ce(...Se)}catch(fe){let Ie=I(ie,Se);throw Ie.error=fe,y(Ie),fe}}}return ce}function x(ie){let ce=W(ie);if(!ce)throw Pr(qt.INTERNAL,"Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)");return ce}function F(ie){if(ie.name===null)return!0;for(let ce of t.dependencyTreeRoots)if(ce.name===ie.name&&ce.reference===ie.reference)return!0;return!1}function N(ie){let ce=H(D.join(ie,"internal.js"),{resolveIgnored:!0,includeDiscardFromLookup:!0});if(ce===null)throw Pr(qt.INTERNAL,`The locator that owns the "${ie}" path can't be found inside the dependency tree (this is probably an internal error)`);let{packageLocation:Se}=x(ce),fe=D.join(Se,xt.manifest);if(!e.fakeFs.existsSync(fe))return null;let Ie=JSON.parse(e.fakeFs.readFileSync(fe,"utf8")),pe=D.contains(Se,ie);if(pe===null)throw Pr(qt.INTERNAL,"unqualifiedPath doesn't contain the packageLocatLine truncated
|
||||
|
||||
Require request: "${fe}"
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie});return T.toPortablePath(Z)}let pe,Qe=ie.match(o);if(Qe){if(!ce)throw Pr(qt.API_ERROR,"The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:fe,issuer:Ie});let[,Z,X]=Qe,ae=H(ce);if(!ae){let Xt=J(ie,ce);if(Xt===!1)throw Pr(qt.BUILTIN_NODE_RESOLUTION_FAILED,`The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree).
|
||||
|
||||
Require path: "${fe}"
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie});return T.toPortablePath(Xt)}let Be=x(ae).packageDependencies.get(Z),ct=null;if(Be==null&&ae.name!==null){let Xt=t.fallbackExclusionList.get(ae.name);if(!Xt||!Xt.has(ae.reference)){for(let zn=0,_u=g.length;zn<_u;++zn){let xs=x(g[zn]).packageDependencies.get(Z);if(xs!=null){r?ct=xs:Be=xs;break}}if(t.enableTopLevelFallback&&Be==null&&ct===null){let zn=t.fallbackPool.get(Z);zn!=null&&(ct=zn)}}}let mt=null;if(Be===null)if(F(ae))mt=Pr(qt.MISSING_PEER_DEPENDENCY,`Your application tried to access ${Z} (a peer dependency); this isn't allowed as there is no ancestor to satisfy the requirement. Use a devDependency if needed.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie,dependencyName:Z});else{let Xt=re(Z,ae);Xt.every(_i=>F(_i))?mt=Pr(qt.MISSING_PEER_DEPENDENCY,`${ae.name} tried to access ${Z} (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${ae.name}@${ae.reference} (via ${Ie})
|
||||
${Xt.map(_i=>`Ancestor breaking the chain: ${_i.name}@${_i.reference}
|
||||
`).join("")}
|
||||
`,{request:fe,issuer:Ie,issuerLocator:Object.assign({},ae),dependencyName:Z,brokenAncestors:Xt}):mt=Pr(qt.MISSING_PEER_DEPENDENCY,`${ae.name} tried to access ${Z} (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${ae.name}@${ae.reference} (via ${Ie})
|
||||
|
||||
${Xt.map(_i=>`Ancestor breaking the chain: ${_i.name}@${_i.reference}
|
||||
`).join("")}
|
||||
`,{request:fe,issuer:Ie,issuerLocator:Object.assign({},ae),dependencyName:Z,brokenAncestors:Xt})}else Be===void 0&&(!Se&&s(ie)?F(ae)?mt=Pr(qt.UNDECLARED_DEPENDENCY,`Your application tried to access ${Z}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${Z} isn't otherwise declared in your dependencies, this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie,dependencyName:Z}):mt=Pr(qt.UNDECLARED_DEPENDENCY,`${ae.name} tried to access ${Z}. While this module is usually interpreted as a Node builtin, your resolver is running inside a non-Node resolution context where such builtins are ignored. Since ${Z} isn't otherwise declared in ${ae.name}'s dependencies, this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie,issuerLocator:Object.assign({},ae),dependencyName:Z}):F(ae)?mt=Pr(qt.UNDECLARED_DEPENDENCY,`Your application tried to access ${Z}, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${Ie}
|
||||
`,{request:fe,issuer:Ie,dependencyName:Z}):mt=Pr(qt.UNDECLARED_DEPENDENCY,`${ae.name} tried to access ${Z}, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
|
||||
|
||||
Required package: ${Z}${Z!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${ae.name}@${ae.reference} (via ${Ie})
|
||||
`,{request:fe,issuer:Ie,issuerLocator:Object.assign({},ae),dependencyName:Z}));if(Be==null){if(ct===null||mt===null)throw mt||new Error("Assertion failed: Expected an error to have been set");Be=ct;let Xt=mt.message.replace(/\n.*/g,"");mt.message=Xt,!f.has(Xt)&&i!==0&&(f.add(Xt),process.emitWarning(mt))}let St=Array.isArray(Be)?{name:Be[0],reference:Be[1]}:{name:Z,reference:Be},xn=x(St);if(!xn.packageLocation)throw Pr(qt.MISSING_DEPENDENCY,`A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.
|
||||
|
||||
Required package: ${St.name}@${St.reference}${St.name!==fe?` (via "${fe}")`:""}
|
||||
Required by: ${ae.name}@${ae.reference} (via ${Ie})
|
||||
`,{request:fe,issuer:Ie,dependencyLocator:Object.assign({},St)});let Ii=xn.packageLocation;X?pe=D.join(Ii,X):pe=Ii}else if(D.isAbsolute(ie))pe=D.normalize(ie);else{if(!ce)throw Pr(qt.API_ERROR,"The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute",{request:fe,issuer:Ie});let Z=D.resolve(ce);ce.match(l)?pe=D.normalize(D.join(Z,ie)):pe=D.normalize(D.join(D.dirname(Z),ie))}return D.normalize(pe)}function ve(ie,ce){if(a.test(ie))return ce;let Se=N(ce);return Se?D.normalize(Se):ce}function Ne(ie,{extensions:ce=Object.keys(Ru.Module._extensions)}={}){let Se=[],fe=O(ie,Se,{extensions:ce});if(fe)return D.normalize(fe);{let Ie=Ba(ie),pe=H(ie);if(pe){let{packageLocation:Qe}=x(pe);if(!e.fakeFs.existsSync(Qe)){let Z=Qe.includes("/unplugged/")?"Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).":"Required package missing from disk. If you keep your packages inside your repository then restarting the Node process may be enough. Otherwise, try to run an install first.";throw Pr(qt.QUALIFIED_PATH_RESOLUTION_FAILED,`${Z}
|
||||
|
||||
Missing package: ${pe.name}@${pe.reference}
|
||||
Expected package location: ${Ba(Qe)}
|
||||
`,{unqualifiedPath:Ie})}}throw Pr(qt.QUALIFIED_PATH_RESOLUTION_FAILED,`Qualified path resolution failed - none of those files can be found on the disk.
|
||||
|
||||
Source path: ${Ie}
|
||||
${Se.map(Qe=>`Not found: ${Ba(Qe)}
|
||||
`).join("")}`,{unqualifiedPath:Ie})}}function Je(ie,ce,{considerBuiltins:Se,extensions:fe}={}){let Ie=R(ie,ce,{considerBuiltins:Se});if(Ie===null)return null;let pe=()=>ce!==null?oe(ce):!1,Qe=(!Se||!s(ie))&&!pe()?ve(ie,Ie):Ie;try{return Ne(Qe,{extensions:fe})}catch(Z){throw Z.pnpCode==="QUALIFIED_PATH_RESOLUTION_FAILED"&&Object.assign(Z.data,{request:Ba(ie),issuer:ce&&Ba(ce)}),Z}}function Ke(ie){let ce=D.normalize(ie),Se=ir.resolveVirtual(ce);return Se!==ce?Se:null}return{VERSIONS:K,topLevel:A,getLocator:(ie,ce)=>Array.isArray(ce)?{name:ce[0],reference:ce[1]}:{name:ie,reference:ce},getDependencyTreeRoots:()=>[...t.dependencyTreeRoots],getAllLocators(){let ie=[];for(let[ce,Se]of p)for(let fe of Se.keys())ce!==null&&fe!==null&&ie.push({name:ce,reference:fe});return ie},getPackageInformation:ie=>{let ce=W(ie);if(ce===null)return null;let Se=T.fromPortablePath(ce.packageLocation);return V(v({},ce),{packageLocation:Se})},findPackageLocator:ie=>H(T.toPortablePath(ie)),resolveToUnqualified:B("resolveToUnqualified",(ie,ce,Se)=>{let fe=ce!==null?T.toPortablePath(ce):null,Ie=R(T.toPortablePath(ie),fe,Se);return Ie===null?null:T.fromPortablePath(Ie)}),resolveUnqualified:B("resolveUnqualified",(ie,ce)=>T.fromPortablePath(Ne(T.toPortablePath(ie),ce))),resolveRequest:B("resolveRequest",(ie,ce,Se)=>{let fe=ce!==null?T.toPortablePath(ce):null,Ie=Je(T.toPortablePath(ie),fe,Se);return Ie===null?null:T.fromPortablePath(Ie)}),resolveVirtual:B("resolveVirtual",ie=>{let ce=Ke(T.toPortablePath(ie));return ce!==null?T.fromPortablePath(ce):null})}}var dCt=(0,Qie.promisify)(wie.readFile);var bie=(t,e,r)=>{let i=id(t),n=QF(i,{basePath:e}),s=T.join(e,xt.pnpCjs);return SF(n,{fakeFs:r,pnpapiResolution:s})};var wa={};et(wa,{checkAndReportManifestCompatibility:()=>Die,extractBuildScripts:()=>AB,getExtractHint:()=>xF,hasBindingGyp:()=>kF});function Die(t,e,r,{configuration:i,report:n}){return ze.isManifestFieldCompatible(e.manifest.os,process.platform)?ze.isManifestFieldCompatible(e.manifest.cpu,process.arch)?!0:(n==null||n.reportWarningOnce(z.INCOMPATIBLE_CPU,`${w.prettyLocator(i,t)} The CPU architecture ${process.arch} is incompatible with this module, ${r} skipped.`),!1):(n==null||n.reportWarningOnce(z.INCOMPATIBLE_OS,`${w.prettyLocator(i,t)} The platform ${process.platform} is incompatible with this module, ${r} skipped.`),!1)}function AB(t,e,r,{configuration:i,report:n}){let s=[];for(let a of["preinstall","install","postinstall"])e.manifest.scripts.has(a)&&s.push([Vi.SCRIPT,a]);return!e.manifest.scripts.has("install")&&e.misc.hasBindingGyp&&s.push([Vi.SHELLCODE,"node-gyp rebuild"]),s.length===0?[]:t.linkType!==lt.HARD?(n==null||n.reportWarningOnce(z.SOFT_LINK_BUILD,`${w.prettyLocator(i,t)} lists build scripts, but is referenced through a soft link. Soft links don't support build scripts, so they'll be ignored.`),[]):r&&r.built===!1?(n==null||n.reportInfoOnce(z.BUILD_DISABLED,`${w.prettyLocator(i,t)} lists build scripts, but its build has been explicitly disabled through configuration.`),[]):!i.get("enableScripts")&&!r.built?(n==null||n.reportWarningOnce(z.DISABLED_BUILD_SCRIPTS,`${w.prettyLocator(i,t)} lists build scripts, but all build scripts have been disabled.`),[]):Die(t,e,"build",{configuration:i,report:n})?s:[]}var lje=new Set([".exe",".h",".hh",".hpp",".c",".cc",".cpp",".java",".jar",".node"]);function xF(t){return t.packageFs.getExtractHint({relevantExtensions:lje})}function kF(t){let e=D.join(t.prefixPath,"binding.gyp");return t.packageFs.existsSync(e)}var vF={};et(vF,{getUnpluggedPath:()=>nd});function nd(t,{configuration:e}){return D.resolve(e.get("pnpUnpluggedFolder"),w.slugifyLocator(t))}var cje=new Set([w.makeIdent(null,"nan").identHash,w.makeIdent(null,"node-gyp").identHash,w.makeIdent(null,"node-pre-gyp").identHash,w.makeIdent(null,"node-addon-api").identHash,w.makeIdent(null,"fsevents").identHash]),fl=class{constructor(){this.mode="strict";this.pnpCache=new Map}supportsPackage(e,r){return!(r.project.configuration.get("nodeLinker")!=="pnp"||r.project.configuration.get("pnpMode")!==this.mode)}async findPackageLocation(e,r){let i=Qa(r.project).cjs;if(!L.existsSync(i))throw new me(`The project in ${Ae.pretty(r.project.configuration,`${r.project.cwd}/package.json`,Ae.Type.PATH)} doesn't seem to have been installed - running an install there might help`);let n=de.getFactoryWithDefault(this.pnpCache,i,()=>de.dynamicRequire(i,{cachingStrategy:de.CachingStrategy.FsTime})),s={name:w.stringifyIdent(e),reference:e.reference},o=n.getPackageInformation(s);if(!o)throw new me(`Couldn't find ${w.prettyLocator(r.project.configuration,e)} in the currently installed PnP map - running an install might help`);return T.toPortablePath(o.packageLocation)}async findPackageLocator(e,r){let i=Qa(r.project).cjs;if(!L.existsSync(i))return null;let s=de.getFactoryWithDefault(this.pnpCache,i,()=>de.dynamicRequire(i,{cachingStrategy:de.CachingStrategy.FsTime})).findPackageLocator(T.fromPortablePath(e));return s?w.makeLocator(w.parseIdent(s.name),s.Line truncated
|
||||
`,n+=`# cause your node_modules installation to become invalidated.
|
||||
`,n+=`
|
||||
`,n+=`__metadata:
|
||||
`,n+=` version: ${Oie}
|
||||
`,n+=` nmMode: ${i}
|
||||
`;let s=Array.from(e.keys()).sort(),o=w.stringifyLocator(t.topLevelWorkspace.anchoredLocator);for(let c of s){let u=e.get(c);n+=`
|
||||
`,n+=`${JSON.stringify(c)}:
|
||||
`,n+=` locations:
|
||||
`;for(let g of u.locations){let f=D.contains(t.cwd,g);if(f===null)throw new Error(`Assertion failed: Expected the path to be within the project (${g})`);n+=` - ${JSON.stringify(f)}
|
||||
`}if(u.aliases.length>0){n+=` aliases:
|
||||
`;for(let g of u.aliases)n+=` - ${JSON.stringify(g)}
|
||||
`}if(c===o&&r.size>0){n+=` bin:
|
||||
`;for(let[g,f]of r){let h=D.contains(t.cwd,g);if(h===null)throw new Error(`Assertion failed: Expected the path to be within the project (${g})`);n+=` ${JSON.stringify(h)}:
|
||||
`;for(let[p,m]of f){let I=D.relative(D.join(g,Fr),m);n+=` ${JSON.stringify(p)}: ${JSON.stringify(I)}
|
||||
`}}}}let a=t.cwd,l=D.join(a,Fr,Kie);await L.changeFilePromise(l,n,{automaticNewlines:!0})}async function UF(t,{unrollAliases:e=!1}={}){let r=t.cwd,i=D.join(r,Fr,Kie);if(!L.existsSync(i))return null;let n=Kr(await L.readFilePromise(i,"utf8"));if(n.__metadata.version>Oie)return null;let s=n.__metadata.nmMode||Ti.CLASSIC,o=new Map,a=new Map;delete n.__metadata;for(let[l,c]of Object.entries(n)){let u=c.locations.map(f=>D.join(r,f)),g=c.bin;if(g)for(let[f,h]of Object.entries(g)){let p=D.join(r,T.toPortablePath(f)),m=de.getMapWithDefault(a,p);for(let[I,y]of Object.entries(h))m.set(rr(I),T.toPortablePath([p,Fr,y].join(D.delimiter)))}if(o.set(l,{target:we.dot,linkType:lt.HARD,locations:u,aliases:c.aliases||[]}),e&&c.aliases)for(let f of c.aliases){let{scope:h,name:p}=w.parseLocator(l),m=w.makeLocator(w.makeIdent(h,p),f),I=w.stringifyLocator(m);o.set(I,{target:we.dot,linkType:lt.HARD,locations:u,aliases:[]})}}return{locatorMap:o,binSymlinks:a,locationTree:Yie(o,{skipPrefix:t.cwd}),nmMode:s}}var Mu=async(t,e)=>{if(t.split(D.sep).indexOf(Fr)<0)throw new Error(`Assertion failed: trying to remove dir that doesn't contain node_modules: ${t}`);try{if(!e.innerLoop&&(await L.lstatPromise(t)).isSymbolicLink()){await L.unlinkPromise(t);return}let r=await L.readdirPromise(t,{withFileTypes:!0});for(let i of r){let n=D.join(t,rr(i.name));i.isDirectory()?(i.name!==Fr||e&&e.innerLoop)&&await Mu(n,{innerLoop:!0,contentsOnly:!1}):await L.unlinkPromise(n)}e.contentsOnly||await L.rmdirPromise(t)}catch(r){if(r.code!=="ENOENT"&&r.code!=="ENOTEMPTY")throw r}},jie=4,lB=(t,{skipPrefix:e})=>{let r=D.contains(e,t);if(r===null)throw new Error(`Assertion failed: Writing attempt prevented to ${t} which is outside project root: ${e}`);let i=r.split(D.sep).filter(l=>l!==""),n=i.indexOf(Fr),s=i.slice(0,n).join(D.sep),o=D.join(e,s),a=i.slice(n);return{locationRoot:o,segments:a}},Yie=(t,{skipPrefix:e})=>{let r=new Map;if(t===null)return r;let i=()=>({children:new Map,linkType:lt.HARD});for(let[n,s]of t.entries()){if(s.linkType===lt.SOFT&&D.contains(e,s.target)!==null){let a=de.getFactoryWithDefault(r,s.target,i);a.locator=n,a.linkType=s.linkType}for(let o of s.locations){let{locationRoot:a,segments:l}=lB(o,{skipPrefix:e}),c=de.getFactoryWithDefault(r,a,i);for(let u=0;u<l.length;++u){let g=l[u];if(g!=="."){let f=de.getFactoryWithDefault(c.children,g,i);c.children.set(g,f),c=f}u===l.length-1&&(c.locator=n,c.linkType=s.linkType)}}}return r},HF=async(t,e)=>{let r;try{process.platform==="win32"&&(r=await L.lstatPromise(t))}catch(i){}process.platform=="win32"&&(!r||r.isDirectory())?await L.symlinkPromise(t,e,"junction"):await L.symlinkPromise(D.relative(D.dirname(e),t),e)};async function Gie(t,e,r){let i=D.join(t,rr(`${TF.default.randomBytes(16).toString("hex")}.tmp`));try{await L.writeFilePromise(i,r);try{await L.linkPromise(i,e)}catch(n){}}finally{await L.unlinkPromise(i)}}async function Lje({srcPath:t,dstPath:e,srcMode:r,globalHardlinksStore:i,baseFs:n,nmMode:s,digest:o}){if(s===Ti.HARDLINKS_GLOBAL&&i&&o){let l=D.join(i,o.substring(0,2),`${o.substring(2)}.dat`),c;try{if(await Di.checksumFile(l,{baseFs:L,algorithm:"sha1"})!==o){let g=D.join(i,rr(`${TF.default.randomBytes(16).toString("hex")}.tmp`));await L.renamePromise(l,g);let f=await n.readFilePromise(t);await L.writeFilePromise(g,f);try{await L.linkPromise(g,l),await L.unlinkPromise(g)}catch(h){}}await L.linkPromise(l,e),c=!0}catch(u){c=!1}if(!c){let u=await n.readFilePromise(t);await Gie(i,l,u),await L.linkPromise(l,e)}}else await n.copyFilePromise(t,e);let a=r&511;a!==420&&await L.chmodPromise(e,a)}var ba;(function(i){i.FILE="file",i.DIRECTORY="directory",i.SYMLINK="symlink"})(ba||(ba={}));var Mje=async(t,e,{baseFs:r,globalHardlinksStore:i,nmMode:n,packageChecksum:s})=>{await L.mkdirPromise(t,{recursive:!0});let o=async(l=we.dot)=>{let c=D.join(e,l),u=await r.readdirPromise(c,{withFileTypes:!0}),g=new Map;for(let f of u){let h=D.join(l,f.name),p,m=D.join(c,f.name);if(f.isFile()){if(p={kind:ba.FILE,mode:(await r.lstatPromise(m)).mode},n===Ti.HARDLINKS_GLOBAL){let I=await Di.checksumFile(m,{baseFs:r,algorithm:"sha1"});p.digest=I}}else if(f.isDirectory())p={kind:ba.DIRECTORY};else if(f.isSymbolicLink())p={kind:ba.SYMLINK,symlinkTo:await r.readlinkPromise(m)};else throw new Error(`Unsupported file type (file: ${m}, mode: 0o${await r.statSync(m).mode.toString(8).padStart(6,"0")})`);if(g.set(h,p),f.isDirectory()&&h!==Fr){let I=await o(h);for(let[y,B]of I)g.set(y,B)}}return g},a;if(n===Ti.HARDLINKS_GLOBAL&&i&&s){let l=D.join(i,s.substring(0,2),`${s.substring(2)}.json`);try{a=new Map(Object.entries(JSON.parse(await L.readFilePromise(l,"utf8"))))}catch(c){a=await o(),await Gie(i,l,Buffer.from(JSON.stringify(Object.fromEntries(a))))}}else a=await o();for(let[l,c]of a){let u=D.join(e,l),g=D.join(t,l);c.kind===ba.DIRECTORY?await L.mkdirPromise(g,{recursive:!0}):c.kind===ba.FILE?await Lje({srcPath:u,dstPath:g,srcMode:c.mode,digest:c.digest,nmMode:n,baseFs:r,globalHardlinksStore:i}):c.kind===ba.SYMLINK&&await
Line truncated
|
||||
This command checks for known security reports on the packages you use. The reports are by default extracted from the npm registry, and may or may not be relevant to your actual program (not all vulnerabilities affect all code paths).
|
||||
|
||||
For consistency with our other commands the default is to only check the direct dependencies for the active workspace. To extend this search to all workspaces, use \`-A,--all\`. To extend this search to both direct and transitive dependencies, use \`-R,--recursive\`.
|
||||
|
||||
Applying the \`--severity\` flag will limit the audit table to vulnerabilities of the corresponding severity and above. Valid values are ${MB.map(e=>`\`${e}\``).join(", ")}.
|
||||
|
||||
If the \`--json\` flag is set, Yarn will print the output exactly as received from the registry. Regardless of this flag, the process will exit with a non-zero exit code if a report is found for the selected packages.
|
||||
|
||||
To understand the dependency tree requiring vulnerable packages, check the raw report with the \`--json\` flag or use \`yarn why <package>\` to get more information as to who depends on them.
|
||||
`,examples:[["Checks for known security issues with the installed packages. The output is a list of known issues.","yarn npm audit"],["Audit dependencies in all workspaces","yarn npm audit --all"],["Limit auditing to `dependencies` (excludes `devDependencies`)","yarn npm audit --environment production"],["Show audit report as valid JSON","yarn npm audit --json"],["Audit all direct and transitive dependencies","yarn npm audit --recursive"],["Output moderate (or more severe) vulnerabilities","yarn npm audit --severity moderate"]]});var Xse=wd;var Zse=te(require("path")),VR=te(cr()),XR=te(require("util")),Qd=class extends ye{constructor(){super(...arguments);this.fields=j.String("-f,--fields",{description:"A comma-separated list of manifest fields that should be displayed"});this.json=j.Boolean("--json",!1,{description:"Format the output as an NDJSON stream"});this.packages=j.Rest()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r}=await Fe.find(e,this.context.cwd),i=typeof this.fields!="undefined"?new Set(["name",...this.fields.split(/\s*,\s*/)]):null,n=[],s=!1,o=await xe.start({configuration:e,includeFooter:!1,json:this.json,stdout:this.context.stdout},async a=>{for(let l of this.packages){let c;if(l==="."){let x=r.topLevelWorkspace;if(!x.manifest.name)throw new me(`Missing 'name' field in ${Zse.default.join(x.cwd,"package.json")}`);c=w.makeDescriptor(x.manifest.name,"unknown")}else c=w.parseDescriptor(l);let u=Bt.getIdentUrl(c),g=ZR(await Bt.get(u,{configuration:e,ident:c,jsonResponse:!0,customErrorMessage:Bt.customPackageError})),f=Object.keys(g.versions).sort(VR.default.compareLoose),p=g["dist-tags"].latest||f[f.length-1],m=vt.validRange(c.range);if(m){let x=VR.default.maxSatisfying(f,m);x!==null?p=x:(a.reportWarning(z.UNNAMED,`Unmet range ${w.prettyRange(e,c.range)}; falling back to the latest version`),s=!0)}else c.range!=="unknown"&&(a.reportWarning(z.UNNAMED,`Invalid range ${w.prettyRange(e,c.range)}; falling back to the latest version`),s=!0);let I=g.versions[p],y=V(v(v({},g),I),{version:p,versions:f}),B;if(i!==null){B={};for(let x of i){let F=y[x];if(typeof F!="undefined")B[x]=F;else{a.reportWarning(z.EXCEPTION,`The '${x}' field doesn't exist inside ${w.prettyIdent(e,c)}'s informations`),s=!0;continue}}}else this.json||(delete y.dist,delete y.readme,delete y.users),B=y;a.reportJson(B),this.json||n.push(B)}});XR.inspect.styles.name="cyan";for(let a of n)(a!==n[0]||s)&&this.context.stdout.write(`
|
||||
`),this.context.stdout.write(`${(0,XR.inspect)(a,{depth:Infinity,colors:!0,compact:!1})}
|
||||
`);return o.exitCode()}};Qd.paths=[["npm","info"]],Qd.usage=he.Usage({category:"Npm-related commands",description:"show information about a package",details:"\n This command will fetch information about a package from the npm registry, and prints it in a tree format.\n\n The package does not have to be installed locally, but needs to have been published (in particular, local changes will be ignored even for workspaces).\n\n Append `@<range>` to the package argument to provide information specific to the latest version that satisfies the range. If the range is invalid or if there is no version satisfying the range, the command will print a warning and fall back to the latest version.\n\n If the `-f,--fields` option is set, it's a comma-separated list of fields which will be used to only display part of the package informations.\n\n By default, this command won't return the `dist`, `readme`, and `users` fields, since they are often very long. To explicitly request those fields, explicitly list them with the `--fields` flag or request the output in JSON mode.\n ",examples:[["Show all available information about react (except the `dist`, `readme`, and `users` fields)","yarn npm info react"],["Show all available information about react as valid JSON (including the `dist`, `readme`, and `users` fields)","yarn npm info react --json"],["Show all available information about react 16.12.0","yarn npm info [email protected]"],["Show the description of react","yarn npm info react --fields description"],["Show all available versions of react","yarn npm info react --fields versions"],["Show the readme of react","yarn npm info react --fields readme"],["Show a few fields of react","yarn npm info react --fields homepage,repository"]]});var _se=Qd;function ZR(t){if(Array.isArray(t)){let e=[];for(let r of t)r=ZR(r),r&&e.push(r);return e}else if(typeof t=="object"&&t!==null){let e={};for(let r of Object.keys(t)){if(r.startsWith("_"))continue;let i=ZR(t[r]);i&&(e[r]=i)}return e}else return t||null}var $se=te(up()),bd=class extends ye{constructor(){super(...arguments);this.scope=j.String("-s,--scope",{description:"Login to the registry configured for a given scope"});this.publish=j.Boolean("--publish",!1,{description:"Login to the publish registry"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r=await TB({configuration:e,cwd:this.context.cwd,publish:this.publish,scope:this.scope});return(await xe.start({configuration:e,stdout:this.context.stdout},async n=>{let s=await $Je({registry:r,report:n,stdin:this.context.stdin,stdout:this.context.stdout}),o=`/-/user/org.couchdb.user:${encodeURIComponent(s.name)}`,a=await Bt.put(o,s,{attemptedAs:s.name,configuration:e,registry:r,jsonResponse:!0,authType:Bt.AuthType.NO_AUTH});return await _Je(r,a.token,{configuration:e,scope:this.scope}),n.reportInfo(z.UNNAMED,"Successfully logged in")})).exitCode()}};bd.paths=[["npm","login"]],bd.usage=he.Usage({category:"Npm-related commands",description:"store new login info to access the npm registry",details:"\n This command will ask you for your username, password, and 2FA One-Time-Password (when it applies). It will then modify your local configuration (in your home folder, never in the project itself) to reference the new tokens thus generated.\n\n Adding the `-s,--scope` flag will cause the authentication to be done against whatever registry is configured for the associated scope (see also `npmScopes`).\n\n Adding the `--publish` flag will cause the authentication to be done against the registry used when publishing the package (see also `publishConfig.registry` and `npmPublishRegistry`).\n ",examples:[["Login to the default registry","yarn npm login"],["Login to the registry linked to the @my-scope registry","yarn npm login --scope my-scope"],["Login to the publish registry for the current package","yarn npm login --publish"]]});var eoe=bd;async function TB({scope:t,publish:e,configuration:r,cwd:i}){return t&&e?Jt.getScopeRegistry(t,{configuration:r,type:Jt.RegistryType.PUBLISH_REGISTRY}):t?Jt.getScopeRegistry(t,{configuration:r}):e?Jt.getPublishRegistry((await yu(r,i)).manifest,{configuration:r}):Jt.getDefaultRegistry({configuration:r})}async function _Je(t,e,{configuration:r,scope:i}){let n=o=>a=>{let l=de.isIndexableObject(a)?a:{},c=l[o],u=de.isIndexableObject(c)?c:{};return V(v({},l),{[o]:V(v({},u),{npmAuthToken:e})})},s=i?{npmScopes:n(i)}:{npmRegistries:n(t)};return await le.updateHomeConfiguration(s)}async function $Je({registry:t,report:e,stdin:r,stdout:i}){if(process.env.TEST_ENV)return{name:process.env.TEST_NPM_USER||"",password:process.env.TEST_NPM_PASSWORD||""};e.reportInfo(z.UNNAMED,`Logging in to ${t}`);let n=!1;t.match(/^https:\/\/npm\.pkg\.github\.com(\/|$)/)&&(e.reportInfo(z.UNNAMED,"You seem to be using the GitHub Package Registry. Tokens must be generated with the 'repo', 'write:packages', and 'read:packages' permissions."),n=!0),e.reportSeparator();let{userLine truncated
|
||||
This command will list all tags of a package from the npm registry.
|
||||
|
||||
If the package is not specified, Yarn will default to the current workspace.
|
||||
`,examples:[["List all tags of package `my-pkg`","yarn npm tag list my-pkg"]]});var noe=xd;async function kd(t,e){let r=`/-/package${Bt.getIdentUrl(t)}/dist-tags`;return Bt.get(r,{configuration:e,ident:t,jsonResponse:!0,customErrorMessage:Bt.customPackageError})}var vd=class extends ye{constructor(){super(...arguments);this.package=j.String();this.tag=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);let n=w.parseDescriptor(this.package,!0),s=n.range;if(!soe.default.valid(s))throw new me(`The range ${Ae.pretty(e,n.range,Ae.Type.RANGE)} must be a valid semver version`);let o=Jt.getPublishRegistry(i.manifest,{configuration:e}),a=Ae.pretty(e,n,Ae.Type.IDENT),l=Ae.pretty(e,s,Ae.Type.RANGE),c=Ae.pretty(e,this.tag,Ae.Type.CODE);return(await xe.start({configuration:e,stdout:this.context.stdout},async g=>{let f=await kd(n,e);Object.prototype.hasOwnProperty.call(f,this.tag)&&f[this.tag]===s&&g.reportWarning(z.UNNAMED,`Tag ${c} is already set to version ${l}`);let h=`/-/package${Bt.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await Bt.put(h,s,{configuration:e,registry:o,ident:n,jsonRequest:!0,jsonResponse:!0}),g.reportInfo(z.UNNAMED,`Tag ${c} added to version ${l} of package ${a}`)})).exitCode()}};vd.paths=[["npm","tag","add"]],vd.usage=he.Usage({category:"Npm-related commands",description:"add a tag for a specific version of a package",details:`
|
||||
This command will add a tag to the npm registry for a specific version of a package. If the tag already exists, it will be overwritten.
|
||||
`,examples:[["Add a `beta` tag for version `2.3.4-beta.4` of package `my-pkg`","yarn npm tag add [email protected] beta"]]});var ooe=vd;var Pd=class extends ye{constructor(){super(...arguments);this.package=j.String();this.tag=j.String()}async execute(){if(this.tag==="latest")throw new me("The 'latest' tag cannot be removed.");let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);let n=w.parseIdent(this.package),s=Jt.getPublishRegistry(i.manifest,{configuration:e}),o=Ae.pretty(e,this.tag,Ae.Type.CODE),a=Ae.pretty(e,n,Ae.Type.IDENT),l=await kd(n,e);if(!Object.prototype.hasOwnProperty.call(l,this.tag))throw new me(`${o} is not a tag of package ${a}`);return(await xe.start({configuration:e,stdout:this.context.stdout},async u=>{let g=`/-/package${Bt.getIdentUrl(n)}/dist-tags/${encodeURIComponent(this.tag)}`;await Bt.del(g,{configuration:e,registry:s,ident:n,jsonResponse:!0}),u.reportInfo(z.UNNAMED,`Tag ${o} removed from package ${a}`)})).exitCode()}};Pd.paths=[["npm","tag","remove"]],Pd.usage=he.Usage({category:"Npm-related commands",description:"remove a tag from a package",details:`
|
||||
This command will remove a tag from a package from the npm registry.
|
||||
`,examples:[["Remove the `beta` tag from package `my-pkg`","yarn npm tag remove my-pkg beta"]]});var aoe=Pd;var Fd=class extends ye{constructor(){super(...arguments);this.scope=j.String("-s,--scope",{description:"Print username for the registry configured for a given scope"});this.publish=j.Boolean("--publish",!1,{description:"Print username for the publish registry"})}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),r;return this.scope&&this.publish?r=Jt.getScopeRegistry(this.scope,{configuration:e,type:Jt.RegistryType.PUBLISH_REGISTRY}):this.scope?r=Jt.getScopeRegistry(this.scope,{configuration:e}):this.publish?r=Jt.getPublishRegistry((await yu(e,this.context.cwd)).manifest,{configuration:e}):r=Jt.getDefaultRegistry({configuration:e}),(await xe.start({configuration:e,stdout:this.context.stdout},async n=>{var o,a;let s;try{s=await Bt.get("/-/whoami",{configuration:e,registry:r,authType:Bt.AuthType.ALWAYS_AUTH,jsonResponse:!0,ident:this.scope?w.makeIdent(this.scope,""):void 0})}catch(l){if(((o=l.response)==null?void 0:o.statusCode)===401||((a=l.response)==null?void 0:a.statusCode)===403){n.reportError(z.AUTHENTICATION_INVALID,"Authentication failed - your credentials may have expired");return}else throw l}n.reportInfo(z.UNNAMED,s.username)})).exitCode()}};Fd.paths=[["npm","whoami"]],Fd.usage=he.Usage({category:"Npm-related commands",description:"display the name of the authenticated user",details:"\n Print the username associated with the current authentication settings to the standard output.\n\n When using `-s,--scope`, the username printed will be the one that matches the authentication settings of the registry associated with the given scope (those settings can be overriden using the `npmRegistries` map, and the registry associated with the scope is configured via the `npmScopes` map).\n\n When using `--publish`, the registry we'll select will by default be the one used when publishing packages (`publishConfig.registry` or `npmPublishRegistry` if available, otherwise we'll fallback to the regular `npmRegistryServer`).\n ",examples:[["Print username for the default registry","yarn npm whoami"],["Print username for the registry on a given scope","yarn npm whoami --scope company"]]});var Aoe=Fd;var rWe={configuration:{npmPublishAccess:{description:"Default access of the published packages",type:ge.STRING,default:null}},commands:[Xse,_se,eoe,roe,ioe,ooe,noe,aoe,Aoe]},iWe=rWe;var oN={};et(oN,{default:()=>IWe,patchUtils:()=>$R});var $R={};et($R,{applyPatchFile:()=>HB,diffFolders:()=>iN,extractPackageToDisk:()=>rN,extractPatchFlags:()=>doe,isParentRequired:()=>tN,loadPatchFiles:()=>Md,makeDescriptor:()=>dWe,makeLocator:()=>eN,parseDescriptor:()=>Nd,parseLocator:()=>Ld,parsePatchFile:()=>KB});var Rd=class extends Error{constructor(e,r){super(`Cannot apply hunk #${e+1}`);this.hunk=r}};var nWe=/^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))? @@.*/;function Xu(t){return D.relative(we.root,D.resolve(we.root,T.toPortablePath(t)))}function sWe(t){let e=t.trim().match(nWe);if(!e)throw new Error(`Bad header line: '${t}'`);return{original:{start:Math.max(Number(e[1]),1),length:Number(e[3]||1)},patched:{start:Math.max(Number(e[4]),1),length:Number(e[6]||1)}}}var oWe=420,aWe=493,Ar;(function(i){i.Context="context",i.Insertion="insertion",i.Deletion="deletion"})(Ar||(Ar={}));var loe=()=>({semverExclusivity:null,diffLineFromPath:null,diffLineToPath:null,oldMode:null,newMode:null,deletedFileMode:null,newFileMode:null,renameFrom:null,renameTo:null,beforeHash:null,afterHash:null,fromPath:null,toPath:null,hunks:null}),AWe=t=>({header:sWe(t),parts:[]}),lWe={["@"]:"header",["-"]:Ar.Deletion,["+"]:Ar.Insertion,[" "]:Ar.Context,["\\"]:"pragma",undefined:Ar.Context};function uWe(t){let e=[],r=loe(),i="parsing header",n=null,s=null;function o(){n&&(s&&(n.parts.push(s),s=null),r.hunks.push(n),n=null)}function a(){o(),e.push(r),r=loe()}for(let l=0;l<t.length;l++){let c=t[l];if(i==="parsing header")if(c.startsWith("@@"))i="parsing hunks",r.hunks=[],l-=1;else if(c.startsWith("diff --git ")){r&&r.diffLineFromPath&&a();let u=c.match(/^diff --git a\/(.*?) b\/(.*?)\s*$/);if(!u)throw new Error(`Bad diff line: ${c}`);r.diffLineFromPath=u[1],r.diffLineToPath=u[2]}else if(c.startsWith("old mode "))r.oldMode=c.slice("old mode ".length).trim();else if(c.startsWith("new mode "))r.newMode=c.slice("new mode ".length).trim();else if(c.startsWith("deleted file mode "))r.deletedFileMode=c.slice("deleted file mode ".length).trim();else if(c.startsWith("new file mode "))r.newFileMode=c.slice("new file mode ".length).trim();else if(c.startsWith("rename from "))r.renameFrom=c.slice("rename from ".length).trim();else if(c.startsWith("rename to "))r.renameTo=c.slice("rename to ".length).trim();else if(c.startsWith("index ")){let u=c.match(/(\w+)\.\.(\w+)/);if(!u)continue;r.beforeHash=u[1],r.afterHash=u[2]}else c.startsWith("semver exclusivity ")?r.semverExclusivity=c.slice("semver exclusivity ".length).trim():c.startsWith
Line truncated
|
||||
`)+(n.hunk.parts[0].noNewlineAtEndOfFile?"":`
|
||||
`):"";await e.mkdirpPromise(D.dirname(n.path),{chmod:493,utimes:[UB,UB]}),await e.writeFilePromise(n.path,s,{mode:n.mode}),await e.utimesPromise(n.path,UB,UB)}break;case"patch":await Zu(e,n.path,async()=>{await fWe(n,{baseFs:e,dryRun:r})});break;case"mode change":{let o=(await e.statPromise(n.path)).mode;if(coe(n.newMode)!==coe(o))continue;await Zu(e,n.path,async()=>{await e.chmodPromise(n.path,n.newMode)})}break;default:de.assertNever(n);break}}function coe(t){return(t&64)>0}function uoe(t){return t.replace(/\s+$/,"")}function hWe(t,e){return uoe(t)===uoe(e)}async function fWe({hunks:t,path:e},{baseFs:r,dryRun:i=!1}){let n=await r.statSync(e).mode,o=(await r.readFileSync(e,"utf8")).split(/\n/),a=[],l=0,c=0;for(let g of t){let f=Math.max(c,g.header.patched.start+l),h=Math.max(0,f-c),p=Math.max(0,o.length-f-g.header.original.length),m=Math.max(h,p),I=0,y=0,B=null;for(;I<=m;){if(I<=h&&(y=f-I,B=goe(g,o,y),B!==null)){I=-I;break}if(I<=p&&(y=f+I,B=goe(g,o,y),B!==null))break;I+=1}if(B===null)throw new Rd(t.indexOf(g),g);a.push(B),l+=I,c=y+g.header.original.length}if(i)return;let u=0;for(let g of a)for(let f of g)switch(f.type){case"splice":{let h=f.index+u;o.splice(h,f.numToDelete,...f.linesToInsert),u+=f.linesToInsert.length-f.numToDelete}break;case"pop":o.pop();break;case"push":o.push(f.line);break;default:de.assertNever(f);break}await r.writeFilePromise(e,o.join(`
|
||||
`),{mode:n})}function goe(t,e,r){let i=[];for(let n of t.parts)switch(n.type){case Ar.Context:case Ar.Deletion:{for(let s of n.lines){let o=e[r];if(o==null||!hWe(o,s))return null;r+=1}n.type===Ar.Deletion&&(i.push({type:"splice",index:r-n.lines.length,numToDelete:n.lines.length,linesToInsert:[]}),n.noNewlineAtEndOfFile&&i.push({type:"push",line:""}))}break;case Ar.Insertion:i.push({type:"splice",index:r,numToDelete:0,linesToInsert:n.lines}),n.noNewlineAtEndOfFile&&i.push({type:"pop"});break;default:de.assertNever(n.type);break}return i}var pWe=/^builtin<([^>]+)>$/;function foe(t,e){let{source:r,selector:i,params:n}=w.parseRange(t);if(r===null)throw new Error("Patch locators must explicitly define their source");let s=i?i.split(/&/).map(c=>T.toPortablePath(c)):[],o=n&&typeof n.locator=="string"?w.parseLocator(n.locator):null,a=n&&typeof n.version=="string"?n.version:null,l=e(r);return{parentLocator:o,sourceItem:l,patchPaths:s,sourceVersion:a}}function Nd(t){let i=foe(t.range,w.parseDescriptor),{sourceItem:e}=i,r=Rr(i,["sourceItem"]);return V(v({},r),{sourceDescriptor:e})}function Ld(t){let i=foe(t.reference,w.parseLocator),{sourceItem:e}=i,r=Rr(i,["sourceItem"]);return V(v({},r),{sourceLocator:e})}function hoe({parentLocator:t,sourceItem:e,patchPaths:r,sourceVersion:i,patchHash:n},s){let o=t!==null?{locator:w.stringifyLocator(t)}:{},a=typeof i!="undefined"?{version:i}:{},l=typeof n!="undefined"?{hash:n}:{};return w.makeRange({protocol:"patch:",source:s(e),selector:r.join("&"),params:v(v(v({},a),l),o)})}function dWe(t,{parentLocator:e,sourceDescriptor:r,patchPaths:i}){return w.makeLocator(t,hoe({parentLocator:e,sourceItem:r,patchPaths:i},w.stringifyDescriptor))}function eN(t,{parentLocator:e,sourcePackage:r,patchPaths:i,patchHash:n}){return w.makeLocator(t,hoe({parentLocator:e,sourceItem:r,sourceVersion:r.version,patchPaths:i,patchHash:n},w.stringifyLocator))}function poe({onAbsolute:t,onRelative:e,onBuiltin:r},i){i.startsWith("~")&&(i=i.slice(1));let s=i.match(pWe);return s!==null?r(s[1]):D.isAbsolute(i)?t(i):e(i)}function doe(t){let e=t.startsWith("~");return e&&(t=t.slice(1)),{optional:e}}function tN(t){return poe({onAbsolute:()=>!1,onRelative:()=>!0,onBuiltin:()=>!1},t)}async function Md(t,e,r){let i=t!==null?await r.fetcher.fetch(t,r):null,n=i&&i.localPath?{packageFs:new yt(we.root),prefixPath:D.relative(we.root,i.localPath)}:i;i&&i!==n&&i.releaseFs&&i.releaseFs();let s=await de.releaseAfterUseAsync(async()=>await Promise.all(e.map(async o=>{let a=doe(o),l=await poe({onAbsolute:async()=>await L.readFilePromise(o,"utf8"),onRelative:async()=>{if(n===null)throw new Error("Assertion failed: The parent locator should have been fetched");return await n.packageFs.readFilePromise(D.join(n.prefixPath,o),"utf8")},onBuiltin:async c=>await r.project.configuration.firstHook(u=>u.getBuiltinPatch,r.project,c)},o);return V(v({},a),{source:l})})));for(let o of s)typeof o.source=="string"&&(o.source=o.source.replace(/\r\n?/g,`
|
||||
`));return s}async function rN(t,{cache:e,project:r}){let i=r.storedPackages.get(t.locatorHash);if(typeof i=="undefined")throw new Error("Assertion failed: Expected the package to be registered");let n=r.storedChecksums,s=new Br,o=r.configuration.makeFetcher(),a=await o.fetch(t,{cache:e,project:r,fetcher:o,checksums:n,report:s}),l=await L.mktempPromise(),c=D.join(l,"source"),u=D.join(l,"user"),g=D.join(l,".yarn-patch.json");return await Promise.all([L.copyPromise(c,a.prefixPath,{baseFs:a.packageFs}),L.copyPromise(u,a.prefixPath,{baseFs:a.packageFs}),L.writeJsonPromise(g,{locator:w.stringifyLocator(t),version:i.version})]),L.detachTemp(l),u}async function iN(t,e){let r=T.fromPortablePath(t).replace(/\\/g,"/"),i=T.fromPortablePath(e).replace(/\\/g,"/"),{stdout:n,stderr:s}=await Lr.execvp("git",["-c","core.safecrlf=false","diff","--src-prefix=a/","--dst-prefix=b/","--ignore-cr-at-eol","--full-index","--no-index","--text",r,i],{cwd:T.toPortablePath(process.cwd()),env:V(v({},process.env),{GIT_CONFIG_NOSYSTEM:"1",HOME:"",XDG_CONFIG_HOME:"",USERPROFILE:""})});if(s.length>0)throw new Error(`Unable to diff directories. Make sure you have a recent version of 'git' available in PATH.
|
||||
The following error was reported by 'git':
|
||||
${s}`);let o=r.startsWith("/")?a=>a.slice(1):a=>a;return n.replace(new RegExp(`(a|b)(${de.escapeRegExp(`/${o(r)}/`)})`,"g"),"$1/").replace(new RegExp(`(a|b)${de.escapeRegExp(`/${o(i)}/`)}`,"g"),"$1/").replace(new RegExp(de.escapeRegExp(`${r}/`),"g"),"").replace(new RegExp(de.escapeRegExp(`${i}/`),"g"),"")}function Coe(t,{configuration:e,report:r}){for(let i of t.parts)for(let n of i.lines)switch(i.type){case Ar.Context:r.reportInfo(null,` ${Ae.pretty(e,n,"grey")}`);break;case Ar.Deletion:r.reportError(z.FROZEN_LOCKFILE_EXCEPTION,`- ${Ae.pretty(e,n,Ae.Type.REMOVED)}`);break;case Ar.Insertion:r.reportError(z.FROZEN_LOCKFILE_EXCEPTION,`+ ${Ae.pretty(e,n,Ae.Type.ADDED)}`);break;default:de.assertNever(i.type)}}var nN=class{supports(e,r){return!!e.reference.startsWith("patch:")}getLocalPath(e,r){return null}async fetch(e,r){let i=r.checksums.get(e.locatorHash)||null,[n,s,o]=await r.cache.fetchPackageFromCache(e,i,{onHit:()=>r.report.reportCacheHit(e),onMiss:()=>r.report.reportCacheMiss(e,`${w.prettyLocator(r.project.configuration,e)} can't be found in the cache and will be fetched from the disk`),loader:()=>this.patchPackage(e,r),skipIntegrityCheck:r.skipIntegrityCheck});return{packageFs:n,releaseFs:s,prefixPath:w.getIdentVendorPath(e),localPath:this.getLocalPath(e,r),checksum:o}}async patchPackage(e,r){let{parentLocator:i,sourceLocator:n,sourceVersion:s,patchPaths:o}=Ld(e),a=await Md(i,o,r),l=await L.mktempPromise(),c=D.join(l,"current.zip"),u=await r.fetcher.fetch(n,r),g=w.getIdentVendorPath(e),f=await gi(),h=new Qr(c,{libzip:f,create:!0,level:r.project.configuration.get("compressionLevel")});await h.mkdirpPromise(g),await de.releaseAfterUseAsync(async()=>{await h.copyPromise(g,u.prefixPath,{baseFs:u.packageFs,stableSort:!0})},u.releaseFs),h.saveAndClose();for(let{source:p,optional:m}of a){if(p===null)continue;let I=new Qr(c,{libzip:f,level:r.project.configuration.get("compressionLevel")}),y=new yt(D.resolve(we.root,g),{baseFs:I});try{await HB(KB(p),{baseFs:y,version:s})}catch(B){if(!(B instanceof Rd))throw B;let x=r.project.configuration.get("enableInlineHunks"),F=!x&&!m?" (set enableInlineHunks for details)":"",N=`${w.prettyLocator(r.project.configuration,e)}: ${B.message}${F}`,O=P=>{!x||Coe(B.hunk,{configuration:r.project.configuration,report:P})};if(I.discardAndClose(),m){r.report.reportWarningOnce(z.PATCH_HUNK_FAILED,N,{reportExtra:O});continue}else throw new _e(z.PATCH_HUNK_FAILED,N,O)}I.saveAndClose()}return new Qr(c,{libzip:f,level:r.project.configuration.get("compressionLevel")})}};var CWe=2,sN=class{supportsDescriptor(e,r){return!!e.range.startsWith("patch:")}supportsLocator(e,r){return!!e.reference.startsWith("patch:")}shouldPersistResolution(e,r){return!1}bindDescriptor(e,r,i){let{patchPaths:n}=Nd(e);return n.every(s=>!tN(s))?e:w.bindDescriptor(e,{locator:w.stringifyLocator(r)})}getResolutionDependencies(e,r){let{sourceDescriptor:i}=Nd(e);return[i]}async getCandidates(e,r,i){if(!i.fetchOptions)throw new Error("Assertion failed: This resolver cannot be used unless a fetcher is configured");let{parentLocator:n,sourceDescriptor:s,patchPaths:o}=Nd(e),a=await Md(n,o,i.fetchOptions),l=r.get(s.descriptorHash);if(typeof l=="undefined")throw new Error("Assertion failed: The dependency should have been resolved");let c=Di.makeHash(`${CWe}`,...a.map(u=>JSON.stringify(u))).slice(0,6);return[eN(e,{parentLocator:n,sourcePackage:l,patchPaths:o,patchHash:c})]}async getSatisfying(e,r,i){return null}async resolve(e,r){let{sourceLocator:i}=Ld(e),n=await r.resolver.resolve(i,r);return v(v({},n),e)}};var Td=class extends ye{constructor(){super(...arguments);this.save=j.Boolean("-s,--save",!1,{description:"Add the patch to your resolution entries"});this.patchFolder=j.String()}async execute(){let e=await le.find(this.context.cwd,this.context.plugins),{project:r,workspace:i}=await Fe.find(e,this.context.cwd);if(!i)throw new Ze(r.cwd,this.context.cwd);await r.restoreInstallState();let n=D.resolve(this.context.cwd,T.toPortablePath(this.patchFolder)),s=D.join(n,"../source"),o=D.join(n,"../.yarn-patch.json");if(!L.existsSync(s))throw new me("The argument folder didn't get created by 'yarn patch'");let a=await iN(s,n),l=await L.readJsonPromise(o),c=w.parseLocator(l.locator,!0);if(!r.storedPackages.has(c.locatorHash))throw new me("No package found in the project for the given locator");if(!this.save){this.context.stdout.write(a);return}let u=e.get("patchFolder"),g=D.join(u,w.slugifyLocator(c));await L.mkdirPromise(u,{recursive:!0}),await L.writeFilePromise(g,a);let f=D.relative(r.cwd,g);r.topLevelWorkspace.manifest.resolutions.push({pattern:{descriptor:{fullName:w.stringifyIdent(c),description:l.version}},reference:`patch:${w.stringifyLocator(c)}#${f}`}),await r.persist()}};Td.paths=[["patch-commit"]],Td.usage=he.Usage({description:"generate a patch out of a directory",details:"\n This will print a patchfile on stdout based on the diff between the folder passed in and the original version of the package. Such file is suiLine truncated
|
||||
${o.map(a=>`
|
||||
- ${w.prettyLocator(e,a)}`).join("")}`);s=o[0]}if(!r.storedPackages.has(s.locatorHash))throw new me("No package found in the project for the given locator");await xe.start({configuration:e,json:this.json,stdout:this.context.stdout},async o=>{let a=await rN(s,{cache:n,project:r});o.reportJson({locator:w.stringifyLocator(s),path:T.fromPortablePath(a)}),o.reportInfo(z.UNNAMED,`Package ${w.prettyLocator(e,s)} got extracted with success!`),o.reportInfo(z.UNNAMED,`You can now edit the following folder: ${Ae.pretty(e,T.fromPortablePath(a),"magenta")}`),o.reportInfo(z.UNNAMED,`Once you are done run ${Ae.pretty(e,`yarn patch-commit ${process.platform==="win32"?'"':""}${T.fromPortablePath(a)}${process.platform==="win32"?'"':""}`,"cyan")} and Yarn will store a patchfile based on your changes.`)})}};Od.paths=[["patch"]],Od.usage=he.Usage({description:"prepare a package for patching",details:'\n This command will cause a package to be extracted in a temporary directory (under a folder named "patch-workdir"). This folder will be editable at will; running `yarn patch` inside it will then cause Yarn to generate a patchfile and register it into your top-level manifest (cf the `patch:` protocol).\n '});var Ioe=Od;var mWe={configuration:{enableInlineHunks:{description:"If true, the installs will print unmatched patch hunks",type:ge.BOOLEAN,default:!1},patchFolder:{description:"Folder where the patch files must be written",type:ge.ABSOLUTE_PATH,default:"./.yarn/patches"}},commands:[moe,Ioe],fetchers:[nN],resolvers:[sN]},IWe=mWe;var jy=()=>({modules:new Map([["@yarnpkg/cli",ap],["@yarnpkg/core",Th],["@yarnpkg/fslib",kg],["@yarnpkg/libzip",Of],["@yarnpkg/parsers",Jf],["@yarnpkg/shell",zf],["clipanion",a6(Jg)],["semver",EWe],["typanion",Tl],["yup",yWe],["@yarnpkg/plugin-essentials",FP],["@yarnpkg/plugin-compat",MP],["@yarnpkg/plugin-dlx",TP],["@yarnpkg/plugin-file",JP],["@yarnpkg/plugin-git",iF],["@yarnpkg/plugin-github",sF],["@yarnpkg/plugin-http",AF],["@yarnpkg/plugin-init",gF],["@yarnpkg/plugin-link",CF],["@yarnpkg/plugin-nm",GF],["@yarnpkg/plugin-npm",WR],["@yarnpkg/plugin-npm-cli",_R],["@yarnpkg/plugin-pack",jR],["@yarnpkg/plugin-patch",oN],["@yarnpkg/plugin-pnp",FF]]),plugins:new Set(["@yarnpkg/plugin-essentials","@yarnpkg/plugin-compat","@yarnpkg/plugin-dlx","@yarnpkg/plugin-file","@yarnpkg/plugin-git","@yarnpkg/plugin-github","@yarnpkg/plugin-http","@yarnpkg/plugin-init","@yarnpkg/plugin-link","@yarnpkg/plugin-nm","@yarnpkg/plugin-npm","@yarnpkg/plugin-npm-cli","@yarnpkg/plugin-pack","@yarnpkg/plugin-patch","@yarnpkg/plugin-pnp"])});fy({binaryVersion:Er||"<unknown>",pluginConfiguration:jy()});})();
|
||||
/*!
|
||||
* buildToken
|
||||
* Builds OAuth token prefix (helper function)
|
||||
*
|
||||
* @name buildToken
|
||||
* @function
|
||||
* @param {GitUrl} obj The parsed Git url object.
|
||||
* @return {String} token prefix
|
||||
*/
|
||||
/*!
|
||||
* fill-range <https://github.com/jonschlinkert/fill-range>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/*!
|
||||
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
||||
*
|
||||
* Copyright (c) 2014-2016, Jon Schlinkert.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/*!
|
||||
* is-glob <https://github.com/jonschlinkert/is-glob>
|
||||
*
|
||||
* Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
/*!
|
||||
* is-number <https://github.com/jonschlinkert/is-number>
|
||||
*
|
||||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
/*!
|
||||
* is-windows <https://github.com/jonschlinkert/is-windows>
|
||||
*
|
||||
* Copyright © 2015-2018, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
/*!
|
||||
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
||||
*
|
||||
* Copyright (c) 2015-present, Jon Schlinkert.
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@@ -0,0 +1,9 @@
|
||||
nodeLinker: node-modules
|
||||
|
||||
plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
|
||||
spec: "@yarnpkg/plugin-typescript"
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.0.2.cjs
|
||||
@@ -1,65 +0,0 @@
|
||||
# Home Assistant Frontend Agent Guide
|
||||
|
||||
You are helping develop the Home Assistant frontend. This repository is a TypeScript application built from Lit-based Web Components for the Home Assistant web UI.
|
||||
|
||||
## Essential Commands
|
||||
|
||||
```bash
|
||||
pnpm lint # ESLint + Prettier + TypeScript + Lit
|
||||
pnpm format # Auto-fix ESLint + Prettier
|
||||
pnpm lint:types # TypeScript compiler, run without file arguments
|
||||
pnpm test # Vitest
|
||||
pnpm dev # App dev server, supports --background/--status/--stop/--logs
|
||||
pnpm dev:serve # Local serving dev server, supports -c core URL, -p port, and dev flags
|
||||
```
|
||||
|
||||
Never run `tsc` or `pnpm lint:types` with file arguments. When `tsc` receives file arguments, it ignores `tsconfig.json` and can emit `.js` files into `src/`. Always run `pnpm lint:types` without arguments. For individual file type checking, rely on editor diagnostics.
|
||||
|
||||
## Architecture
|
||||
|
||||
- The frontend uses custom elements built with Lit and TypeScript strict mode.
|
||||
- Components communicate with the backend through the Home Assistant WebSocket API.
|
||||
- Use `ha-` for Home Assistant components, `hui-` for Lovelace UI components, and `dialog-` for dialogs.
|
||||
- Prefer `ha-*` components and current Web Awesome wrappers. Avoid adding new legacy `mwc-*` usage.
|
||||
- Leaf components should consume narrow Lit contexts instead of taking the broad `hass` object unless they are containers that own and provide `hass`.
|
||||
|
||||
## Development Standards
|
||||
|
||||
- Use strict TypeScript, proper interfaces, and `import type` for type-only imports.
|
||||
- Avoid `any`; model data with existing Home Assistant types or narrow new types.
|
||||
- Keep imports organized and remove unused imports.
|
||||
- Do not use `console`; use existing logging or user-visible error patterns.
|
||||
- Use `@state()` for internal Lit state and `@property()` for public API.
|
||||
- Do not query or manipulate DOM manually when Lit decorators, component refs, or render state are appropriate.
|
||||
- Scope styles to components, use theme custom properties, and keep layouts mobile-first and RTL-safe.
|
||||
- All user-facing text must be localized through the translation system.
|
||||
- Do not write tests just because you changed some code. Write a test when there is real logic that could break without anyone noticing, and explain what the test protects.
|
||||
|
||||
## Project Skills
|
||||
|
||||
Detailed guidance lives in `.agents/skills/<name>/SKILL.md`. Load every matching skill before detailed implementation or review. For reviews, load `ha-frontend-review` alongside all companions that apply to the changed code or behavior:
|
||||
|
||||
- `ha-frontend-contexts`: Lit contexts, `hass` migration, and rerender-sensitive state access.
|
||||
- `ha-frontend-components`: dialogs, forms, alerts, shortcuts, tooltips, panels, and Lovelace cards.
|
||||
- `ha-frontend-events`: event handler typing, custom event dispatch, and event-map declarations.
|
||||
- `ha-frontend-types`: backend data contracts, optional schemas, shared types, assertions, and lifecycle types.
|
||||
- `ha-frontend-lit`: reactive fields, DOM queries, lifecycle behavior, and render-derived state.
|
||||
- `ha-frontend-styling`: theme variables, spacing tokens, responsive layout, RTL, and view transitions.
|
||||
- `ha-frontend-testing`: lint, typecheck, Vitest, Playwright e2e dev servers, and benchmarks.
|
||||
- `ha-frontend-user-facing-text`: localization, terminology, sentence case, and Home Assistant text style.
|
||||
- `ha-frontend-review`: PR template use, existing review feedback, review checklist, recurring issues, and UI/UX evidence including gallery specifications.
|
||||
- `ha-frontend-ux-readiness`: UI/UX routing that complements frontend review for new user experiences.
|
||||
- `ha-frontend-gallery`: gallery pages, demos, sidebar structure, content, and verification.
|
||||
- `ha-frontend-demo`: standalone demo structure, configurations, navigation, shared stubs, and verification.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
When creating a pull request, use `.github/PULL_REQUEST_TEMPLATE.md` as the PR body. Preserve template sections, check only the appropriate type-of-change boxes, and do not check checklist items on behalf of the user. If the PR includes UI changes, remind the user to add screenshots or a short video.
|
||||
|
||||
## AI policy
|
||||
|
||||
This project follows the [Open Home Foundation AI Policy](AI_POLICY.md).
|
||||
Autonomous contributions are not accepted: a human must review, understand,
|
||||
and be able to explain every change before it is submitted. Do not open
|
||||
issues or pull requests autonomously, and do not post comments on behalf of
|
||||
a user without their review.
|
||||
@@ -1,45 +0,0 @@
|
||||
# Open Home Foundation - AI Policy
|
||||
|
||||
We support using AI (i.e., LLMs) as tools when contributing to Open Home Foundation projects. However, you are responsible for any contributions you submit, and we are responsible for any contributions we merge and release. We hold a high bar for all contributions to our projects.
|
||||
|
||||
Our maintainers dedicate their time and expertise to reviewing contributions. Submitting AI-generated content that you have not personally reviewed and understood wastes that time and will not be accepted.
|
||||
|
||||
## Autonomous agents
|
||||
|
||||
**We do not allow autonomous agents to be used for contributing to our projects.** We will close any pull requests or issues that we believe were created autonomously, and may mark automated comments as spam. This includes contributions that bypass the provided issue or pull request templates.
|
||||
|
||||
## Communication on issues, pull requests, and code reviews
|
||||
|
||||
We don't mind if you use AI tools to help you write. However, do not have tools post unreviewed content on your behalf. Keep responses to the minimum needed to communicate your intent. We may hide any comments that we believe are unreviewed AI output.
|
||||
|
||||
If you are opening a pull request, we expect you to be able to explain the proposed changes in your own words. This includes the pull request description and responses to questions. If you use AI to help generate the pull request summary, you must review it for technical accuracy.
|
||||
|
||||
**Do not use AI to generate answers to questions from maintainers.** You should understand and be able to explain your own work. Using AI to improve grammar or clarity is fine, but the substance of your responses must be your own.
|
||||
|
||||
If you wish to include context from an interaction with AI in your comments, it must be in a quote block (e.g., using `>`) and disclosed as such. It must be accompanied by your own commentary explaining the relevance and implications of the context. Do not share long snippets.
|
||||
|
||||
## Non-native English speakers
|
||||
|
||||
We understand that AI is useful when communicating as a non-native English speaker. Using AI to improve the grammar or clarity of text you have written yourself is fine. If you are using AI to translate your comments, please ensure the translation accurately reflects your intent. Including your original text in a details block shows the effort behind your contribution, helps maintainers verify the translation if needed, and keeps the conversation readable.
|
||||
|
||||
## Code and documentation contributions
|
||||
|
||||
AI can be a helpful tool for writing code and documentation. However, due to the foundational open source nature of our projects, we require a human in the loop who understands the work produced by AI.
|
||||
|
||||
All contributions must be reviewed and understood by the contributor before submission. You should be able to explain every change in a pull request you submit. Pull requests that appear to be unreviewed AI output will be closed without review.
|
||||
|
||||
## Our use of AI
|
||||
|
||||
Some of our projects use AI tools to assist with code reviews, issue triaging, reporting, and other project management tasks. These tools may leave comments on pull requests or issues. As with any automated tooling, these comments are not always correct.
|
||||
|
||||
If an AI tool leaves a comment on your contribution, treat it as you would any other review comment. If you believe it is incorrect, say so; a brief explanation is sufficient. Maintainers always have the final say. If in doubt, ask a maintainer.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Contributions that do not follow this policy will be closed. Repeated violations may result in being blocked from contributing to OHF projects. If you believe your contribution was closed in error, you are welcome to reach out to a maintainer to discuss.
|
||||
|
||||
---
|
||||
|
||||
The canonical version of this policy is published at
|
||||
<https://developers.home-assistant.io/docs/ai_policy>. In case of differences,
|
||||
the published version applies.
|
||||
@@ -1,8 +0,0 @@
|
||||
# People marked here will be automatically requested for a review
|
||||
# when the code that they own is touched.
|
||||
# https://github.com/blog/2392-introducing-code-owners
|
||||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
||||
|
||||
# Part of the frontend that mobile developper should review
|
||||
src/external_app/ @bgoncal @TimoPtr
|
||||
test/external_app/ @bgoncal @TimoPtr
|
||||
+162
-169
@@ -1,201 +1,194 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
Apache License
|
||||
==============
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
_Version 2.0, January 2004_
|
||||
_<<http://www.apache.org/licenses/>>_
|
||||
|
||||
1. Definitions.
|
||||
### Terms and Conditions for use, reproduction, and distribution
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
#### 1. Definitions
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
“License” shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
“Licensor” shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
“Legal Entity” shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, “control” means **(i)** the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or **(iii)** beneficial ownership of such entity.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
“You” (or “Your”) shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
“Source” form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
“Object” form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
“Work” shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
“Derivative Works” shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
“Contribution” shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
“submitted” means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as “Not a Contribution.”
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
#### 2. Grant of Copyright License
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
#### 3. Grant of Patent License
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
#### 4. Redistribution
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
* **(b)** You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
#### 5. Submission of Contributions
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
#### 6. Trademarks
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
#### 7. Disclaimer of Warranty
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
#### 8. Limitation of Liability
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
#### 9. Accepting Warranty or Additional Liability
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
### APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets `[]` replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same “printed page” as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,4 +1,5 @@
|
||||
include README.md
|
||||
include LICENSE.md
|
||||
graft hass_frontend
|
||||
graft hass_frontend_es5
|
||||
recursive-exclude * *.py[co]
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This is the repository for the official [Home Assistant](https://home-assistant.io) frontend.
|
||||
|
||||
[](https://demo.home-assistant.io/)
|
||||
[](https://demo.home-assistant.io/)
|
||||
|
||||
- [View demo of Home Assistant](https://demo.home-assistant.io/)
|
||||
- [More information about Home Assistant](https://home-assistant.io)
|
||||
@@ -12,8 +12,9 @@ This is the repository for the official [Home Assistant](https://home-assistant.
|
||||
|
||||
- Initial setup: `script/setup`
|
||||
- Development: [Instructions](https://developers.home-assistant.io/docs/frontend/development/)
|
||||
- Production build: `pnpm build`
|
||||
- Production build: `script/build_frontend`
|
||||
- Gallery: `cd gallery && script/develop_gallery`
|
||||
- Supervisor: [Instructions](https://developers.home-assistant.io/docs/supervisor/developing)
|
||||
|
||||
## Frontend development
|
||||
|
||||
@@ -26,5 +27,3 @@ A complete guide can be found at the following [link](https://www.home-assistant
|
||||
Home Assistant is open-source and Apache 2 licensed. Feel free to browse the repository, learn and reuse parts in your own projects.
|
||||
|
||||
We use [BrowserStack](https://www.browserstack.com) to test Home Assistant on a large variety of devices.
|
||||
|
||||
[](https://www.openhomefoundation.org/)
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"rules": {
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"no-restricted-syntax": 0,
|
||||
"no-console": 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../.eslintrc.json",
|
||||
"rules": {
|
||||
"import/no-extraneous-dependencies": 0,
|
||||
"global-require": 0
|
||||
}
|
||||
}
|
||||
+2
-10
@@ -15,7 +15,7 @@ The Home Assistant build pipeline contains various steps to prepare a build.
|
||||
|
||||
Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.
|
||||
|
||||
We currently rely on Webpack. Both of these programs bundle the converted files in both production and development.
|
||||
We currently rely on Webpack but also have experimental Rollup support. Both of these programs bundle the converted files in both production and development.
|
||||
|
||||
For development, bundling is optional. We just want to get the right files in the browser.
|
||||
|
||||
@@ -34,14 +34,6 @@ In production, the following responsibilities are added:
|
||||
|
||||
- Minify HTML
|
||||
- Bundle multiple imports so that the browser can fetch less files
|
||||
- Generate a second version that is compatible with older browsers (legacy build)
|
||||
- Generate a second version that is ES5 compatible
|
||||
|
||||
Configuration for all these steps are specified in [bundle.js](bundle.js).
|
||||
|
||||
## Auditing browser support changes
|
||||
|
||||
`node build-scripts/list-plugins-and-polyfills.js` prints, per browserslist
|
||||
environment (modern/legacy), the Babel transforms preset-env enables and the
|
||||
Core-JS polyfills that may be injected — as collapsible markdown ready to
|
||||
paste into a PR. Use it to show the bundle impact when changing
|
||||
`.browserslistrc` or the Babel configuration.
|
||||
@@ -1,150 +0,0 @@
|
||||
import defineProvider from "@babel/helper-define-polyfill-provider";
|
||||
import { join } from "node:path";
|
||||
import paths from "../paths.cjs";
|
||||
|
||||
const POLYFILL_DIR = join(paths.root_dir, "src/resources/polyfills");
|
||||
|
||||
// List of polyfill keys with supported browser targets for the functionality
|
||||
const polyfillSupport = {
|
||||
// Note states and shadowRoot properties should be supported.
|
||||
"element-internals": {
|
||||
android: 90,
|
||||
chrome: 90,
|
||||
edge: 90,
|
||||
firefox: 126,
|
||||
ios: 17.4,
|
||||
opera: 76,
|
||||
opera_mobile: 64,
|
||||
safari: 17.4,
|
||||
samsung: 15.0,
|
||||
},
|
||||
"element-getattributenames": {
|
||||
android: 61,
|
||||
chrome: 61,
|
||||
edge: 18,
|
||||
firefox: 45,
|
||||
ios: 10.3,
|
||||
opera: 48,
|
||||
opera_mobile: 45,
|
||||
safari: 10.1,
|
||||
samsung: 8.0,
|
||||
},
|
||||
"element-toggleattribute": {
|
||||
android: 69,
|
||||
chrome: 69,
|
||||
edge: 18,
|
||||
firefox: 63,
|
||||
ios: 12.0,
|
||||
opera: 56,
|
||||
opera_mobile: 48,
|
||||
safari: 12.0,
|
||||
samsung: 10.0,
|
||||
},
|
||||
// FormatJS polyfill detects fix for https://bugs.chromium.org/p/v8/issues/detail?id=10682,
|
||||
// so adjusted to several months after that was marked fixed
|
||||
"intl-getcanonicallocales": {
|
||||
android: 90,
|
||||
chrome: 90,
|
||||
edge: 90,
|
||||
firefox: 48,
|
||||
ios: 10.3,
|
||||
opera: 76,
|
||||
opera_mobile: 64,
|
||||
safari: 10.1,
|
||||
samsung: 15.0,
|
||||
},
|
||||
"intl-locale": {
|
||||
android: 74,
|
||||
chrome: 74,
|
||||
edge: 79,
|
||||
firefox: 75,
|
||||
ios: 14.0,
|
||||
opera: 62,
|
||||
opera_mobile: 53,
|
||||
safari: 14.0,
|
||||
samsung: 11.0,
|
||||
},
|
||||
"intl-other": {
|
||||
// Not specified (i.e. always try polyfill) since compatibility depends on supported locales
|
||||
},
|
||||
"resize-observer": {
|
||||
android: 64,
|
||||
chrome: 64,
|
||||
edge: 79,
|
||||
firefox: 69,
|
||||
ios: 13.4,
|
||||
opera: 51,
|
||||
opera_mobile: 47,
|
||||
safari: 13.1,
|
||||
samsung: 9.0,
|
||||
},
|
||||
};
|
||||
|
||||
// Map of global variables and/or instance and static properties to the
|
||||
// corresponding polyfill key and actual module to import
|
||||
const polyfillMap = {
|
||||
global: {
|
||||
ResizeObserver: {
|
||||
key: "resize-observer",
|
||||
module: join(POLYFILL_DIR, "resize-observer.ts"),
|
||||
},
|
||||
},
|
||||
instance: {
|
||||
attachInternals: {
|
||||
key: "element-internals",
|
||||
module: "element-internals-polyfill",
|
||||
},
|
||||
...Object.fromEntries(
|
||||
["getAttributeNames", "toggleAttribute"].map((prop) => {
|
||||
const key = `element-${prop.toLowerCase()}`;
|
||||
return [prop, { key, module: join(POLYFILL_DIR, `${key}.ts`) }];
|
||||
})
|
||||
),
|
||||
},
|
||||
static: {
|
||||
Intl: {
|
||||
getCanonicalLocales: {
|
||||
key: "intl-getcanonicallocales",
|
||||
module: join(POLYFILL_DIR, "intl-polyfill.ts"),
|
||||
},
|
||||
Locale: {
|
||||
key: "intl-locale",
|
||||
module: join(POLYFILL_DIR, "intl-polyfill.ts"),
|
||||
},
|
||||
...Object.fromEntries(
|
||||
[
|
||||
"DateTimeFormat",
|
||||
"DurationFormat",
|
||||
"DisplayNames",
|
||||
"ListFormat",
|
||||
"NumberFormat",
|
||||
"PluralRules",
|
||||
"RelativeTimeFormat",
|
||||
].map((obj) => [
|
||||
obj,
|
||||
{ key: "intl-other", module: join(POLYFILL_DIR, "intl-polyfill.ts") },
|
||||
])
|
||||
),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Create plugin using the same factory as for CoreJS
|
||||
export default defineProvider(
|
||||
({ createMetaResolver, debug, shouldInjectPolyfill }) => {
|
||||
const resolvePolyfill = createMetaResolver(polyfillMap);
|
||||
return {
|
||||
name: "custom-polyfill",
|
||||
polyfills: polyfillSupport,
|
||||
usageGlobal(meta, utils) {
|
||||
const polyfill = resolvePolyfill(meta);
|
||||
if (polyfill && shouldInjectPolyfill(polyfill.desc.key)) {
|
||||
debug(polyfill.desc.key);
|
||||
utils.injectGlobalImport(polyfill.desc.module);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -1,168 +0,0 @@
|
||||
const path = require("path");
|
||||
|
||||
// Currently only supports CommonJS modules, as require is synchronous. `import` would need babel running asynchronous.
|
||||
module.exports = function inlineConstants(babel, options, cwd) {
|
||||
const t = babel.types;
|
||||
|
||||
if (!Array.isArray(options.modules)) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected a `modules` array to be passed"
|
||||
);
|
||||
}
|
||||
|
||||
if (options.resolveExtensions && !Array.isArray(options.resolveExtensions)) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected `resolveExtensions` to be an array"
|
||||
);
|
||||
}
|
||||
|
||||
const ignoreModuleNotFound = options.ignoreModuleNotFound;
|
||||
const resolveExtensions = options.resolveExtensions;
|
||||
|
||||
const hasRelativeModules = options.modules.some(
|
||||
(module) => module.startsWith(".") || module.startsWith("/")
|
||||
);
|
||||
|
||||
const modules = Object.fromEntries(
|
||||
options.modules.map((module) => {
|
||||
const absolute = module.startsWith(".")
|
||||
? require.resolve(module, { paths: [cwd] })
|
||||
: module;
|
||||
return [absolute, require(absolute)];
|
||||
})
|
||||
);
|
||||
|
||||
const toLiteral = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return t.stringLiteral(value);
|
||||
}
|
||||
|
||||
if (typeof value === "number") {
|
||||
return t.numericLiteral(value);
|
||||
}
|
||||
|
||||
if (typeof value === "boolean") {
|
||||
return t.booleanLiteral(value);
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return t.nullLiteral();
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot handle non-literal `" + value + "`"
|
||||
);
|
||||
};
|
||||
|
||||
const resolveAbsolute = (value, state, resolveExtensionIndex) => {
|
||||
if (!state.filename) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected a `filename` to be set for files"
|
||||
);
|
||||
}
|
||||
|
||||
if (resolveExtensions && resolveExtensionIndex !== undefined) {
|
||||
value += resolveExtensions[resolveExtensionIndex];
|
||||
}
|
||||
|
||||
try {
|
||||
return require.resolve(value, { paths: [path.dirname(state.filename)] });
|
||||
} catch (error) {
|
||||
if (
|
||||
error.code === "MODULE_NOT_FOUND" &&
|
||||
resolveExtensions &&
|
||||
(resolveExtensionIndex === undefined ||
|
||||
resolveExtensionIndex < resolveExtensions.length - 1)
|
||||
) {
|
||||
const resolveExtensionIdx = (resolveExtensionIndex || -1) + 1;
|
||||
return resolveAbsolute(value, state, resolveExtensionIdx);
|
||||
}
|
||||
|
||||
if (error.code === "MODULE_NOT_FOUND" && ignoreModuleNotFound) {
|
||||
return undefined;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const importDeclaration = (p, state) => {
|
||||
if (p.node.type !== "ImportDeclaration") {
|
||||
return;
|
||||
}
|
||||
const absolute =
|
||||
hasRelativeModules && p.node.source.value.startsWith(".")
|
||||
? resolveAbsolute(p.node.source.value, state)
|
||||
: p.node.source.value;
|
||||
|
||||
if (!absolute || !(absolute in modules)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const module = modules[absolute];
|
||||
|
||||
for (const specifier of p.node.specifiers) {
|
||||
if (
|
||||
specifier.type === "ImportDefaultSpecifier" &&
|
||||
specifier.local &&
|
||||
specifier.local.type === "Identifier"
|
||||
) {
|
||||
if (!("default" in module)) {
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot access default export from `" +
|
||||
p.node.source.value +
|
||||
"`"
|
||||
);
|
||||
}
|
||||
|
||||
const variableValue = toLiteral(module.default);
|
||||
const variable = t.variableDeclarator(
|
||||
t.identifier(specifier.local.name),
|
||||
variableValue
|
||||
);
|
||||
|
||||
p.insertBefore({
|
||||
type: "VariableDeclaration",
|
||||
kind: "const",
|
||||
declarations: [variable],
|
||||
});
|
||||
} else if (
|
||||
specifier.type === "ImportSpecifier" &&
|
||||
specifier.imported &&
|
||||
specifier.imported.type === "Identifier" &&
|
||||
specifier.local &&
|
||||
specifier.local.type === "Identifier"
|
||||
) {
|
||||
if (!(specifier.imported.name in module)) {
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot access `" +
|
||||
specifier.imported.name +
|
||||
"` from `" +
|
||||
p.node.source.value +
|
||||
"`"
|
||||
);
|
||||
}
|
||||
|
||||
const variableValue = toLiteral(module[specifier.imported.name]);
|
||||
const variable = t.variableDeclarator(
|
||||
t.identifier(specifier.local.name),
|
||||
variableValue
|
||||
);
|
||||
|
||||
p.insertBefore({
|
||||
type: "VariableDeclaration",
|
||||
kind: "const",
|
||||
declarations: [variable],
|
||||
});
|
||||
} else {
|
||||
throw new Error("Cannot handle specifier `" + specifier.type + "`");
|
||||
}
|
||||
}
|
||||
p.remove();
|
||||
};
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
ImportDeclaration: importDeclaration,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,170 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const path = require("path");
|
||||
|
||||
// Currently only supports CommonJS modules, as require is synchronous. `import` would need babel running asynchronous.
|
||||
module.exports = function inlineConstants(babel, options, cwd) {
|
||||
const t = babel.types;
|
||||
|
||||
if (!Array.isArray(options.modules)) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected a `modules` array to be passed"
|
||||
);
|
||||
}
|
||||
|
||||
if (options.resolveExtensions && !Array.isArray(options.resolveExtensions)) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected `resolveExtensions` to be an array"
|
||||
);
|
||||
}
|
||||
|
||||
const ignoreModuleNotFound = options.ignoreModuleNotFound;
|
||||
const resolveExtensions = options.resolveExtensions;
|
||||
|
||||
const hasRelativeModules = options.modules.some(
|
||||
(module) => module.startsWith(".") || module.startsWith("/")
|
||||
);
|
||||
|
||||
const modules = Object.fromEntries(
|
||||
options.modules.map((module) => {
|
||||
const absolute = module.startsWith(".")
|
||||
? require.resolve(module, { paths: [cwd] })
|
||||
: module;
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
return [absolute, require(absolute)];
|
||||
})
|
||||
);
|
||||
|
||||
const toLiteral = (value) => {
|
||||
if (typeof value === "string") {
|
||||
return t.stringLiteral(value);
|
||||
}
|
||||
|
||||
if (typeof value === "number") {
|
||||
return t.numericLiteral(value);
|
||||
}
|
||||
|
||||
if (typeof value === "boolean") {
|
||||
return t.booleanLiteral(value);
|
||||
}
|
||||
|
||||
if (value === null) {
|
||||
return t.nullLiteral();
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot handle non-literal `" + value + "`"
|
||||
);
|
||||
};
|
||||
|
||||
const resolveAbsolute = (value, state, resolveExtensionIndex) => {
|
||||
if (!state.filename) {
|
||||
throw new TypeError(
|
||||
"babel-plugin-inline-constants: expected a `filename` to be set for files"
|
||||
);
|
||||
}
|
||||
|
||||
if (resolveExtensions && resolveExtensionIndex !== undefined) {
|
||||
value += resolveExtensions[resolveExtensionIndex];
|
||||
}
|
||||
|
||||
try {
|
||||
return require.resolve(value, { paths: [path.dirname(state.filename)] });
|
||||
} catch (error) {
|
||||
if (
|
||||
error.code === "MODULE_NOT_FOUND" &&
|
||||
resolveExtensions &&
|
||||
(resolveExtensionIndex === undefined ||
|
||||
resolveExtensionIndex < resolveExtensions.length - 1)
|
||||
) {
|
||||
const resolveExtensionIdx = (resolveExtensionIndex || -1) + 1;
|
||||
return resolveAbsolute(value, state, resolveExtensionIdx);
|
||||
}
|
||||
|
||||
if (error.code === "MODULE_NOT_FOUND" && ignoreModuleNotFound) {
|
||||
return undefined;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
const importDeclaration = (p, state) => {
|
||||
if (p.node.type !== "ImportDeclaration") {
|
||||
return;
|
||||
}
|
||||
const absolute =
|
||||
hasRelativeModules && p.node.source.value.startsWith(".")
|
||||
? resolveAbsolute(p.node.source.value, state)
|
||||
: p.node.source.value;
|
||||
|
||||
if (!absolute || !(absolute in modules)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const module = modules[absolute];
|
||||
|
||||
for (const specifier of p.node.specifiers) {
|
||||
if (
|
||||
specifier.type === "ImportDefaultSpecifier" &&
|
||||
specifier.local &&
|
||||
specifier.local.type === "Identifier"
|
||||
) {
|
||||
if (!("default" in module)) {
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot access default export from `" +
|
||||
p.node.source.value +
|
||||
"`"
|
||||
);
|
||||
}
|
||||
|
||||
const variableValue = toLiteral(module.default);
|
||||
const variable = t.variableDeclarator(
|
||||
t.identifier(specifier.local.name),
|
||||
variableValue
|
||||
);
|
||||
|
||||
p.insertBefore({
|
||||
type: "VariableDeclaration",
|
||||
kind: "const",
|
||||
declarations: [variable],
|
||||
});
|
||||
} else if (
|
||||
specifier.type === "ImportSpecifier" &&
|
||||
specifier.imported &&
|
||||
specifier.imported.type === "Identifier" &&
|
||||
specifier.local &&
|
||||
specifier.local.type === "Identifier"
|
||||
) {
|
||||
if (!(specifier.imported.name in module)) {
|
||||
throw new Error(
|
||||
"babel-plugin-inline-constants: cannot access `" +
|
||||
specifier.imported.name +
|
||||
"` from `" +
|
||||
p.node.source.value +
|
||||
"`"
|
||||
);
|
||||
}
|
||||
|
||||
const variableValue = toLiteral(module[specifier.imported.name]);
|
||||
const variable = t.variableDeclarator(
|
||||
t.identifier(specifier.local.name),
|
||||
variableValue
|
||||
);
|
||||
|
||||
p.insertBefore({
|
||||
type: "VariableDeclaration",
|
||||
kind: "const",
|
||||
declarations: [variable],
|
||||
});
|
||||
} else {
|
||||
throw new Error("Cannot handle specifier `" + specifier.type + "`");
|
||||
}
|
||||
}
|
||||
p.remove();
|
||||
};
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
ImportDeclaration: importDeclaration,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,56 +0,0 @@
|
||||
// Gulp transform that brotli-compresses files, several at a time.
|
||||
//
|
||||
// Drop-in replacement for gulp-brotli. zlib already does the work off the main
|
||||
// thread, but that plugin wraps it in through2, which waits for each file
|
||||
// before starting the next, so only one compression is ever in flight. The
|
||||
// compressed bytes are unchanged; only how many run at once differs.
|
||||
//
|
||||
// The real ceiling is libuv's threadpool, which zlib runs on. It sizes itself
|
||||
// from UV_THREADPOOL_SIZE before any JavaScript runs, so it can only be raised
|
||||
// from the environment, never from inside the build.
|
||||
|
||||
import { availableParallelism } from "node:os";
|
||||
import { buffer as readStream } from "node:stream/consumers";
|
||||
import { promisify } from "node:util";
|
||||
import { brotliCompress, constants } from "node:zlib";
|
||||
import { withCache } from "./compress-cache.mjs";
|
||||
import { ParallelTransform } from "./parallel-transform.mjs";
|
||||
|
||||
const EXTENSION = ".br";
|
||||
|
||||
const compress = promisify(brotliCompress);
|
||||
|
||||
/**
|
||||
* @param {object} [options]
|
||||
* @param {boolean} [options.skipLarger] Drop files that compression grows.
|
||||
* @param {object} [options.params] Brotli parameters, passed to zlib as-is.
|
||||
*/
|
||||
export default ({ skipLarger = false, params } = {}) => {
|
||||
// Isolate cache entries by anything that changes the output bytes: the brotli
|
||||
// quality, and the node major that produced them.
|
||||
const quality = params?.[constants.BROTLI_PARAM_QUALITY] ?? "default";
|
||||
const namespace = `brotli-q${quality}-node${process.versions.node.split(".")[0]}`;
|
||||
|
||||
return new ParallelTransform(availableParallelism(), async (file) => {
|
||||
if (file.isNull()) {
|
||||
return file;
|
||||
}
|
||||
if (file.isStream()) {
|
||||
file.contents = await readStream(file.contents);
|
||||
}
|
||||
|
||||
const compressed = await withCache(namespace, file.contents, async () => {
|
||||
const out = await compress(file.contents, { params });
|
||||
// Dropped rather than passed through, as gulp-brotli did: the
|
||||
// uncompressed file is already in the output directory.
|
||||
return skipLarger && out.length >= file.contents.length ? undefined : out;
|
||||
});
|
||||
if (compressed === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
file.contents = compressed;
|
||||
file.path += EXTENSION;
|
||||
return file;
|
||||
});
|
||||
};
|
||||
@@ -1,311 +0,0 @@
|
||||
// Manage a Home Assistant frontend production build with an agent-friendly
|
||||
// interface, matching build-scripts/dev-server.mjs.
|
||||
//
|
||||
// node build-scripts/build-manager.mjs [--modern] [mode]
|
||||
//
|
||||
// (no mode) Run in the foreground.
|
||||
// --background Start detached, print the pid, then exit and leave it
|
||||
// running.
|
||||
// --status Report whether a managed build is running.
|
||||
// --stop Stop a managed build.
|
||||
// --logs [--follow] Print (or follow) the background build log.
|
||||
//
|
||||
// --modern Build only the modern frontend_latest bundle.
|
||||
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import {
|
||||
LIFECYCLE_MODE_FLAGS,
|
||||
acquireProcessRecord,
|
||||
isProcessRecordAlive,
|
||||
outputLog,
|
||||
offerToStopProcessRecord,
|
||||
processStartTime,
|
||||
readProcessRecord,
|
||||
releaseProcessRecord,
|
||||
runCli,
|
||||
spawnDetachedToLog,
|
||||
spawnForeground,
|
||||
terminateDetachedProcess,
|
||||
terminateProcess,
|
||||
waitFor,
|
||||
writeProcessRecord,
|
||||
} from "./managed-process.mjs";
|
||||
import {
|
||||
buildCacheDir,
|
||||
describeOutputOwner,
|
||||
workflowLockEnv,
|
||||
workflowLockFile,
|
||||
} from "./output-lock.mjs";
|
||||
|
||||
const repoRoot = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
".."
|
||||
);
|
||||
const gulpBin = path.join(repoRoot, "node_modules", ".bin", "gulp");
|
||||
const stateDir = path.join(buildCacheDir, "ha-build");
|
||||
const logFile = path.join(stateDir, "build.log");
|
||||
const lockFile = workflowLockFile;
|
||||
|
||||
const usage = () => {
|
||||
process.stderr.write(
|
||||
"Usage: node build-scripts/build-manager.mjs [--modern] " +
|
||||
"[--background | --status | --stop | --logs [--follow]]\n"
|
||||
);
|
||||
};
|
||||
|
||||
const parseArgs = (argv) => {
|
||||
const args = {
|
||||
mode: "foreground",
|
||||
modes: [],
|
||||
follow: false,
|
||||
modern: false,
|
||||
unknown: [],
|
||||
};
|
||||
for (const arg of argv) {
|
||||
if (LIFECYCLE_MODE_FLAGS.has(arg)) {
|
||||
args.mode = LIFECYCLE_MODE_FLAGS.get(arg);
|
||||
args.modes.push(arg);
|
||||
} else if (arg === "--modern") {
|
||||
args.modern = true;
|
||||
} else if (arg === "--follow") {
|
||||
args.follow = true;
|
||||
} else {
|
||||
args.unknown.push(arg);
|
||||
}
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
const hints = () =>
|
||||
" Stop: pnpm build --stop\n" +
|
||||
" Status: pnpm build --status\n" +
|
||||
" Logs: pnpm build --logs\n";
|
||||
|
||||
const devCommand = (suite) => {
|
||||
switch (suite) {
|
||||
case "app-serve":
|
||||
return "dev:serve";
|
||||
case "demo":
|
||||
return "dev:demo";
|
||||
case "gallery":
|
||||
return "dev:gallery";
|
||||
case "e2e-app":
|
||||
return "test:e2e:app:dev";
|
||||
default:
|
||||
return "dev";
|
||||
}
|
||||
};
|
||||
|
||||
const readBuild = () => readProcessRecord(lockFile);
|
||||
|
||||
const releaseBuild = (token) => releaseProcessRecord(lockFile, token);
|
||||
|
||||
const stopCommandFor = (owner) =>
|
||||
owner?.kind === "build"
|
||||
? "pnpm build --stop"
|
||||
: owner?.kind === "dev"
|
||||
? `pnpm ${devCommand(owner.suite)} --stop`
|
||||
: undefined;
|
||||
|
||||
const acquireBuild = async (modern, foreground) => {
|
||||
const token = `${process.pid}-${Date.now()}-${Math.random()}`;
|
||||
const record = {
|
||||
pid: process.pid,
|
||||
startTime: processStartTime(process.pid),
|
||||
processGroup: false,
|
||||
foreground,
|
||||
kind: "build",
|
||||
modern,
|
||||
starting: true,
|
||||
token,
|
||||
};
|
||||
const result = acquireProcessRecord(lockFile, record);
|
||||
if (result.acquired) {
|
||||
return { token };
|
||||
}
|
||||
reportExisting(result.existing);
|
||||
return (await offerToStopProcessRecord({
|
||||
file: lockFile,
|
||||
owner: result.existing,
|
||||
ownerDescription: describeOutputOwner(result.existing),
|
||||
stopCommand: stopCommandFor(result.existing),
|
||||
}))
|
||||
? acquireBuild(modern, foreground)
|
||||
: { existing: result.existing };
|
||||
};
|
||||
|
||||
const updateBuild = (token, child, processGroup) => {
|
||||
const existing = readBuild();
|
||||
if (existing?.token !== token) {
|
||||
throw Error("Frontend build lock ownership was lost during startup.");
|
||||
}
|
||||
writeProcessRecord(lockFile, {
|
||||
...existing,
|
||||
pid: child.pid,
|
||||
startTime: processStartTime(child.pid),
|
||||
processGroup,
|
||||
starting: false,
|
||||
});
|
||||
};
|
||||
|
||||
const taskFor = (modern) => (modern ? "build-app-modern" : "build-app");
|
||||
|
||||
const reportExisting = (existing) => {
|
||||
if (existing?.kind === "output") {
|
||||
process.stdout.write(
|
||||
`${describeOutputOwner(existing)} already owns the build and development workflow` +
|
||||
`${existing.pid ? ` (pid ${existing.pid})` : ""}.\n`
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (existing?.kind === "dev") {
|
||||
const command = devCommand(existing.suite);
|
||||
process.stdout.write(
|
||||
`Dev server (${existing.suite}) already running` +
|
||||
`${existing.pid ? ` (pid ${existing.pid})` : ""}.\n` +
|
||||
` Stop: pnpm ${command} --stop\n` +
|
||||
` Status: pnpm ${command} --status\n` +
|
||||
` Logs: pnpm ${command} --logs\n`
|
||||
);
|
||||
return;
|
||||
}
|
||||
process.stdout.write(
|
||||
`Frontend ${existing?.modern ? "modern " : ""}build already running` +
|
||||
`${existing?.pid ? ` (pid ${existing.pid})` : ""}.\n${hints()}`
|
||||
);
|
||||
};
|
||||
|
||||
const runForeground = async (modern) => {
|
||||
const lock = await acquireBuild(modern, true);
|
||||
if (!lock.token) {
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
return await spawnForeground({
|
||||
cmd: gulpBin,
|
||||
args: [taskFor(modern)],
|
||||
cwd: repoRoot,
|
||||
env: workflowLockEnv(lock.token),
|
||||
processGroup: true,
|
||||
onSpawn: (child) => updateBuild(lock.token, child, true),
|
||||
});
|
||||
} finally {
|
||||
releaseBuild(lock.token);
|
||||
}
|
||||
};
|
||||
|
||||
const runBackground = async (modern) => {
|
||||
const lock = await acquireBuild(modern, false);
|
||||
if (!lock.token) {
|
||||
return 1;
|
||||
}
|
||||
let child;
|
||||
try {
|
||||
child = await spawnDetachedToLog({
|
||||
cmd: gulpBin,
|
||||
args: [taskFor(modern)],
|
||||
cwd: repoRoot,
|
||||
env: workflowLockEnv(lock.token),
|
||||
logFile,
|
||||
});
|
||||
updateBuild(lock.token, child, true);
|
||||
process.stdout.write(
|
||||
`Started ${modern ? "modern " : ""}frontend build (pid ${child.pid})\n` +
|
||||
hints()
|
||||
);
|
||||
return 0;
|
||||
} catch (err) {
|
||||
if (child) {
|
||||
await terminateDetachedProcess(child);
|
||||
}
|
||||
releaseBuild(lock.token);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const runStatus = () => {
|
||||
const existing = readBuild();
|
||||
if (existing?.kind === "build" && isProcessRecordAlive(existing)) {
|
||||
process.stdout.write(
|
||||
`Frontend ${existing.modern ? "modern " : ""}build running (pid ${existing.pid}).\n`
|
||||
);
|
||||
} else {
|
||||
if (existing?.kind === "build") {
|
||||
releaseBuild(existing.token);
|
||||
}
|
||||
process.stdout.write("Frontend build not running.\n");
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const runStop = async () => {
|
||||
let existing = readBuild();
|
||||
if (existing?.kind !== "build") {
|
||||
process.stdout.write("Frontend build not running.\n");
|
||||
return 0;
|
||||
}
|
||||
if (existing?.starting) {
|
||||
const token = existing.token;
|
||||
await waitFor(
|
||||
() => {
|
||||
const current = readBuild();
|
||||
return !current?.starting || current.token !== token;
|
||||
},
|
||||
100,
|
||||
5000
|
||||
);
|
||||
existing = readBuild();
|
||||
}
|
||||
if (
|
||||
!existing ||
|
||||
existing.kind !== "build" ||
|
||||
!isProcessRecordAlive(existing)
|
||||
) {
|
||||
if (existing) releaseBuild(existing.token);
|
||||
process.stdout.write("Frontend build not running.\n");
|
||||
return 0;
|
||||
}
|
||||
if (
|
||||
!(await terminateProcess({
|
||||
pid: existing.pid,
|
||||
processGroup: existing.processGroup,
|
||||
isStopped: () => !isProcessRecordAlive(existing),
|
||||
}))
|
||||
) {
|
||||
process.stderr.write(
|
||||
`Failed to stop frontend build (pid ${existing.pid}). Stop it manually.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
releaseBuild(existing.token);
|
||||
process.stdout.write(`Stopped frontend build (pid ${existing.pid}).\n`);
|
||||
return 0;
|
||||
};
|
||||
|
||||
const runLogs = (follow) =>
|
||||
outputLog(logFile, follow, `No frontend build log yet (${logFile}).\n`);
|
||||
|
||||
const main = async () => {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
if (args.unknown.length) {
|
||||
process.stderr.write(`Unknown arguments: ${args.unknown.join(" ")}\n`);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (args.modes.length > 1 || (args.follow && args.mode !== "logs")) {
|
||||
process.stderr.write("Invalid combination of build arguments.\n");
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
const handlers = {
|
||||
foreground: () => runForeground(args.modern),
|
||||
background: () => runBackground(args.modern),
|
||||
status: runStatus,
|
||||
stop: runStop,
|
||||
logs: () => runLogs(args.follow),
|
||||
};
|
||||
return handlers[args.mode]();
|
||||
};
|
||||
|
||||
runCli(main);
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"_comment": "Initial JS budget (raw/uncompressed bytes) for the cold-load critical entrypoints. Enforced by build-scripts/check-bundle-size.cjs in CI. Re-seed after an intentional change with `--update --headroom=<percent>`.",
|
||||
"frontend-modern": {
|
||||
"app": 624240,
|
||||
"core": 55144,
|
||||
"authorize": 594400,
|
||||
"onboarding": 705499
|
||||
},
|
||||
"frontend-legacy": {
|
||||
"app": 776696,
|
||||
"core": 188309,
|
||||
"authorize": 763316,
|
||||
"onboarding": 879807
|
||||
}
|
||||
}
|
||||
@@ -1,376 +0,0 @@
|
||||
const path = require("path");
|
||||
const env = require("./env.cjs");
|
||||
const paths = require("./paths.cjs");
|
||||
const { dependencies } = require("../package.json");
|
||||
|
||||
const BABEL_PLUGINS = path.join(__dirname, "babel-plugins");
|
||||
|
||||
// GitHub base URL to use for production source maps
|
||||
// Nightly builds use the commit SHA, otherwise assumes there is a tag that matches the version
|
||||
module.exports.sourceMapURL = () => {
|
||||
const ref = env.version().endsWith("dev")
|
||||
? process.env.GITHUB_SHA || "dev"
|
||||
: env.version();
|
||||
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}/`;
|
||||
};
|
||||
|
||||
// Files from NPM Packages that should not be imported
|
||||
module.exports.ignorePackages = () => [];
|
||||
|
||||
// Files from NPM packages that we should replace with empty file
|
||||
module.exports.emptyPackages = ({ isLandingPageBuild }) =>
|
||||
[
|
||||
// Icons in landingpage conflict with icons in HA so we don't load.
|
||||
isLandingPageBuild &&
|
||||
require.resolve(
|
||||
path.resolve(paths.root_dir, "src/components/ha-icon.ts")
|
||||
),
|
||||
isLandingPageBuild &&
|
||||
require.resolve(
|
||||
path.resolve(paths.root_dir, "src/components/ha-icon-picker.ts")
|
||||
),
|
||||
].filter(Boolean);
|
||||
|
||||
// MapLibre runs its tile work in a worker that it spawns from a URL. The
|
||||
// package ships that worker as untranspiled ES2022, so it is bundled here as
|
||||
// its own entry per build target, like the rest of MapLibre. One self-contained
|
||||
// file: the worker cannot import chunks, and a classic-compatible script runs
|
||||
// wherever the main bundle does, module workers or not. The layer keeps the
|
||||
// page's polyfills out of it; see `babelOptions`.
|
||||
const MAP_WORKER_NAME = "maplibre-gl-worker";
|
||||
module.exports.mapWorkerName = MAP_WORKER_NAME;
|
||||
module.exports.mapWorkerEntry = () => ({
|
||||
[MAP_WORKER_NAME]: {
|
||||
import: "maplibre-gl/dist/maplibre-gl-worker.mjs",
|
||||
chunkLoading: false,
|
||||
layer: "worker",
|
||||
},
|
||||
});
|
||||
// MapLibre is handed the URL at build time, so the name cannot carry a content
|
||||
// hash. The frontend version stands in for it, in the file name rather than a
|
||||
// query string: the service worker precaches everything under the bundle
|
||||
// directory as immutable and matches it with the query stripped, so a `?v=`
|
||||
// would keep serving the worker of the first version it ever cached.
|
||||
module.exports.mapWorkerFilename = () =>
|
||||
`${MAP_WORKER_NAME}.${env.version()}.js`;
|
||||
|
||||
module.exports.definedVars = ({
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
publicPath,
|
||||
defineOverlay,
|
||||
}) => ({
|
||||
__DEV__: !isProdBuild,
|
||||
__BUILD__: JSON.stringify(latestBuild ? "modern" : "legacy"),
|
||||
__VERSION__: JSON.stringify(env.version()),
|
||||
__DEMO__: false,
|
||||
__BACKWARDS_COMPAT__: false,
|
||||
__STATIC_PATH__: "/static/",
|
||||
__MAPLIBRE_WORKER_URL__: JSON.stringify(
|
||||
`${publicPath}${module.exports.mapWorkerFilename()}`
|
||||
),
|
||||
__HASS_URL__: `\`${
|
||||
"HASS_URL" in process.env
|
||||
? process.env.HASS_URL
|
||||
: // eslint-disable-next-line no-template-curly-in-string
|
||||
"${location.protocol}//${location.host}"
|
||||
}\``,
|
||||
"process.env.NODE_ENV": JSON.stringify(
|
||||
isProdBuild ? "production" : "development"
|
||||
),
|
||||
...defineOverlay,
|
||||
});
|
||||
|
||||
module.exports.htmlMinifierOptions = {
|
||||
caseSensitive: true,
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true,
|
||||
decodeEntities: true,
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
minifyCSS: {
|
||||
compatibility: "*,-properties.zeroUnits",
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||
// Highest syntax the minifier may emit; it never downlevels. Every browser
|
||||
// in [modern] is well past ES2020 (universal since spring 2020); the
|
||||
// [legacy] floors (Chrome 59 / Safari 12) top out at ES2017.
|
||||
ecma: latestBuild ? 2020 : 2017,
|
||||
module: latestBuild,
|
||||
format: { comments: false },
|
||||
sourceMap: !isTestBuild,
|
||||
});
|
||||
|
||||
/** @type {import('@rspack/core').SwcLoaderOptions} */
|
||||
module.exports.swcOptions = () => ({
|
||||
jsc: {
|
||||
loose: true,
|
||||
externalHelpers: true,
|
||||
target: "ES2021",
|
||||
parser: {
|
||||
syntax: "typescript",
|
||||
decorators: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
module.exports.babelOptions = ({ latestBuild, isTestBuild, sw, worker }) => ({
|
||||
babelrc: false,
|
||||
compact: false,
|
||||
assumptions: {
|
||||
privateFieldsAsProperties: true,
|
||||
setPublicClassFields: true,
|
||||
setSpreadProperties: true,
|
||||
},
|
||||
browserslistEnv: latestBuild ? "modern" : `legacy${sw ? "-sw" : ""}`,
|
||||
presets: [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
shippedProposals: true,
|
||||
},
|
||||
],
|
||||
],
|
||||
plugins: [
|
||||
// Inject Core-JS polyfills on demand. Babel 8 removed preset-env's
|
||||
// `useBuiltIns`/`corejs` options, so the equivalent polyfill provider is
|
||||
// configured directly here (`usage-global` matches the old `useBuiltIns: "usage"`).
|
||||
[
|
||||
"babel-plugin-polyfill-corejs3",
|
||||
{
|
||||
method: "usage-global",
|
||||
version: dependencies["core-js"],
|
||||
shippedProposals: true,
|
||||
},
|
||||
],
|
||||
[
|
||||
path.join(BABEL_PLUGINS, "inline-constants-plugin.cjs"),
|
||||
{
|
||||
modules: ["@mdi/js"],
|
||||
ignoreModuleNotFound: true,
|
||||
},
|
||||
],
|
||||
// Import helpers from runtime package.
|
||||
// `moduleName` is pinned so helpers resolve from `@babel/runtime`: the
|
||||
// corejs3 polyfill provider above otherwise redirects them to the
|
||||
// (uninstalled) `@babel/runtime-corejs3`, which preset-env used to suppress
|
||||
// internally when it owned the polyfill injection via `useBuiltIns`.
|
||||
[
|
||||
"@babel/plugin-transform-runtime",
|
||||
{ version: dependencies["@babel/runtime"], moduleName: "@babel/runtime" },
|
||||
],
|
||||
"@babel/plugin-transform-class-properties",
|
||||
"@babel/plugin-transform-private-methods",
|
||||
].filter(Boolean),
|
||||
exclude: [
|
||||
// \\ for Windows, / for Mac OS and Linux
|
||||
/node_modules[\\/]core-js/,
|
||||
],
|
||||
sourceMaps: !isTestBuild,
|
||||
overrides: [
|
||||
// Add plugin to inject various polyfills, excluding the polyfills
|
||||
// themselves to prevent self-injection. Not in a worker: these polyfill
|
||||
// the page (Intl locale data, DOM APIs) and assume one, so injecting them
|
||||
// into a worker's graph makes its bootstrap fail before it starts.
|
||||
!worker && {
|
||||
plugins: [
|
||||
[
|
||||
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.js"),
|
||||
{ method: "usage-global" },
|
||||
],
|
||||
],
|
||||
exclude: [
|
||||
path.join(paths.root_dir, "src/resources/polyfills"),
|
||||
...[
|
||||
"@formatjs/(?:ecma402-abstract|intl-\\w+)",
|
||||
"@lit-labs/virtualizer/polyfills",
|
||||
"@webcomponents/scoped-custom-element-registry",
|
||||
"element-internals-polyfill",
|
||||
].map((p) => new RegExp(`/node_modules/${p}/`)),
|
||||
],
|
||||
},
|
||||
{
|
||||
// Use unambiguous for dependencies so that require() is correctly injected into CommonJS files
|
||||
// Exclusions are needed in some cases where ES modules have no static imports or exports, such as polyfills
|
||||
// (otherwise babel-plugin-polyfill-corejs3 injects bare require("core-js/modules/...") calls
|
||||
// that rspack does not transform, causing ReferenceError in browsers like Safari 14).
|
||||
sourceType: "unambiguous",
|
||||
include: /\/node_modules\//,
|
||||
exclude: [
|
||||
"element-internals-polyfill",
|
||||
"@?lit(?:-labs|-element|-html)?",
|
||||
"@formatjs/(?:ecma402-abstract|intl-\\w+)",
|
||||
].map((p) => new RegExp(`/node_modules/${p}/`)),
|
||||
},
|
||||
].filter(Boolean),
|
||||
});
|
||||
|
||||
const nameSuffix = (latestBuild) => (latestBuild ? "-modern" : "-legacy");
|
||||
|
||||
const outputPath = (outputRoot, latestBuild) =>
|
||||
path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5");
|
||||
|
||||
const publicPath = (latestBuild, root = "") =>
|
||||
latestBuild ? `${root}/frontend_latest/` : `${root}/frontend_es5/`;
|
||||
|
||||
/*
|
||||
BundleConfig {
|
||||
// Object with entrypoints that need to be bundled
|
||||
entry: { [name: string]: pathToFile },
|
||||
// Folder where bundled files need to be written
|
||||
outputPath: string,
|
||||
// absolute url-path where bundled files can be found
|
||||
publicPath: string,
|
||||
// extra definitions that we need to replace in source
|
||||
defineOverlay: {[name: string]: value },
|
||||
// if this is a production build
|
||||
isProdBuild: boolean,
|
||||
// If we're targeting latest browsers
|
||||
latestBuild: boolean,
|
||||
// If we're doing a stats build (create nice chunk names)
|
||||
isStatsBuild: boolean,
|
||||
// If it's just a test build in CI, skip time on source map generation
|
||||
isTestBuild: boolean,
|
||||
// Names of entrypoints that should not be hashed
|
||||
dontHash: Set<string>
|
||||
}
|
||||
*/
|
||||
|
||||
module.exports.config = {
|
||||
app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild, isWDS }) {
|
||||
return {
|
||||
name: "frontend" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
"service-worker": !latestBuild
|
||||
? {
|
||||
import: "./src/entrypoints/service-worker.ts",
|
||||
layer: "sw",
|
||||
}
|
||||
: "./src/entrypoints/service-worker.ts",
|
||||
app: "./src/entrypoints/app.ts",
|
||||
authorize: "./src/entrypoints/authorize.ts",
|
||||
onboarding: "./src/entrypoints/onboarding.ts",
|
||||
core: "./src/entrypoints/core.ts",
|
||||
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
||||
...module.exports.mapWorkerEntry(),
|
||||
},
|
||||
outputPath: outputPath(paths.app_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
isWDS,
|
||||
};
|
||||
},
|
||||
|
||||
demo({ isProdBuild, latestBuild, isStatsBuild, isTestBuild }) {
|
||||
return {
|
||||
name: "demo" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
||||
...module.exports.mapWorkerEntry(),
|
||||
},
|
||||
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
defineOverlay: {
|
||||
__VERSION__: JSON.stringify(`DEMO-${env.version()}`),
|
||||
__DEMO__: true,
|
||||
},
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
};
|
||||
},
|
||||
|
||||
cast({ isProdBuild, latestBuild }) {
|
||||
const entry = {
|
||||
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
||||
media: path.resolve(paths.cast_dir, "src/media/entrypoint.ts"),
|
||||
};
|
||||
|
||||
// Only the receiver renders maps, and it is built for modern browsers only
|
||||
if (latestBuild) {
|
||||
entry.receiver = path.resolve(
|
||||
paths.cast_dir,
|
||||
"src/receiver/entrypoint.ts"
|
||||
);
|
||||
Object.assign(entry, module.exports.mapWorkerEntry());
|
||||
}
|
||||
|
||||
return {
|
||||
name: "cast" + nameSuffix(latestBuild),
|
||||
entry,
|
||||
outputPath: outputPath(paths.cast_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
defineOverlay: {
|
||||
__BACKWARDS_COMPAT__: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
gallery({ isProdBuild, latestBuild, isTestBuild }) {
|
||||
return {
|
||||
name: "gallery" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
entrypoint: path.resolve(paths.gallery_dir, "src/entrypoint.js"),
|
||||
...module.exports.mapWorkerEntry(),
|
||||
},
|
||||
outputPath: outputPath(paths.gallery_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isTestBuild,
|
||||
defineOverlay: {
|
||||
__DEMO__: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
landingPage({ isProdBuild, latestBuild }) {
|
||||
return {
|
||||
name: "landing-page" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
entrypoint: path.resolve(paths.landingPage_dir, "src/entrypoint.js"),
|
||||
},
|
||||
outputPath: outputPath(paths.landingPage_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isLandingPageBuild: true,
|
||||
};
|
||||
},
|
||||
|
||||
e2eTestApp({ isProdBuild, latestBuild, isStatsBuild, isTestBuild }) {
|
||||
return {
|
||||
name: "e2e-test-app" + nameSuffix(latestBuild),
|
||||
entry: {
|
||||
dashboard: path.resolve(
|
||||
paths.e2eTestApp_dir,
|
||||
"src/dashboard-entrypoint.ts"
|
||||
),
|
||||
main: path.resolve(paths.e2eTestApp_dir, "src/entrypoint.ts"),
|
||||
onboarding: path.resolve(
|
||||
paths.e2eTestApp_dir,
|
||||
"src/onboarding-entrypoint.ts"
|
||||
),
|
||||
...module.exports.mapWorkerEntry(),
|
||||
},
|
||||
outputPath: outputPath(paths.e2eTestApp_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
defineOverlay: {
|
||||
__VERSION__: JSON.stringify(`E2E-TEST-${env.version()}`),
|
||||
__DEMO__: true,
|
||||
},
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isTestBuild,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,211 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const path = require("path");
|
||||
const env = require("./env.js");
|
||||
const paths = require("./paths.js");
|
||||
|
||||
// Files from NPM Packages that should not be imported
|
||||
module.exports.ignorePackages = ({ latestBuild }) => [
|
||||
// Part of yaml.js and only used for !!js functions that we don't use
|
||||
require.resolve("esprima"),
|
||||
];
|
||||
|
||||
// Files from NPM packages that we should replace with empty file
|
||||
module.exports.emptyPackages = ({ latestBuild }) =>
|
||||
[
|
||||
// Contains all color definitions for all material color sets.
|
||||
// We don't use it
|
||||
require.resolve("@polymer/paper-styles/color.js"),
|
||||
require.resolve("@polymer/paper-styles/default-theme.js"),
|
||||
// Loads stuff from a CDN
|
||||
require.resolve("@polymer/font-roboto/roboto.js"),
|
||||
require.resolve("@vaadin/vaadin-material-styles/typography.js"),
|
||||
require.resolve("@vaadin/vaadin-material-styles/font-icons.js"),
|
||||
// Compatibility not needed for latest builds
|
||||
latestBuild &&
|
||||
// wrapped in require.resolve so it blows up if file no longer exists
|
||||
require.resolve(
|
||||
path.resolve(paths.polymer_dir, "src/resources/compatibility.ts")
|
||||
),
|
||||
// This polyfill is loaded in workers to support ES5, filter it out.
|
||||
latestBuild && require.resolve("proxy-polyfill/src/index.js"),
|
||||
].filter(Boolean);
|
||||
|
||||
module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||
__DEV__: !isProdBuild,
|
||||
__BUILD__: JSON.stringify(latestBuild ? "latest" : "es5"),
|
||||
__VERSION__: JSON.stringify(env.version()),
|
||||
__DEMO__: false,
|
||||
__BACKWARDS_COMPAT__: false,
|
||||
__STATIC_PATH__: "/static/",
|
||||
"process.env.NODE_ENV": JSON.stringify(
|
||||
isProdBuild ? "production" : "development"
|
||||
),
|
||||
...defineOverlay,
|
||||
});
|
||||
|
||||
module.exports.terserOptions = (latestBuild) => ({
|
||||
safari10: !latestBuild,
|
||||
ecma: latestBuild ? undefined : 5,
|
||||
output: { comments: false },
|
||||
});
|
||||
|
||||
module.exports.babelOptions = ({ latestBuild }) => ({
|
||||
babelrc: false,
|
||||
compact: false,
|
||||
presets: [
|
||||
!latestBuild && [
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: "entry",
|
||||
corejs: "3.15",
|
||||
bugfixes: true,
|
||||
},
|
||||
],
|
||||
"@babel/preset-typescript",
|
||||
].filter(Boolean),
|
||||
plugins: [
|
||||
[
|
||||
path.resolve(
|
||||
paths.polymer_dir,
|
||||
"build-scripts/babel-plugins/inline-constants-plugin.js"
|
||||
),
|
||||
{
|
||||
modules: ["@mdi/js"],
|
||||
ignoreModuleNotFound: true,
|
||||
},
|
||||
],
|
||||
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
||||
!latestBuild && [
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
{ loose: true, useBuiltIns: true },
|
||||
],
|
||||
// Only support the syntax, Webpack will handle it.
|
||||
"@babel/plugin-syntax-import-meta",
|
||||
"@babel/plugin-syntax-dynamic-import",
|
||||
"@babel/plugin-syntax-top-level-await",
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
||||
["@babel/plugin-proposal-private-methods", { loose: true }],
|
||||
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
||||
["@babel/plugin-proposal-class-properties", { loose: true }],
|
||||
].filter(Boolean),
|
||||
exclude: [
|
||||
// \\ for Windows, / for Mac OS and Linux
|
||||
/node_modules[\\/]core-js/,
|
||||
/node_modules[\\/]webpack[\\/]buildin/,
|
||||
],
|
||||
});
|
||||
|
||||
const outputPath = (outputRoot, latestBuild) =>
|
||||
path.resolve(outputRoot, latestBuild ? "frontend_latest" : "frontend_es5");
|
||||
|
||||
const publicPath = (latestBuild, root = "") =>
|
||||
latestBuild ? `${root}/frontend_latest/` : `${root}/frontend_es5/`;
|
||||
|
||||
/*
|
||||
BundleConfig {
|
||||
// Object with entrypoints that need to be bundled
|
||||
entry: { [name: string]: pathToFile },
|
||||
// Folder where bundled files need to be written
|
||||
outputPath: string,
|
||||
// absolute url-path where bundled files can be found
|
||||
publicPath: string,
|
||||
// extra definitions that we need to replace in source
|
||||
defineOverlay: {[name: string]: value },
|
||||
// if this is a production build
|
||||
isProdBuild: boolean,
|
||||
// If we're targeting latest browsers
|
||||
latestBuild: boolean,
|
||||
// If we're doing a stats build (create nice chunk names)
|
||||
isStatsBuild: boolean,
|
||||
// Names of entrypoints that should not be hashed
|
||||
dontHash: Set<string>
|
||||
}
|
||||
*/
|
||||
|
||||
module.exports.config = {
|
||||
app({ isProdBuild, latestBuild, isStatsBuild, isWDS }) {
|
||||
return {
|
||||
entry: {
|
||||
service_worker: "./src/entrypoints/service_worker.ts",
|
||||
app: "./src/entrypoints/app.ts",
|
||||
authorize: "./src/entrypoints/authorize.ts",
|
||||
onboarding: "./src/entrypoints/onboarding.ts",
|
||||
core: "./src/entrypoints/core.ts",
|
||||
"custom-panel": "./src/entrypoints/custom-panel.ts",
|
||||
},
|
||||
outputPath: outputPath(paths.app_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
isWDS,
|
||||
};
|
||||
},
|
||||
|
||||
demo({ isProdBuild, latestBuild, isStatsBuild }) {
|
||||
return {
|
||||
entry: {
|
||||
main: path.resolve(paths.demo_dir, "src/entrypoint.ts"),
|
||||
},
|
||||
outputPath: outputPath(paths.demo_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
defineOverlay: {
|
||||
__VERSION__: JSON.stringify(`DEMO-${env.version()}`),
|
||||
__DEMO__: true,
|
||||
},
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
isStatsBuild,
|
||||
};
|
||||
},
|
||||
|
||||
cast({ isProdBuild, latestBuild }) {
|
||||
const entry = {
|
||||
launcher: path.resolve(paths.cast_dir, "src/launcher/entrypoint.ts"),
|
||||
};
|
||||
|
||||
if (latestBuild) {
|
||||
entry.receiver = path.resolve(
|
||||
paths.cast_dir,
|
||||
"src/receiver/entrypoint.ts"
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
entry,
|
||||
outputPath: outputPath(paths.cast_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
defineOverlay: {
|
||||
__BACKWARDS_COMPAT__: true,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
hassio({ isProdBuild, latestBuild }) {
|
||||
return {
|
||||
entry: {
|
||||
entrypoint: path.resolve(paths.hassio_dir, "src/entrypoint.ts"),
|
||||
},
|
||||
outputPath: outputPath(paths.hassio_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild, paths.hassio_publicPath),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
};
|
||||
},
|
||||
|
||||
gallery({ isProdBuild, latestBuild }) {
|
||||
return {
|
||||
entry: {
|
||||
entrypoint: path.resolve(paths.gallery_dir, "src/entrypoint.js"),
|
||||
},
|
||||
outputPath: outputPath(paths.gallery_output_root, latestBuild),
|
||||
publicPath: publicPath(latestBuild),
|
||||
isProdBuild,
|
||||
latestBuild,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -1,155 +0,0 @@
|
||||
/* global require, process, __dirname */
|
||||
// Enforce a strict size budget on the initial JS of the most critical
|
||||
// entrypoints (`app` and `core`). These two are downloaded on every cold load
|
||||
// before anything interactive can happen, so unintended growth here hurts
|
||||
// first-load performance directly.
|
||||
//
|
||||
// In production rspack does not split initial chunks (splitChunks only operates
|
||||
// on `!chunk.canBeInitial()`), so each entrypoint resolves to a single initial
|
||||
// JS asset. We read the per-build stats written by StatsWriterPlugin and compare
|
||||
// the entrypoint's initial JS size against a committed budget.
|
||||
//
|
||||
// Usage:
|
||||
// node build-scripts/check-bundle-size.cjs # enforce, exit 1 on regression
|
||||
// node build-scripts/check-bundle-size.cjs --update # rewrite budgets from current sizes
|
||||
// node build-scripts/check-bundle-size.cjs --update --headroom=3 # current + 3% headroom
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const paths = require("./paths.cjs");
|
||||
|
||||
// Entrypoints whose initial JS we hold to a strict budget. These are all
|
||||
// downloaded on a user-facing cold load before anything interactive can happen:
|
||||
// `app`/`core` for the main app, plus the standalone `authorize` and
|
||||
// `onboarding` pages. `custom-panel` is intentionally excluded (only loaded
|
||||
// when a custom panel is opened).
|
||||
const TRACKED_ENTRYPOINTS = ["app", "core", "authorize", "onboarding"];
|
||||
|
||||
// App build stats files, as written by StatsWriterPlugin (`${name}.json`).
|
||||
const BUILDS = ["frontend-modern", "frontend-legacy"];
|
||||
|
||||
const BUDGET_FILE = path.join(__dirname, "bundle-budget.json");
|
||||
const STATS_DIR = path.join(paths.build_dir, "stats");
|
||||
|
||||
const readStats = (build) => {
|
||||
const file = path.join(STATS_DIR, `${build}.json`);
|
||||
if (!fs.existsSync(file)) {
|
||||
throw new Error(
|
||||
`Missing stats file: ${path.relative(process.cwd(), file)}.\n` +
|
||||
`Run a production build first (e.g. \`gulp build-app\`), then re-run this check.`
|
||||
);
|
||||
}
|
||||
return JSON.parse(fs.readFileSync(file, "utf8"));
|
||||
};
|
||||
|
||||
// Initial JS bytes for an entrypoint = sum of the .js asset sizes of its initial
|
||||
// entry chunk(s). Sizes are raw (uncompressed) bytes, matching the stats output.
|
||||
const entrypointInitialJS = (stats, entrypoint) => {
|
||||
const assetSize = new Map(stats.assets.map((a) => [a.name, a.size]));
|
||||
let total = 0;
|
||||
let found = false;
|
||||
for (const chunk of stats.chunks) {
|
||||
if (!chunk.entry || !chunk.initial) {
|
||||
continue;
|
||||
}
|
||||
if (!(chunk.names || []).includes(entrypoint)) {
|
||||
continue;
|
||||
}
|
||||
found = true;
|
||||
for (const file of chunk.files || []) {
|
||||
if (file.endsWith(".js") && assetSize.has(file)) {
|
||||
total += assetSize.get(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
throw new Error(`Entrypoint "${entrypoint}" not found in bundle stats.`);
|
||||
}
|
||||
return total;
|
||||
};
|
||||
|
||||
const kib = (bytes) => `${(bytes / 1024).toFixed(1)} KiB`;
|
||||
|
||||
const main = () => {
|
||||
const update = process.argv.includes("--update");
|
||||
const headroomArg = process.argv.find((a) => a.startsWith("--headroom="));
|
||||
const headroom = headroomArg ? Number(headroomArg.split("=")[1]) : 0;
|
||||
|
||||
const current = {};
|
||||
for (const build of BUILDS) {
|
||||
const stats = readStats(build);
|
||||
current[build] = {};
|
||||
for (const entrypoint of TRACKED_ENTRYPOINTS) {
|
||||
current[build][entrypoint] = entrypointInitialJS(stats, entrypoint);
|
||||
}
|
||||
}
|
||||
|
||||
if (update) {
|
||||
const budget = { _comment: BUDGET_COMMENT };
|
||||
for (const build of BUILDS) {
|
||||
budget[build] = {};
|
||||
for (const entrypoint of TRACKED_ENTRYPOINTS) {
|
||||
budget[build][entrypoint] = Math.ceil(
|
||||
current[build][entrypoint] * (1 + headroom / 100)
|
||||
);
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(BUDGET_FILE, `${JSON.stringify(budget, null, 2)}\n`);
|
||||
console.log(
|
||||
`Updated ${path.relative(process.cwd(), BUDGET_FILE)} from current sizes` +
|
||||
(headroom ? ` (+${headroom}% headroom).` : ".")
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fs.existsSync(BUDGET_FILE)) {
|
||||
throw new Error(
|
||||
`Missing budget file ${path.relative(process.cwd(), BUDGET_FILE)}.\n` +
|
||||
`Seed it from a production build with: node build-scripts/check-bundle-size.cjs --update --headroom=3`
|
||||
);
|
||||
}
|
||||
const budget = JSON.parse(fs.readFileSync(BUDGET_FILE, "utf8"));
|
||||
|
||||
let failed = false;
|
||||
console.log("Initial JS budget (entry chunks, raw bytes):\n");
|
||||
for (const build of BUILDS) {
|
||||
for (const entrypoint of TRACKED_ENTRYPOINTS) {
|
||||
const actual = current[build][entrypoint];
|
||||
const limit = budget[build] && budget[build][entrypoint];
|
||||
if (typeof limit !== "number") {
|
||||
failed = true;
|
||||
console.log(
|
||||
` ✗ ${build} / ${entrypoint}: no budget set (current ${kib(actual)})`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
const ok = actual <= limit;
|
||||
const delta = (((actual - limit) / limit) * 100).toFixed(1);
|
||||
console.log(
|
||||
` ${ok ? "✓" : "✗"} ${build} / ${entrypoint}: ` +
|
||||
`${kib(actual)} / ${kib(limit)}${ok ? "" : ` (+${delta}% over budget)`}`
|
||||
);
|
||||
if (!ok) {
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
console.error(
|
||||
"\nInitial JS budget exceeded for a critical entrypoint.\n" +
|
||||
"Investigate what was pulled into the entry chunk (a static import that should be lazy?).\n" +
|
||||
"If the growth is intentional, re-seed the budget:\n" +
|
||||
" node build-scripts/check-bundle-size.cjs --update --headroom=3"
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("\nAll tracked entrypoints within budget.");
|
||||
};
|
||||
|
||||
const BUDGET_COMMENT =
|
||||
"Initial JS budget (raw/uncompressed bytes) for the cold-load critical entrypoints. " +
|
||||
"Enforced by build-scripts/check-bundle-size.cjs in CI. " +
|
||||
"Re-seed after an intentional change with `--update --headroom=<percent>`.";
|
||||
|
||||
main();
|
||||
@@ -1,212 +0,0 @@
|
||||
// Content-addressed cache for compression output.
|
||||
//
|
||||
// brotli (quality 11) and zopfli are the slowest part of a production build,
|
||||
// and they redo every file from scratch on every run. But production chunks are
|
||||
// content-hashed in their filenames, so a chunk that didn't change produces
|
||||
// byte-identical input here. Keying the compressed output by a hash of the
|
||||
// input bytes lets an unchanged file skip compression entirely, and lets a
|
||||
// nightly build warm the cache a release reuses the next day.
|
||||
//
|
||||
// Disabled unless COMPRESS_CACHE_DIR points at a directory. Local builds set
|
||||
// nothing and behave exactly as before. The compressed bytes are unchanged
|
||||
// either way; only whether they were recomputed differs.
|
||||
|
||||
import { createHash } from "node:crypto";
|
||||
import { existsSync } from "node:fs";
|
||||
import {
|
||||
mkdir,
|
||||
readFile,
|
||||
readdir,
|
||||
rename,
|
||||
rm,
|
||||
stat,
|
||||
utimes,
|
||||
writeFile,
|
||||
} from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const rootDir = process.env.COMPRESS_CACHE_DIR;
|
||||
export const cacheEnabled = Boolean(rootDir);
|
||||
|
||||
// Total cache size to keep across builds, least-recently-used first when over.
|
||||
// The cache is shared between branches (a dev nightly warms it for a release,
|
||||
// which builds from rc/master), so pruning must NOT drop everything the current
|
||||
// build didn't touch — that would make each branch evict the other's
|
||||
// branch-specific files every run. Instead the current build is pinned and the
|
||||
// rest is kept up to this budget, so nothing is dropped unless the cache is
|
||||
// genuinely too large. Override with COMPRESS_CACHE_MAX_BYTES.
|
||||
const DEFAULT_MAX_BYTES = 1024 * 1024 * 1024; // 1 GiB
|
||||
const maxBytes = () => {
|
||||
// A valid, explicit budget wins — including 0, which keeps only the current
|
||||
// build (evict everything else). An unset or invalid value uses the default.
|
||||
const configured = Number(process.env.COMPRESS_CACHE_MAX_BYTES);
|
||||
return Number.isFinite(configured) && configured >= 0
|
||||
? configured
|
||||
: DEFAULT_MAX_BYTES;
|
||||
};
|
||||
|
||||
// Every cache key touched this build, hits and writes alike, so a prune can pin
|
||||
// the current dist and never evict a file this build depends on.
|
||||
const touched = new Set();
|
||||
|
||||
// Per-namespace directory, created lazily and only once.
|
||||
const dirs = new Map();
|
||||
|
||||
let tmpCounter = 0;
|
||||
|
||||
const sha256 = (contents) =>
|
||||
createHash("sha256").update(contents).digest("hex");
|
||||
|
||||
const namespaceDir = (namespace) => {
|
||||
let dir = dirs.get(namespace);
|
||||
if (!dir) {
|
||||
const dirPath = path.join(rootDir, namespace);
|
||||
dir = { path: dirPath, ready: undefined };
|
||||
dirs.set(namespace, dir);
|
||||
}
|
||||
return dir;
|
||||
};
|
||||
|
||||
const ensureDir = (dir) => {
|
||||
dir.ready ??= mkdir(dir.path, { recursive: true });
|
||||
return dir.ready;
|
||||
};
|
||||
|
||||
// Written via a unique temp file and renamed into place so a concurrent reader
|
||||
// in the same build never sees a half-written entry (rename is atomic on the
|
||||
// same filesystem).
|
||||
const writeAtomic = async (dir, name, contents) => {
|
||||
await ensureDir(dir);
|
||||
tmpCounter += 1;
|
||||
const tmp = path.join(dir.path, `.${process.pid}-${tmpCounter}.tmp`);
|
||||
const dest = path.join(dir.path, name);
|
||||
await writeFile(tmp, contents);
|
||||
try {
|
||||
await rename(tmp, dest);
|
||||
} catch (error) {
|
||||
// Two files with identical contents can miss and write the same entry at
|
||||
// once. On POSIX the rename just overwrites, but Windows rejects a rename
|
||||
// onto an existing path. Either way the destination already holds the same
|
||||
// bytes (content-addressed), so drop our temp and treat it as done.
|
||||
if (existsSync(dest)) {
|
||||
await rm(tmp, { force: true });
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the cached compression result for `contents`, or run `compute` and
|
||||
* cache what it returns. `compute` resolves to a Buffer for compressed output,
|
||||
* or `undefined` when the file should be dropped (brotli skipLarger); both
|
||||
* outcomes are cached, so a dropped file is not recompressed on the next build.
|
||||
*
|
||||
* @param {string} namespace Isolates entries by algorithm, parameters and tool
|
||||
* version, so a change to any of them can never return a stale result.
|
||||
* @param {Buffer} contents Uncompressed input bytes, used as the cache key.
|
||||
* @param {() => Promise<Buffer | undefined>} compute Runs on a cache miss.
|
||||
* @returns {Promise<Buffer | undefined>}
|
||||
*/
|
||||
export const withCache = async (namespace, contents, compute) => {
|
||||
if (!cacheEnabled) {
|
||||
return compute();
|
||||
}
|
||||
|
||||
const dir = namespaceDir(namespace);
|
||||
const hash = sha256(contents);
|
||||
touched.add(`${namespace}/${hash}`);
|
||||
|
||||
const dataPath = path.join(dir.path, hash);
|
||||
const dropName = `${hash}.drop`;
|
||||
|
||||
try {
|
||||
return await readFile(dataPath);
|
||||
} catch {
|
||||
// Miss (or unreadable) — fall through and compute.
|
||||
}
|
||||
if (existsSync(path.join(dir.path, dropName))) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result = await compute();
|
||||
if (result === undefined) {
|
||||
await writeAtomic(dir, dropName, "");
|
||||
} else {
|
||||
await writeAtomic(dir, hash, result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Keep the cache under `maxBytes`, evicting least-recently-used entries first.
|
||||
* Files this build touched are always kept (and their timestamp refreshed, so
|
||||
* shared files stay warm across branches); the remainder — including another
|
||||
* branch's entries — is kept up to the budget. No-op when the cache is disabled
|
||||
* or nothing was compressed, so it never wipes a warm cache on a build that
|
||||
* skipped compression.
|
||||
*/
|
||||
export const pruneCache = async () => {
|
||||
if (!cacheEnabled || touched.size === 0 || !existsSync(rootDir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
const pinned = [];
|
||||
const others = [];
|
||||
|
||||
// Scan every namespace on disk, not just the ones this build used, so entries
|
||||
// from an old tool version (a different namespace) are eligible for eviction.
|
||||
const namespaces = await readdir(rootDir, { withFileTypes: true });
|
||||
await Promise.all(
|
||||
namespaces.map(async (ns) => {
|
||||
if (!ns.isDirectory()) {
|
||||
return;
|
||||
}
|
||||
const nsDir = path.join(rootDir, ns.name);
|
||||
const entries = await readdir(nsDir);
|
||||
await Promise.all(
|
||||
entries.map(async (entry) => {
|
||||
const entryPath = path.join(nsDir, entry);
|
||||
// Stray temp files from an interrupted write are never valid entries.
|
||||
if (entry.endsWith(".tmp")) {
|
||||
await rm(entryPath, { force: true });
|
||||
return;
|
||||
}
|
||||
const hash = entry.endsWith(".drop") ? entry.slice(0, -5) : entry;
|
||||
const info = await stat(entryPath);
|
||||
if (touched.has(`${ns.name}/${hash}`)) {
|
||||
pinned.push({ entryPath, size: info.size });
|
||||
} else {
|
||||
others.push({ entryPath, size: info.size, mtimeMs: info.mtimeMs });
|
||||
}
|
||||
})
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
// Pinned files stay and are refreshed so they rank as most-recently-used for
|
||||
// future prunes; they always count against the budget first.
|
||||
let kept = 0;
|
||||
await Promise.all(
|
||||
pinned.map(async ({ entryPath, size }) => {
|
||||
kept += size;
|
||||
// A failed timestamp refresh only affects future LRU ordering, not
|
||||
// correctness, so it is safe to ignore.
|
||||
await utimes(entryPath, now, now).catch(() => undefined);
|
||||
})
|
||||
);
|
||||
|
||||
// Keep the most-recently-used others until the budget is spent; drop the rest.
|
||||
others.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
||||
const budget = maxBytes();
|
||||
const toDelete = [];
|
||||
for (const entry of others) {
|
||||
if (kept + entry.size <= budget) {
|
||||
kept += entry.size;
|
||||
} else {
|
||||
toDelete.push(entry.entryPath);
|
||||
}
|
||||
}
|
||||
await Promise.all(toDelete.map((p) => rm(p, { force: true })));
|
||||
};
|
||||
@@ -1,761 +0,0 @@
|
||||
// Manage a Home Assistant frontend dev server with an agent-friendly interface.
|
||||
//
|
||||
// node build-scripts/dev-server.mjs --suite <suite> [mode] [extra args]
|
||||
//
|
||||
// (no mode) Run in the foreground.
|
||||
// --background Start detached, wait until it is ready, print the URL
|
||||
// (when it has one) and pid, then exit and leave it running.
|
||||
// --status Report whether the suite's dev server is running.
|
||||
// --stop Stop a running background dev server.
|
||||
// --logs [--follow] Print (or follow) the background dev server log.
|
||||
// --fetch-translations
|
||||
// Fetch nightly translations before starting (app,
|
||||
// app-serve, demo, and gallery only).
|
||||
//
|
||||
// Extra args (for example -p or -c on app-serve) are forwarded to the underlying
|
||||
// script. Suites use one of two liveness models:
|
||||
//
|
||||
// health demo, gallery, e2e-app: a fixed port plus the /__ha_dev_status
|
||||
// endpoint each dev server exposes (see runDevServer in
|
||||
// build-scripts/gulp/rspack.js).
|
||||
// process app (pnpm dev) and app-serve (pnpm dev:serve): plain pnpm dev has
|
||||
// no port, so these treat the first "Build done" log line as ready.
|
||||
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import {
|
||||
LIFECYCLE_MODE_FLAGS,
|
||||
acquireProcessRecord,
|
||||
detectCodingAgent,
|
||||
isProcessRecordAlive,
|
||||
outputLog,
|
||||
offerToStopProcessRecord,
|
||||
processStartTime,
|
||||
readProcessRecord,
|
||||
releaseProcessRecord,
|
||||
runCli,
|
||||
sleep,
|
||||
spawnDetachedToLog,
|
||||
spawnForeground,
|
||||
terminateDetachedProcess,
|
||||
terminateProcess,
|
||||
writeProcessRecord,
|
||||
} from "./managed-process.mjs";
|
||||
import {
|
||||
buildCacheDir,
|
||||
describeOutputOwner,
|
||||
workflowLockEnv,
|
||||
workflowLockFile,
|
||||
} from "./output-lock.mjs";
|
||||
|
||||
const repoRoot = path.resolve(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
".."
|
||||
);
|
||||
const gulpBin = path.join(repoRoot, "node_modules", ".bin", "gulp");
|
||||
const developAndServeScript = path.join(
|
||||
repoRoot,
|
||||
"script",
|
||||
"develop_and_serve"
|
||||
);
|
||||
const logDir = path.join(buildCacheDir, "ha-dev-server");
|
||||
|
||||
// Each suite names its pnpm alias (for hints), a liveness model, and how to
|
||||
// spawn it. health suites carry a fixed port; process suites carry the log line
|
||||
// that means "ready" and, for app-serve, forward extra args to the script.
|
||||
const SUITES = new Map([
|
||||
[
|
||||
"e2e-app",
|
||||
{
|
||||
alias: "test:e2e:app:dev",
|
||||
liveness: "health",
|
||||
port: 8095,
|
||||
spawn: { cmd: gulpBin, args: ["develop-e2e-test-app"] },
|
||||
},
|
||||
],
|
||||
[
|
||||
"demo",
|
||||
{
|
||||
alias: "dev:demo",
|
||||
fetchTranslations: true,
|
||||
liveness: "health",
|
||||
port: 8090,
|
||||
spawn: { cmd: gulpBin, args: ["develop-demo"] },
|
||||
},
|
||||
],
|
||||
[
|
||||
"gallery",
|
||||
{
|
||||
alias: "dev:gallery",
|
||||
fetchTranslations: true,
|
||||
liveness: "health",
|
||||
port: 8100,
|
||||
spawn: { cmd: gulpBin, args: ["develop-gallery"] },
|
||||
},
|
||||
],
|
||||
[
|
||||
"app",
|
||||
{
|
||||
alias: "dev",
|
||||
fetchTranslations: true,
|
||||
liveness: "process",
|
||||
readyLog: /Build done @/,
|
||||
spawn: { cmd: gulpBin, args: ["develop-app"] },
|
||||
},
|
||||
],
|
||||
[
|
||||
"app-serve",
|
||||
{
|
||||
alias: "dev:serve",
|
||||
liveness: "process",
|
||||
acceptsArgs: true,
|
||||
fetchTranslations: true,
|
||||
readyLog: /Build done @/,
|
||||
spawn: { cmd: developAndServeScript, args: [] },
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
// Cover a cold build on a slow machine before the server starts listening.
|
||||
// Override with HA_DEV_SERVER_TIMEOUT (seconds).
|
||||
const readyTimeoutSeconds = Number(process.env.HA_DEV_SERVER_TIMEOUT || "180");
|
||||
const READY_TIMEOUT_MS =
|
||||
Number.isFinite(readyTimeoutSeconds) && readyTimeoutSeconds > 0
|
||||
? readyTimeoutSeconds * 1000
|
||||
: 180_000;
|
||||
|
||||
const usage = () => {
|
||||
const suites = [...SUITES.keys()].join("|");
|
||||
process.stderr.write(
|
||||
`Usage: node build-scripts/dev-server.mjs --suite <${suites}> ` +
|
||||
`[--background | --status | --stop | --logs [--follow]] ` +
|
||||
`[--fetch-translations]\n`
|
||||
);
|
||||
};
|
||||
|
||||
const parseArgs = (argv) => {
|
||||
const args = {
|
||||
fetchTranslations: false,
|
||||
mode: "foreground",
|
||||
follow: false,
|
||||
modes: [],
|
||||
suite: undefined,
|
||||
passthrough: [],
|
||||
};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
const arg = argv[i];
|
||||
switch (arg) {
|
||||
case "--suite":
|
||||
args.suite = argv[++i];
|
||||
break;
|
||||
case "--follow":
|
||||
args.follow = true;
|
||||
break;
|
||||
case "--fetch-translations":
|
||||
args.fetchTranslations = true;
|
||||
break;
|
||||
default:
|
||||
if (LIFECYCLE_MODE_FLAGS.has(arg)) {
|
||||
args.mode = LIFECYCLE_MODE_FLAGS.get(arg);
|
||||
args.modes.push(arg);
|
||||
} else {
|
||||
// Anything unrecognised is forwarded to the underlying script.
|
||||
args.passthrough.push(arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return args;
|
||||
};
|
||||
|
||||
const translationPrebuildEnv = (token) => {
|
||||
const env = workflowLockEnv(token);
|
||||
delete env.SKIP_FETCH_NIGHTLY_TRANSLATIONS;
|
||||
return env;
|
||||
};
|
||||
|
||||
const suiteEnv = (token, fetchTranslations = false) => ({
|
||||
...workflowLockEnv(token),
|
||||
...(fetchTranslations && { SKIP_FETCH_NIGHTLY_TRANSLATIONS: "1" }),
|
||||
});
|
||||
|
||||
const runPrebuild = (token, fetchTranslations = false) =>
|
||||
fetchTranslations
|
||||
? spawnForeground({
|
||||
cmd: gulpBin,
|
||||
args: ["setup-and-fetch-nightly-translations"],
|
||||
cwd: repoRoot,
|
||||
env: translationPrebuildEnv(token),
|
||||
processGroup: true,
|
||||
})
|
||||
: Promise.resolve(0);
|
||||
|
||||
const logFileFor = (suite) => path.join(logDir, `${suite}.log`);
|
||||
const acquireSuite = (suite) => {
|
||||
const token = `${process.pid}-${Date.now()}-${Math.random()}`;
|
||||
const record = {
|
||||
pid: process.pid,
|
||||
startTime: processStartTime(process.pid),
|
||||
processGroup: false,
|
||||
kind: "dev",
|
||||
suite,
|
||||
starting: true,
|
||||
token,
|
||||
};
|
||||
const result = acquireProcessRecord(workflowLockFile, record);
|
||||
return result.acquired ? { token } : { existing: result.existing };
|
||||
};
|
||||
|
||||
const updateSuite = (suite, token, child, port) => {
|
||||
const existing = readProcessRecord(workflowLockFile);
|
||||
if (existing?.token !== token) {
|
||||
throw Error(`Dev server (${suite}) ownership was lost during startup.`);
|
||||
}
|
||||
writeProcessRecord(workflowLockFile, {
|
||||
...existing,
|
||||
pid: child.pid,
|
||||
startTime: processStartTime(child.pid),
|
||||
processGroup: true,
|
||||
starting: false,
|
||||
port,
|
||||
});
|
||||
};
|
||||
|
||||
const releaseSuite = (token) => releaseProcessRecord(workflowLockFile, token);
|
||||
|
||||
const readSuite = (suite) => {
|
||||
const existing = readProcessRecord(workflowLockFile);
|
||||
if (existing?.kind !== "dev" || existing.suite !== suite) {
|
||||
return undefined;
|
||||
}
|
||||
if (isProcessRecordAlive(existing)) {
|
||||
return existing;
|
||||
}
|
||||
releaseSuite(existing.token);
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const hints = (suite) => {
|
||||
const alias = `pnpm ${SUITES.get(suite).alias}`;
|
||||
return (
|
||||
` Stop: ${alias} --stop\n` +
|
||||
` Status: ${alias} --status\n` +
|
||||
` Logs: ${alias} --logs\n`
|
||||
);
|
||||
};
|
||||
|
||||
const reportProcessConflict = (suite, existing) => {
|
||||
if (existing?.kind === "output") {
|
||||
process.stdout.write(
|
||||
`${describeOutputOwner(existing)} already owns the app output` +
|
||||
`${existing.pid ? ` (pid ${existing.pid})` : ""}.\n`
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (existing?.kind === "build") {
|
||||
process.stdout.write(
|
||||
`Frontend build already running${existing.pid ? ` (pid ${existing.pid})` : ""}. ` +
|
||||
"Stop it with pnpm build --stop.\n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
process.stdout.write(
|
||||
`Dev server (${existing?.suite ?? suite}) already running` +
|
||||
`${urlSuffix(existing?.port)} ` +
|
||||
`${existing?.pid ? `(pid ${existing.pid})` : ""}\n` +
|
||||
hints(existing?.suite ?? suite)
|
||||
);
|
||||
};
|
||||
|
||||
const stopCommandFor = (owner) =>
|
||||
owner?.kind === "build"
|
||||
? "pnpm build --stop"
|
||||
: owner?.kind === "dev"
|
||||
? `pnpm ${SUITES.get(owner.suite)?.alias ?? "dev"} --stop`
|
||||
: undefined;
|
||||
|
||||
const acquireSuiteForStart = async (suite) => {
|
||||
const lock = acquireSuite(suite);
|
||||
if (lock.token) {
|
||||
return lock;
|
||||
}
|
||||
reportProcessConflict(suite, lock.existing);
|
||||
if (
|
||||
await offerToStopProcessRecord({
|
||||
file: workflowLockFile,
|
||||
owner: lock.existing,
|
||||
ownerDescription: describeOutputOwner(lock.existing),
|
||||
stopCommand: stopCommandFor(lock.existing),
|
||||
})
|
||||
) {
|
||||
return acquireSuiteForStart(suite);
|
||||
}
|
||||
return {
|
||||
code:
|
||||
lock.existing?.kind === "dev" &&
|
||||
lock.existing.suite === suite &&
|
||||
!lock.existing.starting
|
||||
? 0
|
||||
: 1,
|
||||
};
|
||||
};
|
||||
|
||||
// --- shared spawning and lifecycle ------------------------------------------
|
||||
|
||||
const urlSuffix = (port) => (port ? ` at http://localhost:${port}` : "");
|
||||
|
||||
// Poll until the server is ready, the child exits, or we time out. Prints the
|
||||
// progress dots and outcome; returns 0 when ready, 1 otherwise. onExit runs if
|
||||
// the child dies before it is ready (used to clear a stale pidfile).
|
||||
const awaitReady = async ({ suite, child, logFile, port, isReady, onExit }) => {
|
||||
let childExited = false;
|
||||
child.on("exit", () => {
|
||||
childExited = true;
|
||||
});
|
||||
const deadline = Date.now() + READY_TIMEOUT_MS;
|
||||
process.stdout.write(`Starting ${suite} dev server`);
|
||||
const poll = async () => {
|
||||
if (childExited) {
|
||||
process.stdout.write("\n");
|
||||
process.stderr.write(
|
||||
`Dev server (${suite}) exited before it was ready. See ${logFile}\n`
|
||||
);
|
||||
onExit?.();
|
||||
return 1;
|
||||
}
|
||||
if (await isReady()) {
|
||||
process.stdout.write("\n");
|
||||
process.stdout.write(
|
||||
`Dev server (${suite}) running${urlSuffix(port)} ` +
|
||||
`(pid ${child.pid})\n${hints(suite)}`
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
if (Date.now() >= deadline) {
|
||||
return undefined;
|
||||
}
|
||||
process.stdout.write(".");
|
||||
await sleep(1000);
|
||||
return poll();
|
||||
};
|
||||
const result = await poll();
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
process.stdout.write("\n");
|
||||
process.stderr.write(
|
||||
`Dev server (${suite}) did not become ready within ${
|
||||
READY_TIMEOUT_MS / 1000
|
||||
}s. See ${logFile}\n`
|
||||
);
|
||||
const stopped = await terminateProcess({
|
||||
pid: child.pid,
|
||||
isStopped: () => childExited,
|
||||
});
|
||||
if (stopped) {
|
||||
onExit?.();
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
// Stop a running background server: SIGTERM, wait for it to go, then SIGKILL.
|
||||
// isStopped reports when it is gone; onStopped runs on success (pidfile cleanup).
|
||||
const terminate = async (suite, pid, isStopped, onStopped) => {
|
||||
if (!(await terminateProcess({ pid, isStopped }))) {
|
||||
process.stderr.write(
|
||||
`Failed to stop dev server (${suite}) (pid ${pid}). Stop it manually.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
onStopped?.();
|
||||
process.stdout.write(`Stopped dev server (${suite}) (pid ${pid}).\n`);
|
||||
return 0;
|
||||
};
|
||||
|
||||
// --- health liveness (port + /__ha_dev_status) ------------------------------
|
||||
|
||||
/**
|
||||
* Probe the health endpoint. Dev servers bind IPv4 or IPv6 localhost depending
|
||||
* on the OS, so try each; the port is "free" only if every address refuses.
|
||||
* @returns {Promise<{state: "ours" | "foreign" | "free", suite?: string}>}
|
||||
*/
|
||||
const PROBE_HOSTS = ["localhost", "127.0.0.1", "[::1]"];
|
||||
|
||||
const probe = async (port, timeoutMs = 1000) => {
|
||||
const probeHost = async (index, sawResponse) => {
|
||||
const host = PROBE_HOSTS[index];
|
||||
if (!host) {
|
||||
return sawResponse ? { state: "foreign" } : { state: "free" };
|
||||
}
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
try {
|
||||
const res = await fetch(`http://${host}:${port}/__ha_dev_status`, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
sawResponse = true;
|
||||
if (res.ok) {
|
||||
const body = await res.json().catch(() => null);
|
||||
if (body && body.server === "ha-frontend-dev") {
|
||||
return { state: "ours", suite: body.suite };
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// Try the next address.
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
return probeHost(index + 1, sawResponse);
|
||||
};
|
||||
return probeHost(0, false);
|
||||
};
|
||||
|
||||
const isHttpServing = async (port, timeoutMs = 1000) => {
|
||||
const probeHost = async (index) => {
|
||||
const host = PROBE_HOSTS[index];
|
||||
if (!host) {
|
||||
return false;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
try {
|
||||
const response = await fetch(`http://${host}:${port}`, {
|
||||
signal: controller.signal,
|
||||
});
|
||||
if (response.ok) {
|
||||
return true;
|
||||
}
|
||||
} catch {
|
||||
// Try the next address.
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
return probeHost(index + 1);
|
||||
};
|
||||
return probeHost(0);
|
||||
};
|
||||
|
||||
const runForegroundHealth = async (suite, cfg, fetchTranslations = false) => {
|
||||
const { port } = cfg;
|
||||
const lock = await acquireSuiteForStart(suite);
|
||||
if (!lock.token) {
|
||||
return lock.code;
|
||||
}
|
||||
const status = await probe(port);
|
||||
if (status.state === "ours") {
|
||||
releaseSuite(lock.token);
|
||||
process.stderr.write(
|
||||
`Port ${port} is already serving the ${status.suite ?? "unknown"} dev server.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if (status.state === "foreign") {
|
||||
releaseSuite(lock.token);
|
||||
process.stderr.write(
|
||||
`Port ${port} is in use by another process; not the ${suite} dev server.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
const prebuildCode = await runPrebuild(lock.token, fetchTranslations);
|
||||
if (prebuildCode !== 0) {
|
||||
return prebuildCode;
|
||||
}
|
||||
return await spawnForeground({
|
||||
cmd: cfg.spawn.cmd,
|
||||
args: cfg.spawn.args,
|
||||
cwd: repoRoot,
|
||||
env: suiteEnv(lock.token, fetchTranslations),
|
||||
processGroup: true,
|
||||
onSpawn: (child) => updateSuite(suite, lock.token, child, port),
|
||||
});
|
||||
} finally {
|
||||
releaseSuite(lock.token);
|
||||
}
|
||||
};
|
||||
|
||||
const runBackgroundHealth = async (suite, cfg, fetchTranslations = false) => {
|
||||
const { port } = cfg;
|
||||
const lock = await acquireSuiteForStart(suite);
|
||||
if (!lock.token) {
|
||||
return lock.code;
|
||||
}
|
||||
const preflight = await probe(port);
|
||||
if (preflight.state === "ours") {
|
||||
releaseSuite(lock.token);
|
||||
process.stderr.write(
|
||||
`Port ${port} is already serving the ${preflight.suite ?? "unknown"} dev server.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if (preflight.state === "foreign") {
|
||||
releaseSuite(lock.token);
|
||||
process.stderr.write(
|
||||
`Port ${port} is in use by another process; not the ${suite} dev server.\n`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
let child;
|
||||
try {
|
||||
const prebuildCode = await runPrebuild(lock.token, fetchTranslations);
|
||||
if (prebuildCode !== 0) {
|
||||
releaseSuite(lock.token);
|
||||
return prebuildCode;
|
||||
}
|
||||
const logFile = logFileFor(suite);
|
||||
child = await spawnDetachedToLog({
|
||||
cmd: cfg.spawn.cmd,
|
||||
args: cfg.spawn.args,
|
||||
cwd: repoRoot,
|
||||
env: suiteEnv(lock.token, fetchTranslations),
|
||||
logFile,
|
||||
});
|
||||
updateSuite(suite, lock.token, child, port);
|
||||
return awaitReady({
|
||||
suite,
|
||||
child,
|
||||
logFile,
|
||||
port,
|
||||
isReady: async () => {
|
||||
const status = await probe(port, 1000);
|
||||
return status.state === "ours" && status.suite === suite;
|
||||
},
|
||||
onExit: () => releaseSuite(lock.token),
|
||||
});
|
||||
} catch (err) {
|
||||
if (child) {
|
||||
await terminateDetachedProcess(child);
|
||||
}
|
||||
releaseSuite(lock.token);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const logIsReady = (logFile, readyLog) => {
|
||||
try {
|
||||
return readyLog.test(fs.readFileSync(logFile, "utf8"));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// app-serve serves on 8124 by default (8123 in a devcontainer), or whatever -p
|
||||
// the caller passed. Used only to show a URL; liveness comes from the pidfile.
|
||||
const resolveServePort = (passthrough) => {
|
||||
for (let i = passthrough.length - 1; i >= 0; i--) {
|
||||
const arg = passthrough[i];
|
||||
if (arg === "-p" || arg.startsWith("-p")) {
|
||||
const port = Number(arg === "-p" ? passthrough[i + 1] : arg.slice(2));
|
||||
if (Number.isInteger(port) && port > 0) {
|
||||
return port;
|
||||
}
|
||||
}
|
||||
}
|
||||
return process.env.DEVCONTAINER ? 8123 : 8124;
|
||||
};
|
||||
|
||||
const spawnArgs = (cfg, passthrough) => [
|
||||
...cfg.spawn.args,
|
||||
...(cfg.acceptsArgs ? passthrough : []),
|
||||
];
|
||||
|
||||
const runForegroundProcess = async (
|
||||
suite,
|
||||
cfg,
|
||||
passthrough,
|
||||
fetchTranslations = false
|
||||
) => {
|
||||
const lock = await acquireSuiteForStart(suite);
|
||||
if (!lock.token) {
|
||||
return lock.code;
|
||||
}
|
||||
try {
|
||||
const prebuildCode = await runPrebuild(lock.token, fetchTranslations);
|
||||
if (prebuildCode !== 0) {
|
||||
return prebuildCode;
|
||||
}
|
||||
return await spawnForeground({
|
||||
cmd: cfg.spawn.cmd,
|
||||
args: spawnArgs(cfg, passthrough),
|
||||
cwd: repoRoot,
|
||||
env: suiteEnv(lock.token, fetchTranslations),
|
||||
processGroup: true,
|
||||
onSpawn: (child) => updateSuite(suite, lock.token, child),
|
||||
});
|
||||
} finally {
|
||||
releaseSuite(lock.token);
|
||||
}
|
||||
};
|
||||
|
||||
const runBackgroundProcess = async (
|
||||
suite,
|
||||
cfg,
|
||||
passthrough,
|
||||
fetchTranslations = false
|
||||
) => {
|
||||
const lock = await acquireSuiteForStart(suite);
|
||||
if (!lock.token) {
|
||||
return lock.code;
|
||||
}
|
||||
|
||||
let child;
|
||||
try {
|
||||
const prebuildCode = await runPrebuild(lock.token, fetchTranslations);
|
||||
if (prebuildCode !== 0) {
|
||||
releaseSuite(lock.token);
|
||||
return prebuildCode;
|
||||
}
|
||||
const logFile = logFileFor(suite);
|
||||
child = await spawnDetachedToLog({
|
||||
cmd: cfg.spawn.cmd,
|
||||
args: spawnArgs(cfg, passthrough),
|
||||
cwd: repoRoot,
|
||||
env: suiteEnv(lock.token, fetchTranslations),
|
||||
logFile,
|
||||
});
|
||||
|
||||
const port = cfg.acceptsArgs ? resolveServePort(passthrough) : cfg.port;
|
||||
updateSuite(suite, lock.token, child, port);
|
||||
|
||||
return awaitReady({
|
||||
suite,
|
||||
child,
|
||||
logFile,
|
||||
port,
|
||||
isReady: async () =>
|
||||
logIsReady(logFile, cfg.readyLog) &&
|
||||
(!cfg.acceptsArgs || (await isHttpServing(port))),
|
||||
onExit: () => releaseSuite(lock.token),
|
||||
});
|
||||
} catch (err) {
|
||||
if (child) {
|
||||
await terminateDetachedProcess(child);
|
||||
}
|
||||
releaseSuite(lock.token);
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
const runStatusSuite = async (suite, cfg) => {
|
||||
const existing = readSuite(suite);
|
||||
if (existing) {
|
||||
process.stdout.write(
|
||||
`Dev server (${existing.suite ?? suite}) running${urlSuffix(existing.port ?? cfg.port)} ` +
|
||||
`(pid ${existing.pid})\n`
|
||||
);
|
||||
} else {
|
||||
process.stdout.write(`Dev server (${suite}) not running.\n`);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
const runStopSuite = async (suite) => {
|
||||
const existing = readSuite(suite);
|
||||
if (!existing) {
|
||||
process.stdout.write(`Dev server (${suite}) not running.\n`);
|
||||
return 0;
|
||||
}
|
||||
const { pid } = existing;
|
||||
const activeSuite = existing.suite ?? suite;
|
||||
return terminate(
|
||||
activeSuite,
|
||||
pid,
|
||||
() => !isProcessRecordAlive(existing),
|
||||
() => releaseSuite(existing.token)
|
||||
);
|
||||
};
|
||||
|
||||
// --- shared -----------------------------------------------------------------
|
||||
|
||||
const runLogs = (suite, follow) => {
|
||||
const activeSuite = readSuite(suite)?.suite ?? suite;
|
||||
return outputLog(
|
||||
logFileFor(activeSuite),
|
||||
follow,
|
||||
`No log for the ${activeSuite} dev server yet (${logFileFor(activeSuite)}).\n`
|
||||
);
|
||||
};
|
||||
|
||||
const main = async () => {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
const cfg = SUITES.get(args.suite);
|
||||
if (!cfg) {
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (args.modes.length > 1 || (args.follow && args.mode !== "logs")) {
|
||||
process.stderr.write("Invalid combination of lifecycle arguments.\n");
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (
|
||||
args.fetchTranslations &&
|
||||
(!["foreground", "background"].includes(args.mode) ||
|
||||
!cfg.fetchTranslations)
|
||||
) {
|
||||
process.stderr.write(
|
||||
"--fetch-translations is only supported when starting app, app-serve, demo, or gallery.\n"
|
||||
);
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
if (args.passthrough.length && !cfg.acceptsArgs) {
|
||||
process.stderr.write(
|
||||
`Ignoring unexpected arguments: ${args.passthrough.join(" ")}\n`
|
||||
);
|
||||
}
|
||||
|
||||
// A plain dev:<suite> under a coding agent backgrounds itself; explicit modes
|
||||
// are untouched.
|
||||
let { mode } = args;
|
||||
if (
|
||||
mode === "foreground" &&
|
||||
!["0", "false"].includes(process.env.HA_DEV_BACKGROUND)
|
||||
) {
|
||||
const agent = detectCodingAgent();
|
||||
if (agent) {
|
||||
process.stdout.write(
|
||||
`Detected coding agent (${agent}); starting in the background. ` +
|
||||
`Set HA_DEV_BACKGROUND=0 to force foreground.\n`
|
||||
);
|
||||
mode = "background";
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === "logs") {
|
||||
return runLogs(args.suite, args.follow);
|
||||
}
|
||||
if (mode === "status") {
|
||||
return runStatusSuite(args.suite, cfg);
|
||||
}
|
||||
if (mode === "stop") {
|
||||
return runStopSuite(args.suite);
|
||||
}
|
||||
const handlers =
|
||||
cfg.liveness === "health"
|
||||
? {
|
||||
foreground: () =>
|
||||
runForegroundHealth(args.suite, cfg, args.fetchTranslations),
|
||||
background: () =>
|
||||
runBackgroundHealth(args.suite, cfg, args.fetchTranslations),
|
||||
}
|
||||
: {
|
||||
foreground: () =>
|
||||
runForegroundProcess(
|
||||
args.suite,
|
||||
cfg,
|
||||
args.passthrough,
|
||||
args.fetchTranslations
|
||||
),
|
||||
background: () =>
|
||||
runBackgroundProcess(
|
||||
args.suite,
|
||||
cfg,
|
||||
args.passthrough,
|
||||
args.fetchTranslations
|
||||
),
|
||||
};
|
||||
return handlers[mode]();
|
||||
};
|
||||
|
||||
runCli(main);
|
||||
Loaded 100 of 4312 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user