feat: CVAT 标注引擎、我的标注收件箱与 ADAS Cuboid 送标
- 统一标注引擎为 CVAT:客户端/配置/格式转换、iframe 标注页、docker-compose.cvat.yml 与 no_auth 补丁 - 移除 Label Studio 相关配置与构建脚本,清理 embedded.bak 备份与误提交的 node_modules - 新增「我的标注」:跨 Campaign 收件箱、逐张清单、CVAT frame 跳转 - 飞书任务分配:通讯录同步选人、按量分配、分配后 DM 通知(含 my-tasks 链接) - ADAS cuboid_7cls 数据湖接入:workflow 路径、register-batch、开标上传与标注同步 - 数据湖挂载 AS_DATA_LAKE_ROOT、datasets/adas 符号链接、reset_labeling 运维脚本 - 补充 docs/HANDOVER.md 项目交接文档 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,7 +20,10 @@ from as_platform.labeling.lock import acquire_lock, release_lock, renew_lock
|
||||
from as_platform.labeling.progress import (
|
||||
assign_tasks_even,
|
||||
assign_tasks_explicit,
|
||||
assign_tasks_quantized,
|
||||
campaign_my_tasks,
|
||||
campaign_progress,
|
||||
list_my_assignments,
|
||||
release_task_assignment,
|
||||
reassign_task,
|
||||
user_is_coordinator,
|
||||
@@ -41,12 +44,13 @@ router = APIRouter(tags=["labeling"])
|
||||
|
||||
|
||||
class OpenCampaignBody(BaseModel):
|
||||
project: str = Field(..., pattern="^(dms|lane)$")
|
||||
project: str = Field(..., pattern="^(dms|lane|adas)$")
|
||||
task: str
|
||||
batch: str
|
||||
mode: str | None = None
|
||||
pack: str | None = None
|
||||
location: str = "inbox"
|
||||
annotation_types: list[str] | None = None
|
||||
|
||||
|
||||
class AssignCampaignBody(BaseModel):
|
||||
@@ -63,10 +67,16 @@ class AssignTasksExplicitItem(BaseModel):
|
||||
task_ids: list[str] = Field(default_factory=list)
|
||||
|
||||
|
||||
class AssignTasksQuantizedItem(BaseModel):
|
||||
user_id: int
|
||||
count: int = 0
|
||||
|
||||
|
||||
class AssignTasksBody(BaseModel):
|
||||
mode: str = "even"
|
||||
user_ids: list[int] | None = None
|
||||
items: list[AssignTasksExplicitItem] | None = None
|
||||
quantized_items: list[AssignTasksQuantizedItem] | None = None
|
||||
|
||||
|
||||
class ReassignTaskBody(BaseModel):
|
||||
@@ -80,6 +90,24 @@ def api_labeling_assignees(
|
||||
return list_labeling_assignees()
|
||||
|
||||
|
||||
@router.get("/api/v1/labeling/my-assignments")
|
||||
def api_my_assignments(
|
||||
user: Annotated[User, Depends(require_permission("read:pending"))],
|
||||
) -> dict[str, Any]:
|
||||
return list_my_assignments(user.id)
|
||||
|
||||
|
||||
@router.get("/api/v1/labeling/campaigns/{campaign_id}/my-tasks")
|
||||
def api_campaign_my_tasks(
|
||||
campaign_id: str,
|
||||
user: Annotated[User, Depends(require_permission("read:pending"))],
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
return campaign_my_tasks(campaign_id, user.id)
|
||||
except FileNotFoundError:
|
||||
raise HTTPException(404, "campaign not found") from None
|
||||
|
||||
|
||||
@router.patch("/api/v1/labeling/campaigns/{campaign_id}/assign")
|
||||
def api_assign_campaign(
|
||||
campaign_id: str,
|
||||
@@ -166,6 +194,9 @@ def api_assign_tasks(
|
||||
if body.mode == "explicit":
|
||||
items = [{"user_id": i.user_id, "task_ids": i.task_ids} for i in (body.items or [])]
|
||||
return assign_tasks_explicit(campaign_id, items, assigned_by_user_id=user.id)
|
||||
if body.mode == "quantized":
|
||||
items = [{"user_id": i.user_id, "count": i.count} for i in (body.quantized_items or [])]
|
||||
return assign_tasks_quantized(campaign_id, items, assigned_by_user_id=user.id)
|
||||
if not body.user_ids:
|
||||
raise ValueError("even 模式需要 user_ids")
|
||||
return assign_tasks_even(campaign_id, body.user_ids, assigned_by_user_id=user.id)
|
||||
@@ -368,6 +399,37 @@ def api_labeling_lock_renew(
|
||||
return result
|
||||
|
||||
|
||||
# ── CVAT 集成端点 ──
|
||||
|
||||
|
||||
@router.get("/api/v1/labeling/cvat/status/{campaign_id}")
|
||||
def api_cvat_status(
|
||||
campaign_id: str,
|
||||
_user: Annotated[User, Depends(require_permission("read:pending"))],
|
||||
) -> dict[str, Any]:
|
||||
from as_platform.labeling.service import get_cvat_status
|
||||
try:
|
||||
return get_cvat_status(campaign_id)
|
||||
except FileNotFoundError:
|
||||
raise HTTPException(404, "campaign not found") from None
|
||||
|
||||
|
||||
@router.post("/api/v1/labeling/cvat/sync/{campaign_id}")
|
||||
def api_cvat_sync(
|
||||
campaign_id: str,
|
||||
_user: Annotated[User, Depends(require_permission("read:pending"))],
|
||||
) -> dict[str, Any]:
|
||||
from as_platform.labeling.service import sync_cvat_annotations
|
||||
try:
|
||||
return sync_cvat_annotations(campaign_id)
|
||||
except FileNotFoundError:
|
||||
raise HTTPException(404, "campaign not found") from None
|
||||
except ValueError as e:
|
||||
raise HTTPException(400, str(e)) from e
|
||||
except Exception as e:
|
||||
raise HTTPException(500, f"CVAT 同步失败: {e}") from e
|
||||
|
||||
|
||||
# ── 标注质检 (Quality Review) ──
|
||||
|
||||
class ReviewScoreBody(BaseModel):
|
||||
|
||||
@@ -708,18 +708,14 @@ def api_scan_inbox(
|
||||
if batch_name in registered:
|
||||
continue # 已登记
|
||||
|
||||
# Count images
|
||||
img_count = 0
|
||||
lbl_count = 0
|
||||
has_labels = False
|
||||
for ext in ["*.jpg", "*.jpeg", "*.png", "*.bmp"]:
|
||||
for _ in batch_dir.glob(ext):
|
||||
img_count += 1
|
||||
if (batch_dir / "labels").is_dir():
|
||||
has_labels = True
|
||||
for ext in ["*.txt", "*.json"]:
|
||||
for _ in (batch_dir / "labels").glob(ext):
|
||||
lbl_count += 1
|
||||
# Count images (含 images/ 子目录)
|
||||
from as_platform.data.batch import count_images, count_label_files, dms_has_labels
|
||||
|
||||
img_count = count_images(batch_dir)
|
||||
if not img_count and (batch_dir / "images").is_dir():
|
||||
img_count = count_images(batch_dir / "images")
|
||||
lbl_count = count_label_files(batch_dir / "labels") if (batch_dir / "labels").is_dir() else 0
|
||||
has_labels = lbl_count > 0 or dms_has_labels(batch_dir)
|
||||
|
||||
items.append({
|
||||
"project": project,
|
||||
@@ -879,9 +875,6 @@ def _mount_ui() -> None:
|
||||
assets = ui / "assets"
|
||||
if assets.is_dir():
|
||||
app.mount("/assets", StaticFiles(directory=str(assets)), name="ui-assets")
|
||||
annotate = ui / "annotate"
|
||||
if annotate.is_dir():
|
||||
app.mount("/annotate", StaticFiles(directory=str(annotate), html=True), name="ui-annotate")
|
||||
return
|
||||
|
||||
|
||||
@@ -889,14 +882,10 @@ _mount_ui()
|
||||
|
||||
|
||||
@app.get("/labeling/campaigns/{campaign_id}/annotate", include_in_schema=False)
|
||||
def serve_annotate_app(campaign_id: str):
|
||||
"""标注编辑器页面 — 返回旧 Label Studio 构建产物"""
|
||||
if not _UI_DIR:
|
||||
raise HTTPException(404, "UI not built")
|
||||
annotate_index = _UI_DIR / "annotate" / "index.html"
|
||||
if annotate_index.is_file():
|
||||
return FileResponse(annotate_index)
|
||||
raise HTTPException(404, "标注编辑器未构建")
|
||||
def serve_annotate_app_redirect(campaign_id: str):
|
||||
"""标注编辑器 — 已迁移至 CVAT,302 重定向到新路由"""
|
||||
from fastapi.responses import RedirectResponse
|
||||
return RedirectResponse(f"/labeling/annotate/{campaign_id}", status_code=302)
|
||||
|
||||
|
||||
@app.get("/{full_path:path}", include_in_schema=False)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""飞书 OAuth 登录。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import secrets
|
||||
import urllib.parse
|
||||
from datetime import datetime, timedelta, timezone
|
||||
@@ -8,8 +9,10 @@ from typing import Any
|
||||
|
||||
import httpx
|
||||
from jose import JWTError, jwt
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from as_platform.config import FEISHU_APP_ID, FEISHU_APP_SECRET, FEISHU_REDIRECT_URI, JWT_SECRET
|
||||
from as_platform.db.models import User
|
||||
|
||||
FEISHU_AUTHORIZE_URL = "https://passport.feishu.cn/suite/passport/oauth/authorize"
|
||||
FEISHU_TOKEN_URL = "https://open.feishu.cn/open-apis/authen/v1/access_token"
|
||||
@@ -18,6 +21,8 @@ FEISHU_TENANT_TOKEN_URL = "https://open.feishu.cn/open-apis/auth/v3/tenant_acces
|
||||
FEISHU_CONTACT_USER_URL = "https://open.feishu.cn/open-apis/contact/v3/users/{user_id}"
|
||||
FEISHU_CONTACT_USERS_URL = "https://open.feishu.cn/open-apis/contact/v3/users"
|
||||
FEISHU_DEPARTMENTS_URL = "https://open.feishu.cn/open-apis/contact/v3/departments"
|
||||
FEISHU_DEPARTMENT_CHILDREN_URL = "https://open.feishu.cn/open-apis/contact/v3/departments/{department_id}/children"
|
||||
FEISHU_USERS_BY_DEPT_URL = "https://open.feishu.cn/open-apis/contact/v3/users/find_by_department"
|
||||
|
||||
STATE_ALG = "HS256"
|
||||
STATE_EXPIRE_MINUTES = 10
|
||||
@@ -144,79 +149,196 @@ def _get_contact_user_profile(
|
||||
return data.get("data", {}).get("user", {})
|
||||
|
||||
|
||||
def fetch_feishu_users(page_size: int = 100) -> tuple[list[dict[str, Any]], dict[str, str]]:
|
||||
"""从飞书通讯录批量拉取用户列表并获取部门名称映射,返回 (users, dept_name_map)。
|
||||
如果应用无通讯录权限则返回空列表。"""
|
||||
def _parse_contact_user(item: dict[str, Any]) -> dict[str, Any]:
|
||||
return {
|
||||
"open_id": item.get("open_id"),
|
||||
"union_id": item.get("union_id"),
|
||||
"user_id": item.get("user_id"),
|
||||
"name": item.get("name") or item.get("en_name") or item.get("nickname"),
|
||||
"email": item.get("email") or item.get("enterprise_email"),
|
||||
"mobile": item.get("mobile"),
|
||||
"avatar_url": item.get("avatar", {}).get("avatar_240")
|
||||
if isinstance(item.get("avatar"), dict)
|
||||
else None,
|
||||
"department_ids": item.get("department_ids", []),
|
||||
}
|
||||
|
||||
|
||||
def _paginate_feishu_get(
|
||||
client: httpx.Client,
|
||||
token: str,
|
||||
url: str,
|
||||
params: dict[str, str | int],
|
||||
) -> tuple[list[dict[str, Any]], str | None]:
|
||||
"""分页 GET,返回 (items, error_message)。"""
|
||||
items: list[dict[str, Any]] = []
|
||||
page_token = ""
|
||||
error_msg: str | None = None
|
||||
while True:
|
||||
req = dict(params)
|
||||
if page_token:
|
||||
req["page_token"] = page_token
|
||||
resp = client.get(url, params=req, headers={"Authorization": f"Bearer {token}"})
|
||||
data = resp.json() if resp.content else {}
|
||||
if resp.status_code >= 400 or data.get("code") not in (0, None):
|
||||
return items, data.get("msg") or f"HTTP {resp.status_code}"
|
||||
if data.get("code") == 0:
|
||||
items.extend(data.get("data", {}).get("items", []))
|
||||
page_token = data.get("data", {}).get("page_token", "")
|
||||
if not page_token:
|
||||
break
|
||||
return items, error_msg
|
||||
|
||||
|
||||
def _fetch_department_map(client: httpx.Client, token: str) -> tuple[dict[str, str], str | None]:
|
||||
"""递归拉取全部部门,返回 {open_department_id: name}。"""
|
||||
dept_map: dict[str, str] = {"0": "全员"}
|
||||
# 优先:从根部门递归子部门(需全员通讯录范围)
|
||||
children, err = _paginate_feishu_get(
|
||||
client,
|
||||
token,
|
||||
FEISHU_DEPARTMENT_CHILDREN_URL.format(department_id="0"),
|
||||
{
|
||||
"department_id_type": "open_department_id",
|
||||
"fetch_child": "true",
|
||||
"page_size": 50,
|
||||
},
|
||||
)
|
||||
if err and "no dept authority" in err:
|
||||
return {}, err
|
||||
for item in children:
|
||||
did = item.get("open_department_id", "")
|
||||
if did:
|
||||
dept_map[did] = item.get("name", "") or did
|
||||
if dept_map and len(dept_map) > 1:
|
||||
return dept_map, None
|
||||
|
||||
# 回退:平铺部门列表
|
||||
flat, err2 = _paginate_feishu_get(
|
||||
client,
|
||||
token,
|
||||
FEISHU_DEPARTMENTS_URL,
|
||||
{"page_size": 50, "department_id_type": "open_department_id"},
|
||||
)
|
||||
for item in flat:
|
||||
did = item.get("open_department_id", "")
|
||||
if did:
|
||||
dept_map[did] = item.get("name", "") or did
|
||||
return dept_map, err2 or err
|
||||
|
||||
|
||||
def _fetch_users_by_department(
|
||||
client: httpx.Client, token: str, department_id: str
|
||||
) -> tuple[list[dict[str, Any]], str | None]:
|
||||
raw, err = _paginate_feishu_get(
|
||||
client,
|
||||
token,
|
||||
FEISHU_USERS_BY_DEPT_URL,
|
||||
{
|
||||
"department_id": department_id,
|
||||
"user_id_type": "open_id",
|
||||
"department_id_type": "open_department_id",
|
||||
"page_size": 50,
|
||||
},
|
||||
)
|
||||
return [_parse_contact_user(x) for x in raw if x.get("open_id")], err
|
||||
|
||||
|
||||
def _fetch_users_list(
|
||||
client: httpx.Client,
|
||||
token: str,
|
||||
*,
|
||||
department_id: str | None = None,
|
||||
page_size: int = 50,
|
||||
) -> tuple[list[dict[str, Any]], str | None]:
|
||||
params: dict[str, str | int] = {
|
||||
"user_id_type": "open_id",
|
||||
"department_id_type": "open_department_id",
|
||||
"page_size": min(page_size, 50),
|
||||
}
|
||||
if department_id is not None:
|
||||
params["department_id"] = department_id
|
||||
raw, err = _paginate_feishu_get(client, token, FEISHU_CONTACT_USERS_URL, params)
|
||||
return [_parse_contact_user(x) for x in raw if x.get("open_id")], err
|
||||
|
||||
|
||||
def fetch_feishu_users(page_size: int = 50) -> tuple[list[dict[str, Any]], dict[str, str], str | None]:
|
||||
"""从飞书通讯录拉取组织用户(按部门递归 + 多策略回退)。
|
||||
|
||||
返回 (users, dept_name_map, error_message)。
|
||||
若应用通讯录范围不是「全部员工」,可能只能同步到极少数成员。
|
||||
"""
|
||||
if not is_feishu_configured():
|
||||
return [], {}
|
||||
return [], {}, "飞书应用未配置"
|
||||
|
||||
error_msg: str | None = None
|
||||
scope_warning: str | None = None
|
||||
users_by_id: dict[str, dict[str, Any]] = {}
|
||||
try:
|
||||
with httpx.Client(timeout=30) as client:
|
||||
with httpx.Client(timeout=60) as client:
|
||||
token = _get_tenant_access_token(client)
|
||||
dept_map, dept_err = _fetch_department_map(client, token)
|
||||
|
||||
# 先获取部门列表(如果应用有通讯录权限)
|
||||
dept_map: dict[str, str] = {}
|
||||
try:
|
||||
page_token = ""
|
||||
while True:
|
||||
params: dict[str, str | int] = {"page_size": 100, "department_id_type": "open_department_id"}
|
||||
if page_token:
|
||||
params["page_token"] = page_token
|
||||
resp = client.get(FEISHU_DEPARTMENTS_URL, params=params, headers={"Authorization": f"Bearer {token}"})
|
||||
if resp.status_code >= 400:
|
||||
break # 无部门权限,跳过
|
||||
d = resp.json()
|
||||
if d.get("code") == 0:
|
||||
for item in d.get("data", {}).get("items", []):
|
||||
dept_map[item.get("open_department_id", "")] = item.get("name", "")
|
||||
page_token = d.get("data", {}).get("page_token", "")
|
||||
if not page_token:
|
||||
break
|
||||
except Exception:
|
||||
pass # 无需部门信息也可同步用户
|
||||
# 策略 1:按部门拉取直属用户(可覆盖全员)
|
||||
if dept_map:
|
||||
dept_ids = [d for d in dept_map if d != "0"] or ["0"]
|
||||
if "0" not in dept_ids:
|
||||
dept_ids = ["0", *dept_ids]
|
||||
for did in dept_ids:
|
||||
batch, err = _fetch_users_by_department(client, token, did)
|
||||
if err and not error_msg:
|
||||
error_msg = err
|
||||
for u in batch:
|
||||
oid = u.get("open_id")
|
||||
if oid:
|
||||
users_by_id[oid] = u
|
||||
|
||||
# 再获取用户列表(如无通讯录权限则跳过)
|
||||
users: list[dict[str, Any]] = []
|
||||
try:
|
||||
page_token = ""
|
||||
while True:
|
||||
params = {
|
||||
"user_id_type": "open_id",
|
||||
"department_id_type": "open_department_id",
|
||||
"page_size": min(page_size, 100),
|
||||
}
|
||||
if page_token:
|
||||
params["page_token"] = page_token # type: ignore
|
||||
resp = client.get(FEISHU_CONTACT_USERS_URL, params=params, headers={"Authorization": f"Bearer {token}"}) # type: ignore
|
||||
if resp.status_code >= 400:
|
||||
break
|
||||
d = resp.json()
|
||||
if d.get("code") == 0:
|
||||
for item in d.get("data", {}).get("items", []):
|
||||
users.append({
|
||||
"open_id": item.get("open_id"),
|
||||
"union_id": item.get("union_id"),
|
||||
"user_id": item.get("user_id"),
|
||||
"name": item.get("name"),
|
||||
"email": item.get("email"),
|
||||
"mobile": item.get("mobile"),
|
||||
"avatar_url": item.get("avatar", {}).get("avatar_240") if isinstance(item.get("avatar"), dict) else None,
|
||||
"department_ids": item.get("department_ids", []),
|
||||
})
|
||||
page_token = d.get("data", {}).get("page_token", "")
|
||||
if not page_token:
|
||||
break
|
||||
except Exception:
|
||||
pass # 无通讯录权限,跳过用户列表拉取
|
||||
# 策略 2:根部门用户列表
|
||||
if not users_by_id:
|
||||
batch, err = _fetch_users_list(client, token, department_id="0", page_size=page_size)
|
||||
if err and not error_msg:
|
||||
error_msg = err
|
||||
for u in batch:
|
||||
oid = u.get("open_id")
|
||||
if oid:
|
||||
users_by_id[oid] = u
|
||||
|
||||
return users, dept_map
|
||||
except Exception:
|
||||
return [], {}
|
||||
# 策略 3:权限范围内独立成员(回退,通常很少)
|
||||
if not users_by_id:
|
||||
batch, err = _fetch_users_list(client, token, page_size=page_size)
|
||||
if err and not error_msg:
|
||||
error_msg = err
|
||||
for u in batch:
|
||||
oid = u.get("open_id")
|
||||
if oid:
|
||||
users_by_id[oid] = u
|
||||
|
||||
if dept_err and "no dept authority" in (dept_err or ""):
|
||||
scope_warning = (
|
||||
"应用通讯录范围未包含「全部员工」,无法按部门拉取全员。"
|
||||
"请在开放平台 → 版本管理与发布 → 可用范围/通讯录权限 设为全部员工后重新发布。"
|
||||
)
|
||||
elif len(users_by_id) <= 5 and dept_err:
|
||||
scope_warning = (
|
||||
f"仅同步到 {len(users_by_id)} 人,可能通讯录范围过窄。"
|
||||
"请将应用通讯录权限范围调整为全部员工。"
|
||||
)
|
||||
|
||||
users = list(users_by_id.values())
|
||||
if scope_warning:
|
||||
# 附带在 error 字段供前端展示(有用户时不算硬错误)
|
||||
if not users:
|
||||
error_msg = error_msg or scope_warning
|
||||
elif not error_msg:
|
||||
error_msg = scope_warning
|
||||
return users, dept_map, error_msg if not users else (scope_warning or None)
|
||||
except Exception as exc:
|
||||
return [], {}, str(exc)
|
||||
|
||||
|
||||
def sync_feishu_users_to_db(db: Session) -> dict[str, int]:
|
||||
"""同步飞书用户到数据库,返回 {created, updated, total}。"""
|
||||
users, dept_map = fetch_feishu_users()
|
||||
def sync_feishu_users_to_db(db: Session) -> dict[str, int | str | None]:
|
||||
"""同步飞书用户到数据库,返回 {created, updated, total, error}。"""
|
||||
users, dept_map, error_msg = fetch_feishu_users()
|
||||
created, updated = 0, 0
|
||||
for info in users:
|
||||
open_id = info.get("open_id")
|
||||
@@ -231,7 +353,12 @@ def sync_feishu_users_to_db(db: Session) -> dict[str, int]:
|
||||
updated += 1
|
||||
user.feishu_union_id = info.get("union_id") or user.feishu_union_id
|
||||
user.feishu_user_id = info.get("user_id") or user.feishu_user_id
|
||||
user.name = info.get("name") or user.name
|
||||
user.name = (
|
||||
info.get("name")
|
||||
or info.get("email")
|
||||
or user.name
|
||||
or f"飞书用户-{open_id[-6:]}"
|
||||
)
|
||||
user.email = info.get("email") or user.email or user.email
|
||||
user.avatar_url = info.get("avatar_url") or user.avatar_url
|
||||
dept_ids = info.get("department_ids")
|
||||
@@ -240,4 +367,4 @@ def sync_feishu_users_to_db(db: Session) -> dict[str, int]:
|
||||
user.feishu_department_ids_json = json.dumps(dept_names, ensure_ascii=False)
|
||||
user.is_active = True
|
||||
db.flush()
|
||||
return {"created": created, "updated": updated, "total": len(users)}
|
||||
return {"created": created, "updated": updated, "total": len(users), "error": error_msg}
|
||||
|
||||
@@ -289,6 +289,26 @@ def get_pending_report(wf: dict | None = None) -> dict[str, Any]:
|
||||
)
|
||||
)
|
||||
|
||||
if pname == "adas":
|
||||
inbox_adas = root / "inbox"
|
||||
if inbox_adas.is_dir():
|
||||
for task_dir in sorted(inbox_adas.iterdir()):
|
||||
if not task_dir.is_dir() or task_dir.name.startswith("."):
|
||||
continue
|
||||
for batch_dir in sorted(task_dir.iterdir()):
|
||||
if not batch_dir.is_dir() or batch_dir.name.startswith("."):
|
||||
continue
|
||||
report["batches"].append(
|
||||
enrich_batch(
|
||||
batch_dir,
|
||||
project="adas",
|
||||
task=task_dir.name,
|
||||
pack=None,
|
||||
batch=batch_dir.name,
|
||||
location="inbox",
|
||||
)
|
||||
)
|
||||
|
||||
if pname == "lane":
|
||||
proj["packs"] = {}
|
||||
for pack_name in all_names:
|
||||
@@ -1024,6 +1044,10 @@ def register_batch(
|
||||
batch_dir = pack_dir / tcfg["task_dir"] / src_sub / batch
|
||||
else:
|
||||
batch_dir = root / "inbox" / task / batch
|
||||
elif project == "adas":
|
||||
if not task:
|
||||
raise ValueError("adas register-batch 需要 task")
|
||||
batch_dir = root / "inbox" / task / batch
|
||||
else:
|
||||
if location == "pack" and pack:
|
||||
try:
|
||||
@@ -1057,6 +1081,16 @@ def register_batch(
|
||||
}
|
||||
if not data["counts"]["images"] and dms_has_images(batch_dir):
|
||||
data["counts"]["images"] = 1
|
||||
elif project == "adas":
|
||||
from as_platform.data.batch import count_images, count_label_files, dms_has_images
|
||||
|
||||
data["format"] = "cvat_cuboid"
|
||||
data["counts"] = {
|
||||
"images": count_images(batch_dir),
|
||||
"labels": count_label_files(batch_dir / "labels"),
|
||||
}
|
||||
if not data["counts"]["images"] and dms_has_images(batch_dir):
|
||||
data["counts"]["images"] = count_images(batch_dir / "images")
|
||||
else:
|
||||
data["format"] = "ufld_archive"
|
||||
tg = batch_dir / "list" / "train_gt.txt"
|
||||
|
||||
@@ -11,6 +11,7 @@ from sqlalchemy import (
|
||||
Float,
|
||||
ForeignKey,
|
||||
Integer,
|
||||
JSON,
|
||||
String,
|
||||
Table,
|
||||
Text,
|
||||
@@ -534,6 +535,9 @@ class LabelingCampaign(Base):
|
||||
assigned_to_user_id = Column(Integer, ForeignKey("users.id"), nullable=True, index=True)
|
||||
assigned_to_name = Column(String(128), nullable=True)
|
||||
config_xml = Column(Text, nullable=True)
|
||||
cvat_task_id = Column(Integer, nullable=True, index=True)
|
||||
cvat_job_url = Column(String(512), nullable=True)
|
||||
annotation_types = Column(JSON, nullable=True)
|
||||
created_at = Column(DateTime(timezone=True), default=_utcnow)
|
||||
updated_at = Column(DateTime(timezone=True), default=_utcnow, onupdate=_utcnow)
|
||||
|
||||
@@ -550,6 +554,9 @@ class LabelingCampaign(Base):
|
||||
"assigned_to_user_id": self.assigned_to_user_id,
|
||||
"assigned_to_name": self.assigned_to_name,
|
||||
"config_xml": self.config_xml,
|
||||
"cvat_task_id": self.cvat_task_id,
|
||||
"cvat_job_url": self.cvat_job_url,
|
||||
"annotation_types": self.annotation_types,
|
||||
"created_at": self.created_at.isoformat() if self.created_at else None,
|
||||
"updated_at": self.updated_at.isoformat() if self.updated_at else None,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
@@ -9,8 +10,58 @@ import httpx
|
||||
from as_platform.auth.feishu import _get_tenant_access_token
|
||||
from as_platform.config import FEISHU_APP_ID, FEISHU_APP_SECRET, FEISHU_LABELING_CHAT_ID
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
IM_MSG_URL = "https://open.feishu.cn/open-apis/im/v1/messages"
|
||||
|
||||
IM_MESSAGE_SCOPE_URL = (
|
||||
f"https://open.feishu.cn/app/{FEISHU_APP_ID}/auth"
|
||||
"?q=im:message:send_as_bot,im:message:send,im:message"
|
||||
"&op_from=openapi&token_type=tenant"
|
||||
if FEISHU_APP_ID
|
||||
else ""
|
||||
)
|
||||
|
||||
FEISHU_BOT_SETUP_URL = f"https://open.feishu.cn/app/{FEISHU_APP_ID}/bot" if FEISHU_APP_ID else ""
|
||||
FEISHU_PUBLISH_URL = f"https://open.feishu.cn/app/{FEISHU_APP_ID}/appPublish" if FEISHU_APP_ID else ""
|
||||
|
||||
|
||||
def _feishu_send_error_hint(message: str) -> dict[str, str]:
|
||||
"""将飞书 API 英文报错映射为可操作的中文提示。"""
|
||||
msg = message or ""
|
||||
if "Bot ability is not activated" in msg:
|
||||
return {
|
||||
"reason": "bot_not_activated",
|
||||
"help_text": "应用未启用「机器人」能力:开放平台 → 应用能力 → 添加机器人 → 创建版本并发布",
|
||||
"help_url": FEISHU_BOT_SETUP_URL or IM_MESSAGE_SCOPE_URL,
|
||||
}
|
||||
if "NO availability" in msg or "230013" in msg:
|
||||
return {
|
||||
"reason": "user_out_of_scope",
|
||||
"help_text": "你在机器人可用范围外:版本管理与发布 → 编辑可用范围 → 加入全员或你的部门 → 重新发布",
|
||||
"help_url": FEISHU_PUBLISH_URL or IM_MESSAGE_SCOPE_URL,
|
||||
}
|
||||
if "im:message" in msg or "Access denied" in msg:
|
||||
return {
|
||||
"reason": "missing_im_scope",
|
||||
"help_text": "应用未开通「发送消息」权限,请在权限管理中申请 im:message:send_as_bot",
|
||||
"help_url": IM_MESSAGE_SCOPE_URL,
|
||||
}
|
||||
return {
|
||||
"reason": "send_failed",
|
||||
"help_text": msg[:120],
|
||||
"help_url": IM_MESSAGE_SCOPE_URL,
|
||||
}
|
||||
|
||||
|
||||
def _parse_feishu_send_response(resp: httpx.Response) -> dict[str, Any]:
|
||||
data = resp.json() if resp.content else {}
|
||||
if resp.status_code < 400 and data.get("code") in (0, None):
|
||||
return {"ok": True}
|
||||
msg = data.get("msg") or f"HTTP {resp.status_code}"
|
||||
hint = _feishu_send_error_hint(msg)
|
||||
return {"ok": False, "message": msg, **hint}
|
||||
|
||||
|
||||
def is_notify_configured() -> bool:
|
||||
return bool(FEISHU_APP_ID and FEISHU_APP_SECRET and FEISHU_LABELING_CHAT_ID)
|
||||
@@ -32,23 +83,133 @@ def send_chat_text(text: str) -> dict[str, Any]:
|
||||
},
|
||||
)
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
if data.get("code") != 0:
|
||||
return {"ok": False, "message": data.get("msg") or "send failed"}
|
||||
return {"ok": True}
|
||||
return _parse_feishu_send_response(resp)
|
||||
|
||||
|
||||
def send_chat_async(text: str) -> None:
|
||||
"""异步发送飞书消息,不阻塞主流程。"""
|
||||
"""异步发送飞书群消息,不阻塞主流程。"""
|
||||
import threading
|
||||
threading.Thread(target=_send_safe, args=(text,), daemon=True, name="feishu-notify").start()
|
||||
threading.Thread(target=_send_chat_safe, args=(text,), daemon=True, name="feishu-notify").start()
|
||||
|
||||
|
||||
def _send_safe(text: str) -> None:
|
||||
def send_user_text(open_id: str, text: str) -> dict[str, Any]:
|
||||
"""向指定飞书用户发送私聊消息(需应用具备 im:message 权限)。"""
|
||||
if not FEISHU_APP_ID or not FEISHU_APP_SECRET:
|
||||
return {"ok": False, "message": "飞书未配置"}
|
||||
if not open_id:
|
||||
return {"ok": False, "message": "open_id 为空"}
|
||||
try:
|
||||
with httpx.Client(timeout=30.0) as client:
|
||||
token = _get_tenant_access_token(client)
|
||||
resp = client.post(
|
||||
IM_MSG_URL,
|
||||
params={"receive_id_type": "open_id"},
|
||||
headers={"Authorization": f"Bearer {token}"},
|
||||
json={
|
||||
"receive_id": open_id,
|
||||
"msg_type": "text",
|
||||
"content": json.dumps({"text": text}, ensure_ascii=False),
|
||||
},
|
||||
)
|
||||
data = resp.json() if resp.content else {}
|
||||
if resp.status_code >= 400 or data.get("code") not in (0, None):
|
||||
result = _parse_feishu_send_response(resp)
|
||||
logger.warning(
|
||||
"飞书私聊发送失败 open_id=%s reason=%s: %s",
|
||||
open_id[:12],
|
||||
result.get("reason"),
|
||||
result.get("message"),
|
||||
)
|
||||
return result
|
||||
return {"ok": True}
|
||||
except Exception as exc:
|
||||
logger.warning("飞书私聊发送异常 open_id=%s: %s", open_id[:12], exc)
|
||||
hint = _feishu_send_error_hint(str(exc))
|
||||
return {"ok": False, "message": str(exc), **hint}
|
||||
|
||||
|
||||
def send_user_async(open_id: str, text: str) -> None:
|
||||
"""异步向飞书用户发私聊,不阻塞主流程。"""
|
||||
import threading
|
||||
threading.Thread(
|
||||
target=_send_user_safe,
|
||||
args=(open_id, text),
|
||||
daemon=True,
|
||||
name="feishu-user-notify",
|
||||
).start()
|
||||
|
||||
|
||||
def _send_chat_safe(text: str) -> None:
|
||||
try:
|
||||
send_chat_text(text)
|
||||
except Exception:
|
||||
pass # 通知失败不影响业务流程
|
||||
pass
|
||||
|
||||
|
||||
def _send_user_safe(open_id: str, text: str) -> None:
|
||||
try:
|
||||
send_user_text(open_id, text)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def notify_labeling_assignment(
|
||||
*,
|
||||
open_id: str,
|
||||
assignee_name: str,
|
||||
task: str,
|
||||
batch: str,
|
||||
count: int,
|
||||
campaign_id: str,
|
||||
) -> dict[str, Any]:
|
||||
"""分配标注任务后向被指派人发送飞书私聊通知,返回发送结果。"""
|
||||
from as_platform.config import FRONTEND_URL
|
||||
|
||||
link = f"{FRONTEND_URL.rstrip('/')}/labeling/my-tasks?campaign={campaign_id}"
|
||||
text = (
|
||||
f"[HSAP] 您有新的标注任务\n"
|
||||
f"被指派人: {assignee_name}\n"
|
||||
f"任务: {task} / 批次: {batch}\n"
|
||||
f"分配数量: {count} 张\n"
|
||||
f"请打开我的标注: {link}"
|
||||
)
|
||||
result = send_user_text(open_id, text)
|
||||
if not result.get("ok") and is_notify_configured():
|
||||
# 私聊失败时尝试发到标注协作群
|
||||
fallback = send_chat_text(
|
||||
f"[HSAP] 任务分配通知\n"
|
||||
f"@{assignee_name} 您有 {count} 张新标注任务\n"
|
||||
f"任务: {task} / 批次: {batch}\n"
|
||||
f"打开我的标注: {link}"
|
||||
)
|
||||
if fallback.get("ok"):
|
||||
return {"ok": True, "channel": "chat", "name": assignee_name}
|
||||
return {**result, "channel": "dm", "name": assignee_name}
|
||||
|
||||
|
||||
def notify_labeling_assignment_async(
|
||||
*,
|
||||
open_id: str,
|
||||
assignee_name: str,
|
||||
task: str,
|
||||
batch: str,
|
||||
count: int,
|
||||
campaign_id: str,
|
||||
) -> None:
|
||||
import threading
|
||||
threading.Thread(
|
||||
target=notify_labeling_assignment,
|
||||
kwargs={
|
||||
"open_id": open_id,
|
||||
"assignee_name": assignee_name,
|
||||
"task": task,
|
||||
"batch": batch,
|
||||
"count": count,
|
||||
"campaign_id": campaign_id,
|
||||
},
|
||||
daemon=True,
|
||||
name="feishu-assign-notify",
|
||||
).start()
|
||||
|
||||
|
||||
def notify_batch_progress(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""标注画布:批次目录、LS 配置 XML、任务列表、标注 JSON、媒体文件。"""
|
||||
"""标注数据湖:批次目录、任务列表、标注 JSON、媒体文件(CVAT 为唯一标注引擎)。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
@@ -8,55 +8,27 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
from urllib.parse import quote
|
||||
|
||||
import yaml
|
||||
|
||||
from as_platform.config import WORKSPACE
|
||||
from as_platform.data.batch import IMG_EXTS
|
||||
from as_platform.data.core import load_wf, proj_root, resolve_pack_dir
|
||||
from as_platform.db.engine import session_scope
|
||||
from as_platform.db.models import LabelingCampaign, User
|
||||
from as_platform.labeling.scope import (
|
||||
enrich_batch_labels,
|
||||
labeling_profile_key,
|
||||
load_dms_registry,
|
||||
load_labeling_registry,
|
||||
)
|
||||
from as_platform.labeling.scope import enrich_batch_labels, load_dms_registry
|
||||
|
||||
# 历史目录名保留,导出脚本仍读取 labels/ls_annotations/
|
||||
ANNOTATIONS_DIRNAME = "ls_annotations"
|
||||
|
||||
|
||||
def _label_config_dir(project: str) -> Path:
|
||||
return WORKSPACE / "datasets" / project / "configs" / "label_studio"
|
||||
|
||||
_FALLBACK_XML = """<View>
|
||||
<Image name="image" value="$image"/>
|
||||
<RectangleLabels name="label" toName="image">
|
||||
<Label value="object"/>
|
||||
</RectangleLabels>
|
||||
</View>"""
|
||||
|
||||
|
||||
def _load_campaign(campaign_id: str) -> LabelingCampaign | None:
|
||||
with session_scope() as db:
|
||||
return db.get(LabelingCampaign, campaign_id)
|
||||
|
||||
|
||||
def resolve_editor_xml(project: str, task: str, mode: str | None) -> str:
|
||||
reg = load_dms_registry() if project == "dms" else None
|
||||
pk = labeling_profile_key(project, task or "lane_v1", mode, reg)
|
||||
prof = (load_labeling_registry().get("profiles") or {}).get(pk) or {}
|
||||
default_tpl = "dam_15cls.xml" if project == "dms" else "lane_ufld_mask.xml"
|
||||
template = prof.get("editor_template") or default_tpl
|
||||
path = _label_config_dir(project) / template
|
||||
if path.is_file():
|
||||
return path.read_text(encoding="utf-8")
|
||||
return _FALLBACK_XML
|
||||
|
||||
|
||||
def resolve_campaign_batch_dir(camp: LabelingCampaign) -> Path:
|
||||
wf = load_wf()
|
||||
root = proj_root(wf, camp.project)
|
||||
if camp.project == "dms":
|
||||
import yaml
|
||||
|
||||
reg = yaml.safe_load((root / wf["projects"]["dms"]["registry"]).read_text(encoding="utf-8"))
|
||||
tcfg = reg["tasks"][camp.task]
|
||||
if camp.location == "sources":
|
||||
@@ -78,6 +50,10 @@ def resolve_campaign_batch_dir(camp: LabelingCampaign) -> Path:
|
||||
if mode:
|
||||
return (root / "inbox" / camp.task / mode / camp.batch).resolve()
|
||||
return (root / "inbox" / camp.task / camp.batch).resolve()
|
||||
if camp.project == "adas":
|
||||
if not camp.task:
|
||||
raise ValueError("adas campaign 需要 task")
|
||||
return (root / "inbox" / camp.task / camp.batch).resolve()
|
||||
if camp.location == "pack" and camp.pack:
|
||||
try:
|
||||
from as_platform.data.core import resolve_pack
|
||||
@@ -128,23 +104,13 @@ def _annotations_dir(batch_dir: Path) -> Path:
|
||||
return d
|
||||
|
||||
|
||||
def sync_campaign_config_xml(camp: LabelingCampaign) -> str:
|
||||
"""始终与 labeling.registry + 模板文件对齐,避免 campaign 卡在旧 fallback XML。"""
|
||||
xml = resolve_editor_xml(camp.project, camp.task, camp.mode)
|
||||
if camp.config_xml != xml:
|
||||
camp.config_xml = xml
|
||||
return xml
|
||||
|
||||
|
||||
def campaign_bootstrap(campaign_id: str) -> dict[str, Any]:
|
||||
with session_scope() as db:
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
if not camp:
|
||||
raise FileNotFoundError("campaign not found")
|
||||
sync_campaign_config_xml(camp)
|
||||
reg = load_dms_registry() if camp.project == "dms" else None
|
||||
row = enrich_batch_labels(camp.to_dict(), reg)
|
||||
row["config_xml"] = camp.config_xml
|
||||
try:
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
row["batch_path"] = str(batch_dir)
|
||||
@@ -153,6 +119,9 @@ def campaign_bootstrap(campaign_id: str) -> dict[str, Any]:
|
||||
row["batch_path"] = None
|
||||
row["image_count"] = 0
|
||||
row["batch_error"] = str(e)
|
||||
row["editor"] = "cvat"
|
||||
row["cvat_task_id"] = camp.cvat_task_id
|
||||
row["cvat_job_url"] = camp.cvat_job_url
|
||||
return row
|
||||
|
||||
|
||||
@@ -259,7 +228,7 @@ def save_annotation(
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
path = _annotations_dir(batch_dir) / f"{task_id}.json"
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
extra: dict[str, Any] = {}
|
||||
extra: dict[str, Any] = {"source": "hsap", "saved_at": now}
|
||||
if user:
|
||||
extra["completed_by_user_id"] = user.id
|
||||
extra["completed_at"] = now
|
||||
|
||||
254
platform/as_platform/labeling/cvat_client.py
Normal file
254
platform/as_platform/labeling/cvat_client.py
Normal file
@@ -0,0 +1,254 @@
|
||||
"""CVAT 标注引擎客户端:通过 REST API 管理 Task/Job,上传数据,拉取标注结果。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from urllib.parse import urljoin, urlparse
|
||||
|
||||
import requests
|
||||
from requests.adapters import HTTPAdapter
|
||||
from urllib3.util.retry import Retry
|
||||
|
||||
# ── 配置 ──────────────────────────────────────────────
|
||||
# CVAT_HOST: 容器内 REST API 地址(HSAP 后端调用,无需 CVAT 账号)
|
||||
# CVAT_PUBLIC_URL: 浏览器 iframe 嵌入地址(标注画布,用户只通过 HSAP 进入)
|
||||
_CVAT_HOST = os.environ.get("CVAT_HOST", "http://cvat_traefik:8080")
|
||||
_CVAT_PUBLIC_URL = os.environ.get("CVAT_PUBLIC_URL", "http://127.0.0.1:8080").rstrip("/")
|
||||
_CVAT_EXTRA_HEADERS = {"Host": "localhost"} # traefik host-based routing for internal Docker access
|
||||
|
||||
|
||||
def public_job_url(task_id: int, job_id: int) -> str:
|
||||
"""浏览器可访问的标注页 URL(由 HSAP iframe 嵌入,不暴露 CVAT 账号体系)。"""
|
||||
return f"{_CVAT_PUBLIC_URL}/tasks/{task_id}/jobs/{job_id}"
|
||||
|
||||
|
||||
def public_job_url_with_frame(job_url: str, frame_index: int) -> str:
|
||||
"""在 CVAT Job URL 上附加帧索引,用于定位到指定图片。"""
|
||||
if frame_index < 0:
|
||||
return job_url
|
||||
sep = "&" if "?" in job_url else "?"
|
||||
return f"{job_url}{sep}frame={frame_index}"
|
||||
|
||||
|
||||
def _session() -> requests.Session:
|
||||
s = requests.Session()
|
||||
s.headers.update({"Accept": "application/vnd.cvat+json; version=2.0"})
|
||||
s.headers.update(_CVAT_EXTRA_HEADERS)
|
||||
retry = Retry(total=2, backoff_factor=0.3, status_forcelist=[429, 502, 503, 504])
|
||||
adapter = HTTPAdapter(max_retries=retry)
|
||||
s.mount("http://", adapter)
|
||||
s.mount("https://", adapter)
|
||||
return s
|
||||
|
||||
|
||||
@dataclass
|
||||
class CVATTask:
|
||||
id: int
|
||||
name: str
|
||||
status: str
|
||||
url: str
|
||||
job_url: str | None = None
|
||||
job_id: int | None = None
|
||||
|
||||
|
||||
class CVATClient:
|
||||
"""封装 CVAT REST API,提供创建任务、上传数据、拉取标注等功能。"""
|
||||
|
||||
def __init__(self, host: str | None = None):
|
||||
self.host = (host or _CVAT_HOST).rstrip("/")
|
||||
self._session = _session()
|
||||
self._api = f"{self.host}/api"
|
||||
|
||||
# ── 健康检查 ───────────────────────────────────────
|
||||
|
||||
def ping(self) -> bool:
|
||||
try:
|
||||
r = self._session.get(f"{self._api}/tasks?page_size=1", timeout=5)
|
||||
return 200 <= r.status_code < 400
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# ── Task CRUD ──────────────────────────────────────
|
||||
|
||||
def create_task(
|
||||
self,
|
||||
name: str,
|
||||
labels: list[dict[str, Any]],
|
||||
*,
|
||||
project_id: int | None = None,
|
||||
subset: str | None = None,
|
||||
bug_tracker: str | None = None,
|
||||
) -> CVATTask:
|
||||
"""创建 CVAT Task(带标注标签定义)。"""
|
||||
payload: dict[str, Any] = {
|
||||
"name": name,
|
||||
"labels": labels,
|
||||
}
|
||||
if project_id:
|
||||
payload["project_id"] = project_id
|
||||
if subset:
|
||||
payload["subset"] = subset
|
||||
if bug_tracker:
|
||||
payload["bug_tracker"] = bug_tracker
|
||||
|
||||
r = self._session.post(f"{self._api}/tasks", json=payload)
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
return CVATTask(id=data["id"], name=data["name"], status=data.get("status", ""), url=data.get("url", ""))
|
||||
|
||||
def _resolve_job(self, data: dict, task_id: int) -> tuple[int | None, str | None]:
|
||||
jobs = data.get("jobs") or {}
|
||||
if isinstance(jobs, list):
|
||||
if jobs:
|
||||
jid = jobs[0].get("id")
|
||||
return jid, public_job_url(task_id, jid)
|
||||
elif isinstance(jobs, dict):
|
||||
count = jobs.get("count", 0)
|
||||
if count > 0:
|
||||
job_url = f"{self._api}/jobs?task_id={task_id}"
|
||||
jr = self._session.get(job_url)
|
||||
jr.raise_for_status()
|
||||
jresults = jr.json().get("results", [])
|
||||
if jresults:
|
||||
jid = jresults[0].get("id")
|
||||
return jid, public_job_url(task_id, jid)
|
||||
return None, None
|
||||
|
||||
def get_task(self, task_id: int) -> CVATTask:
|
||||
r = self._session.get(f"{self._api}/tasks/{task_id}")
|
||||
r.raise_for_status()
|
||||
data = r.json()
|
||||
job_id, job_url = self._resolve_job(data, task_id)
|
||||
return CVATTask(id=data["id"], name=data["name"], status=data.get("status", ""), url=data.get("url", ""), job_url=job_url, job_id=job_id)
|
||||
|
||||
def list_tasks(self, *, status: str | None = None, name: str | None = None) -> list[CVATTask]:
|
||||
params: dict[str, str] = {}
|
||||
if status:
|
||||
params["status"] = status
|
||||
if name:
|
||||
params["search"] = name
|
||||
r = self._session.get(f"{self._api}/tasks", params=params)
|
||||
r.raise_for_status()
|
||||
results = r.json().get("results", [])
|
||||
tasks = []
|
||||
for data in results:
|
||||
job_id, job_url = self._resolve_job(data, data["id"])
|
||||
tasks.append(CVATTask(id=data["id"], name=data["name"], status=data.get("status", ""), url=data.get("url", ""), job_url=job_url, job_id=job_id))
|
||||
return tasks
|
||||
|
||||
def delete_task(self, task_id: int) -> None:
|
||||
r = self._session.delete(f"{self._api}/tasks/{task_id}")
|
||||
r.raise_for_status()
|
||||
|
||||
def get_task_status(self, task_id: int) -> str:
|
||||
return self.get_task(task_id).status
|
||||
|
||||
# ── 数据上传 ───────────────────────────────────────
|
||||
|
||||
def upload_images(self, task_id: int, image_paths: list[Path]) -> None:
|
||||
"""将图片文件上传到指定 Task。"""
|
||||
# CVAT Data API: POST /api/tasks/{id}/data
|
||||
files = {}
|
||||
opened: list = []
|
||||
for i, p in enumerate(image_paths):
|
||||
if not p.is_file():
|
||||
continue
|
||||
f = open(p, "rb")
|
||||
opened.append(f)
|
||||
files[f"client_files[{i}]"] = (p.name, f, "image/jpeg")
|
||||
try:
|
||||
r = self._session.post(f"{self._api}/tasks/{task_id}/data", files=files, data={"image_quality": 70})
|
||||
r.raise_for_status()
|
||||
finally:
|
||||
for f in opened:
|
||||
f.close()
|
||||
|
||||
def upload_annotations(self, task_id: int, annotation_file: Path, fmt: str = "KITTI 1.0") -> None:
|
||||
"""上传已有标注(如 KITTI 格式的 label_2)。"""
|
||||
with open(annotation_file, "rb") as f:
|
||||
r = self._session.put(
|
||||
f"{self._api}/tasks/{task_id}/annotations",
|
||||
files={"annotation_file": (annotation_file.name, f)},
|
||||
data={"format": fmt},
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
# ── 标注拉取 ───────────────────────────────────────
|
||||
|
||||
def download_annotations(self, task_id: int, fmt: str = "KITTI 1.0") -> bytes:
|
||||
"""下载标注结果,返回原始字节。"""
|
||||
r = self._session.get(f"{self._api}/tasks/{task_id}/annotations", params={"format": fmt})
|
||||
r.raise_for_status()
|
||||
return r.content
|
||||
|
||||
def download_annotations_json(self, task_id: int) -> dict[str, Any]:
|
||||
"""拉取 Job 级标注 JSON(CVAT 2.x 已废弃 task 级 export GET)。"""
|
||||
task = self.get_task(task_id)
|
||||
if not task.job_id:
|
||||
raise ValueError(f"CVAT task {task_id} 尚无 Job,请等待数据上传完成")
|
||||
return self.get_job_annotations(task.job_id)
|
||||
|
||||
def get_job_annotations(self, job_id: int) -> dict[str, Any]:
|
||||
r = self._session.get(f"{self._api}/jobs/{job_id}/annotations")
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
|
||||
def get_job_data_meta(self, job_id: int) -> dict[str, Any]:
|
||||
r = self._session.get(f"{self._api}/jobs/{job_id}/data/meta")
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
|
||||
def get_job_label_map(self, job_id: int) -> dict[int, str]:
|
||||
r = self._session.get(f"{self._api}/labels", params={"job_id": job_id})
|
||||
r.raise_for_status()
|
||||
return {lb["id"]: lb["name"] for lb in r.json().get("results", [])}
|
||||
|
||||
# ── Job 管理 ───────────────────────────────────────
|
||||
|
||||
def get_job_url(self, task_id: int, job_index: int = 0) -> str | None:
|
||||
"""获取可用于 iframe 嵌入的 Job URL。"""
|
||||
task = self.get_task(task_id)
|
||||
return task.job_url
|
||||
|
||||
def get_job_status(self, task_id: int) -> str:
|
||||
task = self.get_task(task_id)
|
||||
return task.status
|
||||
|
||||
# ── 3D Cuboid 标注 ─────────────────────────────────
|
||||
|
||||
def upload_cuboid_xml(self, task_id: int, xml_content: str) -> None:
|
||||
"""上传 3D cuboid 标注(CVAT for images 1.1 XML 格式)。"""
|
||||
import io
|
||||
r = self._session.post(
|
||||
f"{self._api}/tasks/{task_id}/annotations?format=CVAT+1.1",
|
||||
files={"annotation_file": ("annotations.xml", io.BytesIO(xml_content.encode()), "application/xml")},
|
||||
)
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
|
||||
# ── Project 管理(可选) ────────────────────────────
|
||||
|
||||
def create_project(self, name: str, labels: list[dict[str, Any]]) -> dict[str, Any]:
|
||||
r = self._session.post(f"{self._api}/projects", json={"name": name, "labels": labels})
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
|
||||
def list_projects(self) -> list[dict[str, Any]]:
|
||||
r = self._session.get(f"{self._api}/projects")
|
||||
r.raise_for_status()
|
||||
return r.json().get("results", [])
|
||||
|
||||
|
||||
# ── 全局客户端实例 ────────────────────────────────────
|
||||
|
||||
_client: CVATClient | None = None
|
||||
|
||||
|
||||
def get_cvat_client() -> CVATClient:
|
||||
global _client
|
||||
if _client is None:
|
||||
_client = CVATClient()
|
||||
return _client
|
||||
148
platform/as_platform/labeling/cvat_config.py
Normal file
148
platform/as_platform/labeling/cvat_config.py
Normal file
@@ -0,0 +1,148 @@
|
||||
"""CVAT 标注配置:为 DMS / ADAS / Lane 生成 label schema(唯一标注引擎)。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from as_platform.config import WORKSPACE
|
||||
from as_platform.labeling.scope import labeling_profile_key, load_dms_registry, load_labeling_registry
|
||||
|
||||
# Lane 车道线 — 折线
|
||||
LANE_LABELS: list[dict[str, Any]] = [
|
||||
{
|
||||
"name": "lane_line",
|
||||
"type": "polyline",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "type",
|
||||
"mutable": False,
|
||||
"input_type": "select",
|
||||
"values": ["solid", "dashed", "double_solid", "double_dashed", "solid_dashed"],
|
||||
"default_value": "solid",
|
||||
},
|
||||
{
|
||||
"name": "color",
|
||||
"mutable": False,
|
||||
"input_type": "select",
|
||||
"values": ["white", "yellow", "blue", "other"],
|
||||
"default_value": "white",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "curb",
|
||||
"type": "polyline",
|
||||
"attributes": [
|
||||
{
|
||||
"name": "type",
|
||||
"mutable": False,
|
||||
"input_type": "select",
|
||||
"values": ["high", "low", "none"],
|
||||
"default_value": "low",
|
||||
},
|
||||
],
|
||||
},
|
||||
{"name": "stop_line", "type": "polyline"},
|
||||
]
|
||||
|
||||
# ADAS cuboid_7cls — 单目图像 cuboid
|
||||
ADAS_CUBOID_7CLS_LABELS: list[dict[str, Any]] = [
|
||||
{"name": "car", "type": "cuboid"},
|
||||
{"name": "pedestrian", "type": "cuboid"},
|
||||
{"name": "truck", "type": "cuboid"},
|
||||
{"name": "bus", "type": "cuboid"},
|
||||
{"name": "motorcycle", "type": "cuboid"},
|
||||
{"name": "tricycle", "type": "cuboid"},
|
||||
{"name": "traffic cone", "type": "cuboid"},
|
||||
]
|
||||
|
||||
|
||||
def _rect_label(name: str, **attrs: Any) -> dict[str, Any]:
|
||||
lb: dict[str, Any] = {"name": name, "type": "rectangle"}
|
||||
if attrs:
|
||||
lb["attributes"] = attrs
|
||||
return lb
|
||||
|
||||
|
||||
def _dms_registry_task_config(task: str, mode: str | None) -> dict[str, Any]:
|
||||
import sys
|
||||
|
||||
scripts = WORKSPACE / "datasets" / "dms" / "scripts"
|
||||
if str(scripts) not in sys.path:
|
||||
sys.path.insert(0, str(scripts))
|
||||
from task_registry import get_mode_config, resolve_task_id
|
||||
|
||||
reg = load_dms_registry()
|
||||
task_r, mode_r = resolve_task_id(task, mode)
|
||||
return get_mode_config(task_r, mode_r, reg)
|
||||
|
||||
|
||||
def _labels_from_class_names(names: list[str] | dict[int | str, str]) -> list[dict[str, Any]]:
|
||||
if isinstance(names, dict):
|
||||
ordered = [names[k] for k in sorted(names, key=lambda x: int(x))]
|
||||
else:
|
||||
ordered = list(names)
|
||||
return [_rect_label(str(n)) for n in ordered]
|
||||
|
||||
|
||||
def _dms_pose_labels() -> list[dict[str, Any]]:
|
||||
labels: list[dict[str, Any]] = [_rect_label("face")]
|
||||
labels.extend({"name": f"kp_{i:02d}", "type": "points"} for i in range(37))
|
||||
return labels
|
||||
|
||||
|
||||
def _dms_labels(task: str, mode: str | None) -> list[dict[str, Any]]:
|
||||
tcfg = _dms_registry_task_config(task, mode)
|
||||
ttype = tcfg.get("type") or "detect"
|
||||
if ttype == "pose":
|
||||
return _dms_pose_labels()
|
||||
names = tcfg.get("names")
|
||||
if names:
|
||||
return _labels_from_class_names(names)
|
||||
return [_rect_label("object")]
|
||||
|
||||
|
||||
def _labels_from_registry_profile(project: str, task: str, mode: str | None) -> list[dict[str, Any]] | None:
|
||||
reg = load_dms_registry() if project == "dms" else None
|
||||
pk = labeling_profile_key(project, task, mode, reg)
|
||||
prof = (load_labeling_registry().get("profiles") or {}).get(pk) or {}
|
||||
cvat_names = prof.get("cvat_labels")
|
||||
if cvat_names:
|
||||
return [{"name": str(n), "type": "cuboid"} for n in cvat_names]
|
||||
return None
|
||||
|
||||
|
||||
def build_cvat_labels(
|
||||
project: str,
|
||||
task: str | None = None,
|
||||
mode: str | None = None,
|
||||
annotation_types: list[str] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""根据 HSAP project/task/mode 生成 CVAT Task 的 labels 定义。"""
|
||||
task = task or ""
|
||||
prof_labels = _labels_from_registry_profile(project, task, mode)
|
||||
if prof_labels is not None:
|
||||
return prof_labels
|
||||
|
||||
if project == "adas":
|
||||
if task == "cuboid_7cls":
|
||||
return ADAS_CUBOID_7CLS_LABELS
|
||||
return ADAS_CUBOID_7CLS_LABELS
|
||||
|
||||
if project == "lane":
|
||||
return LANE_LABELS
|
||||
|
||||
if project == "dms":
|
||||
return _dms_labels(task, mode)
|
||||
|
||||
return [_rect_label("object")]
|
||||
|
||||
|
||||
def resolve_annotation_types(project: str, task: str | None = None, mode: str | None = None) -> list[str]:
|
||||
mapping = {
|
||||
"dms": ["bbox", "keypoint"],
|
||||
"adas": ["cuboid"],
|
||||
"lane": ["polyline"],
|
||||
}
|
||||
if project == "adas" and task == "cuboid_7cls":
|
||||
return ["cuboid"]
|
||||
return mapping.get(project, ["bbox"])
|
||||
625
platform/as_platform/labeling/format_converter.py
Normal file
625
platform/as_platform/labeling/format_converter.py
Normal file
@@ -0,0 +1,625 @@
|
||||
"""标注格式转换器:KITTI / CVAT JSON / YOLO / COCO / HSAP quaternion 互转。"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import math
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# Quaternion ↔ Euler 辅助
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def quat_to_rot_y(qw: float, qx: float, qy: float, qz: float) -> float:
|
||||
"""四元数 → 绕 Y 轴旋转角 (KITTI rot_y)。"""
|
||||
# rot_y = atan2(2*(qw*qy + qx*qz), 1 - 2*(qy^2 + qx^2))
|
||||
sin_y = 2.0 * (qw * qy + qx * qz)
|
||||
cos_y = 1.0 - 2.0 * (qy * qy + qx * qx)
|
||||
return math.atan2(sin_y, cos_y)
|
||||
|
||||
|
||||
def rot_y_to_quat(rot_y: float) -> tuple[float, float, float, float]:
|
||||
"""绕 Y 轴旋转角 → 四元数 (qw, qx, qy, qz)。"""
|
||||
half = rot_y / 2.0
|
||||
return (math.cos(half), 0.0, math.sin(half), 0.0)
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# 原始 quaternion 格式 → KITTI label_2
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def quaternion_line_to_kitti(line: str, calib_bbox_fn=None) -> str | None:
|
||||
"""将一行 quaternion 格式转为 KITTI label_2 行。
|
||||
|
||||
输入格式 (空格分隔):
|
||||
Class x y z w l h qw qx qy qz class_id truncation [bbox_2d_8values] [extra...]
|
||||
|
||||
输出格式 (KITTI label_2):
|
||||
Class truncated occluded alpha bbox_x1 bbox_y1 bbox_x2 bbox_y2 h w l x y z rot_y [score]
|
||||
"""
|
||||
parts = line.strip().split()
|
||||
if len(parts) < 13:
|
||||
return None
|
||||
|
||||
label = parts[0]
|
||||
x = float(parts[1])
|
||||
y = float(parts[2])
|
||||
z = float(parts[3])
|
||||
w = float(parts[4])
|
||||
l = float(parts[5])
|
||||
h_dim = float(parts[6])
|
||||
qw = float(parts[7])
|
||||
qx = float(parts[8])
|
||||
qy = float(parts[9])
|
||||
qz = float(parts[10])
|
||||
class_id = int(parts[11]) if len(parts) > 11 else 0
|
||||
truncation = int(parts[12]) if len(parts) > 12 else 0
|
||||
|
||||
rot_y = quat_to_rot_y(qw, qx, qy, qz)
|
||||
# KITTI: alpha = rot_y - arctan(center_x / center_z), 简化处理
|
||||
alpha = rot_y
|
||||
|
||||
# 2D bbox (如果存在: 后续8个值)
|
||||
bbox_2d = None
|
||||
if len(parts) >= 21:
|
||||
try:
|
||||
bbox_2d = [float(p) for p in parts[13:21]]
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# 截断和遮挡
|
||||
occluded = 0 # quaternion 格式没有直接对应
|
||||
|
||||
# KITTI 位置是 camera coordinate: x(right), y(down), z(forward)
|
||||
# quaternion 格式是 LiDAR coordinate: x(forward), y(left), z(up)
|
||||
# 简化转换:x_kitti = -y_lidar, y_kitti = -z_lidar, z_kitti = x_lidar
|
||||
kitti_x = -y
|
||||
kitti_y = -z
|
||||
kitti_z = x
|
||||
|
||||
# KITTI 3D 尺寸: height, width, length
|
||||
if bbox_2d and len(bbox_2d) == 8:
|
||||
x1, y1, x2, y2 = bbox_2d[0:4]
|
||||
else:
|
||||
x1 = y1 = x2 = y2 = 0
|
||||
|
||||
# Format: Class truncated occluded alpha x1 y1 x2 y2 h w l x y z rot_y
|
||||
return (
|
||||
f"{label} {truncation} {occluded} {alpha:.6f} "
|
||||
f"{x1:.2f} {y1:.2f} {x2:.2f} {y2:.2f} "
|
||||
f"{h_dim:.6f} {w:.6f} {l:.6f} "
|
||||
f"{kitti_x:.6f} {kitti_y:.6f} {kitti_z:.6f} "
|
||||
f"{rot_y:.6f}"
|
||||
)
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# KITTI → 原始 quaternion 格式
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def kitti_line_to_quaternion(line: str) -> str | None:
|
||||
"""KITTI label_2 → quaternion 格式(回传HSAP)。"""
|
||||
parts = line.strip().split()
|
||||
if len(parts) < 15:
|
||||
return None
|
||||
|
||||
label = parts[0]
|
||||
alpha = float(parts[3])
|
||||
bbox = [float(p) for p in parts[4:8]]
|
||||
h_dim = float(parts[8])
|
||||
w = float(parts[9])
|
||||
l = float(parts[10])
|
||||
kx = float(parts[11])
|
||||
ky = float(parts[12])
|
||||
kz = float(parts[13])
|
||||
rot_y = float(parts[14])
|
||||
|
||||
# 逆转换
|
||||
x = kz # LiDAR X = KITTI Z
|
||||
y = -kx # LiDAR Y = -KITTI X
|
||||
z = -ky # LiDAR Z = -KITTI Y
|
||||
|
||||
qw, qx, qy, qz = rot_y_to_quat(rot_y)
|
||||
|
||||
# 输出 quaternion 格式
|
||||
return (
|
||||
f"{label} {x:.6f} {y:.6f} {z:.6f} {w:.6f} {l:.6f} {h_dim:.6f} "
|
||||
f"{qw:.6f} {qx:.6f} {qy:.6f} {qz:.6f} 0 0 "
|
||||
f"{bbox[0]:.2f} {bbox[1]:.2f} {bbox[2]:.2f} {bbox[3]:.2f} "
|
||||
f"0 0 0 0 0 0 1"
|
||||
)
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# CVAT Job API shapes → HSAP / YOLO
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def cvat_shape_to_result_item(
|
||||
shape: dict[str, Any],
|
||||
label_map: dict[int, str],
|
||||
) -> dict[str, Any]:
|
||||
"""CVAT Job annotations API 单条 shape → HSAP result 条目。"""
|
||||
label = label_map.get(shape.get("label_id"), "unknown")
|
||||
stype = shape.get("type", "")
|
||||
item: dict[str, Any] = {
|
||||
"type": stype,
|
||||
"label": label,
|
||||
"source": "cvat",
|
||||
"cvat_id": shape.get("id"),
|
||||
"frame": shape.get("frame", 0),
|
||||
}
|
||||
if stype == "rectangle":
|
||||
item["points"] = [
|
||||
shape.get("xtl", 0),
|
||||
shape.get("ytl", 0),
|
||||
shape.get("xbr", 0),
|
||||
shape.get("ybr", 0),
|
||||
]
|
||||
elif stype == "cuboid":
|
||||
for key in (
|
||||
"xtl1", "ytl1", "xtr1", "ytr1", "xbl1", "ybl1", "xbr1", "ybr1",
|
||||
"xtl2", "ytl2", "xtr2", "ytr2", "xbl2", "ybl2", "xbr2", "ybr2",
|
||||
):
|
||||
if key in shape:
|
||||
item[key] = shape[key]
|
||||
if shape.get("points"):
|
||||
item["points"] = shape["points"]
|
||||
elif stype in ("polyline", "polygon", "points"):
|
||||
item["points"] = shape.get("points", [])
|
||||
return item
|
||||
|
||||
|
||||
def cvat_job_shapes_to_yolo_lines(
|
||||
shapes: list[dict[str, Any]],
|
||||
label_map: dict[int, str],
|
||||
class_map: dict[str, int],
|
||||
img_width: int,
|
||||
img_height: int,
|
||||
) -> list[str]:
|
||||
lines: list[str] = []
|
||||
for shape in shapes:
|
||||
if shape.get("type") != "rectangle":
|
||||
continue
|
||||
label = label_map.get(shape.get("label_id"), "")
|
||||
class_id = class_map.get(label)
|
||||
if class_id is None:
|
||||
# 尝试大小写不敏感匹配
|
||||
for name, cid in class_map.items():
|
||||
if name.lower() == label.lower():
|
||||
class_id = cid
|
||||
break
|
||||
if class_id is None:
|
||||
continue
|
||||
x1, y1, x2, y2 = (
|
||||
float(shape.get("xtl", 0)),
|
||||
float(shape.get("ytl", 0)),
|
||||
float(shape.get("xbr", 0)),
|
||||
float(shape.get("ybr", 0)),
|
||||
)
|
||||
if img_width <= 0 or img_height <= 0:
|
||||
continue
|
||||
cx = ((x1 + x2) / 2) / img_width
|
||||
cy = ((y1 + y2) / 2) / img_height
|
||||
bw = (x2 - x1) / img_width
|
||||
bh = (y2 - y1) / img_height
|
||||
lines.append(f"{class_id} {cx:.6f} {cy:.6f} {bw:.6f} {bh:.6f}")
|
||||
return lines
|
||||
|
||||
|
||||
def group_cvat_job_shapes_by_frame(
|
||||
job_annotations: dict[str, Any],
|
||||
) -> dict[int, list[dict[str, Any]]]:
|
||||
grouped: dict[int, list[dict[str, Any]]] = {}
|
||||
for shape in job_annotations.get("shapes") or []:
|
||||
frame = int(shape.get("frame", 0))
|
||||
grouped.setdefault(frame, []).append(shape)
|
||||
return grouped
|
||||
|
||||
|
||||
def cvat_shapes_to_export_regions(
|
||||
shapes: list[dict[str, Any]],
|
||||
label_map: dict[int, str],
|
||||
img_width: int,
|
||||
img_height: int,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""CVAT Job shapes → HSAP 导出链兼容的 result[](原 Label Studio 字段布局)。"""
|
||||
if img_width <= 0 or img_height <= 0:
|
||||
return []
|
||||
|
||||
regions: list[dict[str, Any]] = []
|
||||
for shape in shapes:
|
||||
stype = shape.get("type") or ""
|
||||
label = label_map.get(shape.get("label_id"), "unknown")
|
||||
base = {
|
||||
"id": str(shape.get("id", "")),
|
||||
"original_width": img_width,
|
||||
"original_height": img_height,
|
||||
}
|
||||
|
||||
if stype == "rectangle":
|
||||
xtl = float(shape.get("xtl", 0))
|
||||
ytl = float(shape.get("ytl", 0))
|
||||
xbr = float(shape.get("xbr", 0))
|
||||
ybr = float(shape.get("ybr", 0))
|
||||
regions.append({
|
||||
**base,
|
||||
"type": "rectanglelabels",
|
||||
"value": {
|
||||
"x": xtl / img_width * 100.0,
|
||||
"y": ytl / img_height * 100.0,
|
||||
"width": (xbr - xtl) / img_width * 100.0,
|
||||
"height": (ybr - ytl) / img_height * 100.0,
|
||||
"rotation": 0,
|
||||
"rectanglelabels": [label],
|
||||
},
|
||||
})
|
||||
elif stype == "points":
|
||||
pts = shape.get("points") or []
|
||||
if len(pts) < 2:
|
||||
continue
|
||||
regions.append({
|
||||
**base,
|
||||
"type": "keypointlabels",
|
||||
"value": {
|
||||
"x": float(pts[0]) / img_width * 100.0,
|
||||
"y": float(pts[1]) / img_height * 100.0,
|
||||
"width": 0.5,
|
||||
"keypointlabels": [label],
|
||||
},
|
||||
})
|
||||
elif stype in ("polyline", "polygon"):
|
||||
regions.append({
|
||||
**base,
|
||||
"type": "polyline",
|
||||
"label": label,
|
||||
"points": list(shape.get("points") or []),
|
||||
})
|
||||
elif stype == "cuboid":
|
||||
item = cvat_shape_to_result_item(shape, label_map)
|
||||
item["original_width"] = img_width
|
||||
item["original_height"] = img_height
|
||||
regions.append(item)
|
||||
return regions
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# CVAT JSON → YOLO bbox
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def cvat_json_to_yolo(
|
||||
cvat_annotations: dict[str, Any],
|
||||
class_map: dict[str, int],
|
||||
img_width: int = 1920,
|
||||
img_height: int = 1080,
|
||||
) -> dict[str, list[str]]:
|
||||
"""CVAT annotations JSON → YOLO 格式文件内容。
|
||||
|
||||
返回 {image_name: [yolo_line, ...]} 的字典。
|
||||
"""
|
||||
result: dict[str, list[str]] = {}
|
||||
|
||||
for img_ann in cvat_annotations.get("annotations", []):
|
||||
frame = img_ann.get("frame", 0)
|
||||
img_name = _resolve_image_name(cvat_annotations, img_ann)
|
||||
lines: list[str] = []
|
||||
|
||||
for shape in img_ann.get("shapes", []):
|
||||
shape_type = shape.get("type", "")
|
||||
label_name = shape.get("label", "")
|
||||
class_id = class_map.get(label_name)
|
||||
if class_id is None:
|
||||
continue
|
||||
|
||||
if shape_type == "rectangle":
|
||||
# YOLO: class_id cx cy w h (归一化 0-1)
|
||||
x1, y1, x2, y2 = (shape.get(p, 0) for p in ("xtl", "ytl", "xbr", "ybr"))
|
||||
cx = ((x1 + x2) / 2) / img_width
|
||||
cy = ((y1 + y2) / 2) / img_height
|
||||
bw = (x2 - x1) / img_width
|
||||
bh = (y2 - y1) / img_height
|
||||
lines.append(f"{class_id} {cx:.6f} {cy:.6f} {bw:.6f} {bh:.6f}")
|
||||
|
||||
if lines:
|
||||
result[img_name] = lines
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# CVAT JSON → COCO keypoints
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def cvat_json_to_coco_keypoints(
|
||||
cvat_annotations: dict[str, Any],
|
||||
keypoint_labels: list[str],
|
||||
image_dir: Path | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""提取 CVAT 关键点标注 → COCO keypoints 格式。"""
|
||||
images: list[dict[str, Any]] = []
|
||||
annotations: list[dict[str, Any]] = []
|
||||
# 构建 keypoint_label → id 映射
|
||||
kp_map = {name: i for i, name in enumerate(keypoint_labels)}
|
||||
|
||||
ann_id = 0
|
||||
for img_idx, img_ann in enumerate(cvat_annotations.get("annotations", [])):
|
||||
img_name = _resolve_image_name(cvat_annotations, img_ann)
|
||||
img_w = img_ann.get("width", 1920)
|
||||
img_h = img_ann.get("height", 1080)
|
||||
img_id = img_idx + 1
|
||||
images.append({"id": img_id, "file_name": img_name, "width": img_w, "height": img_h})
|
||||
|
||||
for shape in img_ann.get("shapes", []):
|
||||
if shape.get("type") != "points":
|
||||
continue
|
||||
points = shape.get("points", [])
|
||||
if not points:
|
||||
continue
|
||||
# points 格式: [[x1,y1], [x2,y2], ...]
|
||||
keypoints_list: list[float] = []
|
||||
num_keypoints = 0
|
||||
for kp_label in keypoint_labels:
|
||||
kp_data = next((p for p in points if p.get("label") == kp_label), None)
|
||||
if kp_data:
|
||||
keypoints_list.extend([kp_data.get("x", 0), kp_data.get("y", 0), 2]) # visible
|
||||
num_keypoints += 1
|
||||
else:
|
||||
keypoints_list.extend([0, 0, 0]) # not labeled
|
||||
|
||||
annotations.append({
|
||||
"id": ann_id,
|
||||
"image_id": img_id,
|
||||
"category_id": 1,
|
||||
"keypoints": keypoints_list,
|
||||
"num_keypoints": num_keypoints,
|
||||
"bbox": _keypoint_bbox(keypoints_list, img_w, img_h),
|
||||
})
|
||||
ann_id += 1
|
||||
|
||||
return {
|
||||
"images": images,
|
||||
"annotations": annotations,
|
||||
"categories": [{"id": 1, "name": "person", "keypoints": keypoint_labels, "skeleton": []}],
|
||||
}
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# CVAT JSON → HSAP Lane polyline
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def cvat_json_to_lane_polylines(
|
||||
cvat_annotations: dict[str, Any],
|
||||
) -> dict[str, list[dict[str, Any]]]:
|
||||
"""提取 CVAT 折线标注 → HSAP 车道线格式。"""
|
||||
result: dict[str, list[dict[str, Any]]] = {}
|
||||
|
||||
for img_ann in cvat_annotations.get("annotations", []):
|
||||
img_name = _resolve_image_name(cvat_annotations, img_ann)
|
||||
polylines: list[dict[str, Any]] = []
|
||||
|
||||
for shape in img_ann.get("shapes", []):
|
||||
if shape.get("type") not in ("polyline", "polygon"):
|
||||
continue
|
||||
points = shape.get("points", [])
|
||||
if not points:
|
||||
continue
|
||||
attrs = {a.get("name"): a.get("value") for a in (shape.get("attributes") or [])}
|
||||
polylines.append({
|
||||
"label": shape.get("label", "lane_line"),
|
||||
"attributes": attrs,
|
||||
"points": [[p.get("x", 0), p.get("y", 0)] for p in points],
|
||||
})
|
||||
|
||||
if polylines:
|
||||
result[img_name] = polylines
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# 辅助函数
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def _resolve_image_name(annotations: dict[str, Any], img_ann: dict[str, Any]) -> str:
|
||||
"""从 CVAT annotation JSON 中解析图像文件名。"""
|
||||
frame = img_ann.get("frame", 0)
|
||||
images = annotations.get("images", [])
|
||||
if isinstance(images, list) and frame < len(images):
|
||||
img_info = images[frame]
|
||||
if isinstance(img_info, dict):
|
||||
return img_info.get("file_name", f"frame_{frame}")
|
||||
return img_ann.get("name", f"frame_{frame}")
|
||||
|
||||
|
||||
def _keypoint_bbox(kpts: list[float], img_w: int, img_h: int) -> list[float]:
|
||||
"""从 keypoints 列表计算 bbox [x, y, w, h]。"""
|
||||
xs = [kpts[i] for i in range(0, len(kpts), 3) if kpts[i + 2] > 0]
|
||||
ys = [kpts[i + 1] for i in range(0, len(kpts), 3) if kpts[i + 2] > 0]
|
||||
if not xs or not ys:
|
||||
return [0, 0, 0, 0]
|
||||
x_min, x_max = min(xs), max(xs)
|
||||
y_min, y_max = min(ys), max(ys)
|
||||
return [x_min, y_min, x_max - x_min, y_max - y_min]
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# 批量 KITTI 转换
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def convert_quaternion_dir_to_kitti(label_dir: Path, output_dir: Path) -> int:
|
||||
"""将 quaternion 格式目录批量转换为 KITTI label_2 格式。"""
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
count = 0
|
||||
for txt_file in sorted(label_dir.rglob("*.txt")):
|
||||
kitti_lines: list[str] = []
|
||||
for line in txt_file.read_text(encoding="utf-8").strip().split("\n"):
|
||||
if not line.strip():
|
||||
continue
|
||||
kitti_line = quaternion_line_to_kitti(line)
|
||||
if kitti_line:
|
||||
kitti_lines.append(kitti_line)
|
||||
if kitti_lines:
|
||||
out_file = output_dir / txt_file.name
|
||||
out_file.write_text("\n".join(kitti_lines) + "\n", encoding="utf-8")
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
def convert_cvat_kitti_export_to_hsap(kitti_data: bytes, output_dir: Path) -> int:
|
||||
"""将 CVAT KITTI 导出(zip 字节)解压并转为 HSAP quaternion 格式。"""
|
||||
import io
|
||||
import zipfile
|
||||
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
count = 0
|
||||
with zipfile.ZipFile(io.BytesIO(kitti_data)) as zf:
|
||||
for name in zf.namelist():
|
||||
if not name.endswith(".txt") or "label_2" not in name:
|
||||
continue
|
||||
content = zf.read(name).decode("utf-8")
|
||||
hsap_lines: list[str] = []
|
||||
for line in content.strip().split("\n"):
|
||||
if not line.strip():
|
||||
continue
|
||||
hsap_line = kitti_line_to_quaternion(line)
|
||||
if hsap_line:
|
||||
hsap_lines.append(hsap_line)
|
||||
if hsap_lines:
|
||||
fname = Path(name).name
|
||||
(output_dir / fname).write_text("\n".join(hsap_lines) + "\n", encoding="utf-8")
|
||||
count += 1
|
||||
return count
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# ADAS 3D Quaternion JSON → CVAT cuboid XML
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
from xml.etree.ElementTree import Element, SubElement, tostring
|
||||
from xml.dom import minidom
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
def _get_np():
|
||||
"""Lazy numpy import."""
|
||||
import numpy as np
|
||||
return np
|
||||
|
||||
|
||||
def _quat_to_rotation_matrix(qw: float, qx: float, qy: float, qz: float):
|
||||
np = _get_np()
|
||||
return np.array([
|
||||
[1 - 2*qy**2 - 2*qz**2, 2*qx*qy - 2*qz*qw, 2*qx*qz + 2*qy*qw],
|
||||
[2*qx*qy + 2*qz*qw, 1 - 2*qx**2 - 2*qz**2, 2*qy*qz - 2*qx*qw],
|
||||
[2*qx*qz - 2*qy*qw, 2*qy*qz + 2*qx*qw, 1 - 2*qx**2 - 2*qy**2],
|
||||
])
|
||||
|
||||
|
||||
def _get_3d_corners(center, w, l, h, qw, qx, qy, qz):
|
||||
"""Compute 8 corners in camera coordinates.
|
||||
Object frame: x=forward(±l/2), y=left(±w/2), z=up(±h/2)."""
|
||||
np = _get_np()
|
||||
ox = np.array([-l/2, -l/2, -l/2, -l/2, l/2, l/2, l/2, l/2])
|
||||
oy = np.array([-w/2, w/2, w/2, -w/2, -w/2, w/2, w/2, -w/2])
|
||||
oz = np.array([-h/2, -h/2, h/2, h/2, -h/2, -h/2, h/2, h/2])
|
||||
corners_obj = np.stack([ox, oy, oz], axis=1)
|
||||
R = _quat_to_rotation_matrix(qw, qx, qy, qz)
|
||||
return (R @ corners_obj.T).T + np.array(center)
|
||||
|
||||
|
||||
def _project_2d(pts_3d, K):
|
||||
pts = pts_3d @ K.T
|
||||
return pts[:, :2] / pts[:, 2:]
|
||||
|
||||
|
||||
def quaternion_json_to_cvat_cuboid_xml(
|
||||
json_dir: str | Path,
|
||||
image_names: list[str],
|
||||
task_id: int | None = None,
|
||||
) -> str:
|
||||
"""将 ADAS 3D quaternion JSON 标注转换为 CVAT cuboid XML。
|
||||
|
||||
Args:
|
||||
json_dir: 包含 .json 标注文件的目录
|
||||
image_names: 图像文件名列表(与 CVAT task 中的 frame 顺序对应)
|
||||
task_id: 可选 CVAT task ID
|
||||
|
||||
Returns:
|
||||
CVAT for images 1.1 XML 字符串
|
||||
"""
|
||||
json_dir = Path(json_dir)
|
||||
root = Element("annotations")
|
||||
SubElement(root, "version").text = "1.1"
|
||||
meta = SubElement(root, "meta")
|
||||
te = SubElement(meta, "task")
|
||||
SubElement(te, "id").text = str(task_id or 0)
|
||||
SubElement(te, "name").text = "ADAS 3D"
|
||||
SubElement(te, "size").text = str(len(image_names))
|
||||
SubElement(te, "mode").text = "annotation"
|
||||
SubElement(te, "overlap").text = "0"
|
||||
now = datetime.now(timezone.utc).isoformat()
|
||||
SubElement(te, "created").text = now
|
||||
SubElement(te, "updated").text = now
|
||||
le = SubElement(te, "labels")
|
||||
for lbl in ["car", "pedestrian", "truck", "bus", "motorcycle", "tricycle", "traffic cone"]:
|
||||
l = SubElement(le, "label"); SubElement(l, "name").text = lbl; SubElement(l, "attributes")
|
||||
se = SubElement(te, "segments"); s = SubElement(se, "segment")
|
||||
SubElement(s, "id").text = "1"; SubElement(s, "start").text = "0"
|
||||
SubElement(s, "stop").text = str(len(image_names) - 1)
|
||||
ow = SubElement(te, "owner"); SubElement(ow, "username").text = "platform"; SubElement(ow, "email").text = ""
|
||||
SubElement(meta, "dumped").text = now
|
||||
|
||||
total = 0
|
||||
for fid, img_name in enumerate(image_names):
|
||||
stem = Path(img_name).stem
|
||||
jp = json_dir / f"{stem}.json"
|
||||
if not jp.is_file():
|
||||
continue
|
||||
|
||||
ann = json.loads(jp.read_text(encoding="utf-8"))
|
||||
np = _get_np()
|
||||
K = np.array(ann["K"])
|
||||
img_w, img_h = ann["image_size"]
|
||||
|
||||
ie = SubElement(root, "image")
|
||||
ie.set("id", str(fid))
|
||||
ie.set("name", Path(img_name).name)
|
||||
ie.set("width", str(img_w))
|
||||
ie.set("height", str(img_h))
|
||||
|
||||
for det in ann.get("detections", []):
|
||||
w, l, h = det["dimensions_wlh"]
|
||||
c3d = _get_3d_corners(det["center_3d"], w, l, h, *det["quaternion_wxyz"])
|
||||
if _get_np().any(c3d[:, 2] <= 0):
|
||||
continue
|
||||
c2d = _project_2d(c3d, K)
|
||||
|
||||
# 4 edge-pairs: (rear, front) × (tl, tr, bl, br)
|
||||
pairs = [(3, 7), (2, 6), (0, 4), (1, 5)]
|
||||
pd = []
|
||||
for ri, fi in pairs:
|
||||
mid = (c2d[ri] + c2d[fi]) / 2.0
|
||||
f1_i, f2_i = (fi, ri) if c3d[fi, 2] <= c3d[ri, 2] else (ri, fi)
|
||||
pd.append({"mid": mid, "f1_i": f1_i, "f2_i": f2_i})
|
||||
|
||||
pd.sort(key=lambda p: p["mid"][1])
|
||||
top = sorted(pd[:2], key=lambda p: p["mid"][0])
|
||||
bot = sorted(pd[2:], key=lambda p: p["mid"][0])
|
||||
tl, tr = top[0], top[1]
|
||||
bl, br = bot[0], bot[1]
|
||||
|
||||
cub = SubElement(ie, "cuboid")
|
||||
cub.set("label", det["class_name"]); cub.set("source", "manual"); cub.set("occluded", "0")
|
||||
cub.set("xtl1", f"{c2d[tl['f1_i']][0]:.2f}"); cub.set("ytl1", f"{c2d[tl['f1_i']][1]:.2f}")
|
||||
cub.set("xtr1", f"{c2d[tr['f1_i']][0]:.2f}"); cub.set("ytr1", f"{c2d[tr['f1_i']][1]:.2f}")
|
||||
cub.set("xbl1", f"{c2d[bl['f1_i']][0]:.2f}"); cub.set("ybl1", f"{c2d[bl['f1_i']][1]:.2f}")
|
||||
cub.set("xbr1", f"{c2d[br['f1_i']][0]:.2f}"); cub.set("ybr1", f"{c2d[br['f1_i']][1]:.2f}")
|
||||
cub.set("xtl2", f"{c2d[tl['f2_i']][0]:.2f}"); cub.set("ytl2", f"{c2d[tl['f2_i']][1]:.2f}")
|
||||
cub.set("xtr2", f"{c2d[tr['f2_i']][0]:.2f}"); cub.set("ytr2", f"{c2d[tr['f2_i']][1]:.2f}")
|
||||
cub.set("xbl2", f"{c2d[bl['f2_i']][0]:.2f}"); cub.set("ybl2", f"{c2d[bl['f2_i']][1]:.2f}")
|
||||
cub.set("xbr2", f"{c2d[br['f2_i']][0]:.2f}"); cub.set("ybr2", f"{c2d[br['f2_i']][1]:.2f}")
|
||||
cub.set("z_order", "0")
|
||||
total += 1
|
||||
|
||||
xml_str = minidom.parseString(tostring(root, 'utf-8')).toprettyxml(indent=" ")
|
||||
return xml_str
|
||||
@@ -98,15 +98,23 @@ def campaign_progress(campaign_id: str) -> dict[str, Any]:
|
||||
)
|
||||
user_ids = {r.user_id for r in rows} | {r.completed_by_user_id for r in rows if r.completed_by_user_id}
|
||||
names = _user_name_map(db, user_ids)
|
||||
assignment_rows = [
|
||||
{
|
||||
"user_id": r.user_id,
|
||||
"task_id": r.task_id,
|
||||
"completed_at": r.completed_at,
|
||||
}
|
||||
for r in rows
|
||||
]
|
||||
|
||||
total = len(all_ids)
|
||||
completed = len(completed_ids)
|
||||
assigned = len(rows)
|
||||
assigned = len(assignment_rows)
|
||||
by_user_agg: dict[int, dict[str, int]] = defaultdict(lambda: {"assigned": 0, "completed": 0})
|
||||
for r in rows:
|
||||
by_user_agg[r.user_id]["assigned"] += 1
|
||||
if r.completed_at or r.task_id in completed_ids:
|
||||
by_user_agg[r.user_id]["completed"] += 1
|
||||
for r in assignment_rows:
|
||||
by_user_agg[r["user_id"]]["assigned"] += 1
|
||||
if r["completed_at"] or r["task_id"] in completed_ids:
|
||||
by_user_agg[r["user_id"]]["completed"] += 1
|
||||
|
||||
by_user = []
|
||||
for uid, stats in sorted(by_user_agg.items(), key=lambda x: names.get(x[0], "")):
|
||||
@@ -155,9 +163,66 @@ def get_assigned_task_ids(campaign_id: str, user_id: int | None = None) -> set[s
|
||||
return {row[0] for row in q.all()}
|
||||
|
||||
|
||||
def _assign_result(campaign_id: str, created: int) -> dict[str, Any]:
|
||||
def _assign_result(
|
||||
campaign_id: str,
|
||||
created: int,
|
||||
notifications: list[dict[str, Any]] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
prog = campaign_progress(campaign_id)
|
||||
return {"assigned": created, "by_user": prog["by_user"], "progress": prog}
|
||||
return {
|
||||
"assigned": created,
|
||||
"by_user": prog["by_user"],
|
||||
"progress": prog,
|
||||
"notifications": notifications or [],
|
||||
}
|
||||
|
||||
|
||||
def _build_notify_payload(
|
||||
assigned_counts: dict[int, int],
|
||||
user_map: dict[int, User],
|
||||
camp: LabelingCampaign | None,
|
||||
campaign_id: str,
|
||||
) -> tuple[str, str, list[dict[str, Any]]]:
|
||||
"""在 session 内提取通知所需字段,避免 DetachedInstanceError。"""
|
||||
task = (camp.task if camp else "") or ""
|
||||
batch = (camp.batch if camp else "") or campaign_id
|
||||
targets: list[dict[str, Any]] = []
|
||||
for uid, count in assigned_counts.items():
|
||||
if count <= 0:
|
||||
continue
|
||||
u = user_map.get(uid)
|
||||
if not u or not u.feishu_open_id:
|
||||
continue
|
||||
targets.append({
|
||||
"open_id": u.feishu_open_id,
|
||||
"name": u.name or f"user-{uid}",
|
||||
"count": count,
|
||||
})
|
||||
return task, batch, targets
|
||||
|
||||
|
||||
def _notify_assignees(
|
||||
campaign_id: str,
|
||||
task: str,
|
||||
batch: str,
|
||||
targets: list[dict[str, Any]],
|
||||
) -> list[dict[str, Any]]:
|
||||
if not targets:
|
||||
return []
|
||||
from as_platform.integrations.feishu_notify import notify_labeling_assignment
|
||||
|
||||
results: list[dict[str, Any]] = []
|
||||
for t in targets:
|
||||
r = notify_labeling_assignment(
|
||||
open_id=t["open_id"],
|
||||
assignee_name=t["name"],
|
||||
task=task,
|
||||
batch=batch,
|
||||
count=t["count"],
|
||||
campaign_id=campaign_id,
|
||||
)
|
||||
results.append(r)
|
||||
return results
|
||||
|
||||
|
||||
def assign_tasks_even(
|
||||
@@ -181,7 +246,10 @@ def assign_tasks_even(
|
||||
users = db.query(User).filter(User.id.in_(user_ids)).all()
|
||||
if len(users) != len(set(user_ids)):
|
||||
raise ValueError("存在无效 user_id")
|
||||
user_map = {u.id: u for u in users}
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
created = 0
|
||||
assigned_counts: dict[int, int] = defaultdict(int)
|
||||
for i, tid in enumerate(unassigned):
|
||||
uid = user_ids[i % len(user_ids)]
|
||||
db.add(
|
||||
@@ -194,8 +262,73 @@ def assign_tasks_even(
|
||||
)
|
||||
)
|
||||
created += 1
|
||||
assigned_counts[uid] += 1
|
||||
db.flush()
|
||||
return _assign_result(campaign_id, created)
|
||||
task, batch, notify_targets = _build_notify_payload(
|
||||
dict(assigned_counts), user_map, camp, campaign_id
|
||||
)
|
||||
notifications = _notify_assignees(campaign_id, task, batch, notify_targets)
|
||||
return _assign_result(campaign_id, created, notifications)
|
||||
|
||||
|
||||
def assign_tasks_quantized(
|
||||
campaign_id: str,
|
||||
items: list[dict[str, Any]],
|
||||
*,
|
||||
assigned_by_user_id: int,
|
||||
) -> dict[str, Any]:
|
||||
"""按指定数量分配未分配任务。
|
||||
|
||||
items: [{"user_id": 1, "count": 10}, ...]
|
||||
每个用户从剩余未分配任务中分配最多 count 个。
|
||||
"""
|
||||
if not items:
|
||||
raise ValueError("items 不能为空")
|
||||
now = _utcnow()
|
||||
all_ids = list_campaign_task_ids(campaign_id)
|
||||
with session_scope() as db:
|
||||
existing = {
|
||||
r.task_id
|
||||
for r in db.query(LabelingTaskAssignment)
|
||||
.filter(LabelingTaskAssignment.campaign_id == campaign_id)
|
||||
.all()
|
||||
}
|
||||
unassigned = [tid for tid in all_ids if tid not in existing]
|
||||
user_ids = [int(item["user_id"]) for item in items]
|
||||
users = db.query(User).filter(User.id.in_(user_ids)).all()
|
||||
user_map = {u.id: u for u in users}
|
||||
for uid in user_ids:
|
||||
if uid not in user_map:
|
||||
raise ValueError(f"用户不存在: {uid}")
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
created = 0
|
||||
assigned_counts: dict[int, int] = defaultdict(int)
|
||||
unassigned_iter = iter(unassigned)
|
||||
for item in items:
|
||||
uid = int(item["user_id"])
|
||||
count = int(item.get("count", 0))
|
||||
for _ in range(count):
|
||||
try:
|
||||
tid = next(unassigned_iter)
|
||||
except StopIteration:
|
||||
break # 没有更多未分配任务了
|
||||
db.add(
|
||||
LabelingTaskAssignment(
|
||||
campaign_id=campaign_id,
|
||||
task_id=tid,
|
||||
user_id=uid,
|
||||
assigned_by_user_id=assigned_by_user_id,
|
||||
assigned_at=now,
|
||||
)
|
||||
)
|
||||
created += 1
|
||||
assigned_counts[uid] += 1
|
||||
db.flush()
|
||||
task, batch, notify_targets = _build_notify_payload(
|
||||
dict(assigned_counts), user_map, camp, campaign_id
|
||||
)
|
||||
notifications = _notify_assignees(campaign_id, task, batch, notify_targets)
|
||||
return _assign_result(campaign_id, created, notifications)
|
||||
|
||||
|
||||
def assign_tasks_explicit(
|
||||
@@ -207,6 +340,9 @@ def assign_tasks_explicit(
|
||||
now = _utcnow()
|
||||
all_set = set(list_campaign_task_ids(campaign_id))
|
||||
created = 0
|
||||
assigned_counts: dict[int, int] = defaultdict(int)
|
||||
user_map: dict[int, User] = {}
|
||||
camp: LabelingCampaign | None = None
|
||||
with session_scope() as db:
|
||||
existing = {
|
||||
r.task_id
|
||||
@@ -214,11 +350,13 @@ def assign_tasks_explicit(
|
||||
.filter(LabelingTaskAssignment.campaign_id == campaign_id)
|
||||
.all()
|
||||
}
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
for item in items:
|
||||
uid = int(item["user_id"])
|
||||
user = db.get(User, uid)
|
||||
if not user:
|
||||
raise ValueError(f"用户不存在: {uid}")
|
||||
user_map[uid] = user
|
||||
for tid in item.get("task_ids") or []:
|
||||
if tid not in all_set:
|
||||
raise ValueError(f"无效 task_id: {tid}")
|
||||
@@ -235,8 +373,13 @@ def assign_tasks_explicit(
|
||||
)
|
||||
existing.add(tid)
|
||||
created += 1
|
||||
assigned_counts[uid] += 1
|
||||
db.flush()
|
||||
return _assign_result(campaign_id, created)
|
||||
task, batch, notify_targets = _build_notify_payload(
|
||||
dict(assigned_counts), user_map, camp, campaign_id
|
||||
)
|
||||
notifications = _notify_assignees(campaign_id, task, batch, notify_targets)
|
||||
return _assign_result(campaign_id, created, notifications)
|
||||
|
||||
|
||||
def reassign_task(campaign_id: str, task_id: str, user_id: int) -> dict[str, Any]:
|
||||
@@ -311,3 +454,110 @@ def mark_task_completed(campaign_id: str, task_id: str, user_id: int) -> None:
|
||||
if row and not row.completed_at:
|
||||
row.completed_at = now
|
||||
row.completed_by_user_id = user_id
|
||||
|
||||
|
||||
def list_my_assignments(user_id: int) -> dict[str, Any]:
|
||||
"""当前用户跨 Campaign 的分配汇总(我的标注收件箱)。"""
|
||||
from as_platform.config import FRONTEND_URL
|
||||
|
||||
items: list[dict[str, Any]] = []
|
||||
total_pending = 0
|
||||
base = FRONTEND_URL.rstrip("/")
|
||||
|
||||
with session_scope() as db:
|
||||
rows = (
|
||||
db.query(LabelingTaskAssignment)
|
||||
.filter(LabelingTaskAssignment.user_id == user_id)
|
||||
.all()
|
||||
)
|
||||
by_campaign: dict[str, list[dict[str, Any]]] = defaultdict(list)
|
||||
for r in rows:
|
||||
by_campaign[r.campaign_id].append({
|
||||
"task_id": r.task_id,
|
||||
"completed_at": r.completed_at,
|
||||
})
|
||||
|
||||
for cid, assigns in by_campaign.items():
|
||||
camp = db.get(LabelingCampaign, cid)
|
||||
if not camp:
|
||||
continue
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
completed_ids = count_completed_tasks(batch_dir)
|
||||
all_ids = [_task_id_for_image(img, batch_dir) for img in _iter_batch_images(batch_dir)]
|
||||
assigned = len(assigns)
|
||||
completed = sum(
|
||||
1 for a in assigns
|
||||
if a["completed_at"] or a["task_id"] in completed_ids
|
||||
)
|
||||
pending = max(0, assigned - completed)
|
||||
total_pending += pending
|
||||
items.append({
|
||||
"campaign_id": cid,
|
||||
"batch": camp.batch,
|
||||
"task": camp.task,
|
||||
"project": camp.project,
|
||||
"status": camp.status,
|
||||
"assigned": assigned,
|
||||
"completed": completed,
|
||||
"pending": pending,
|
||||
"campaign_total": len(all_ids),
|
||||
"annotate_url": f"{base}/labeling/annotate/{cid}",
|
||||
})
|
||||
|
||||
items.sort(key=lambda x: (-x["pending"], x.get("batch") or ""))
|
||||
return {"items": items, "total_pending": total_pending}
|
||||
|
||||
|
||||
def campaign_my_tasks(campaign_id: str, user_id: int) -> dict[str, Any]:
|
||||
"""当前用户在指定 Campaign 下的逐张任务清单。"""
|
||||
with session_scope() as db:
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
if not camp:
|
||||
raise FileNotFoundError("campaign not found")
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
images = list(_iter_batch_images(batch_dir))
|
||||
completed_ids = count_completed_tasks(batch_dir)
|
||||
task_id_to_index = {
|
||||
_task_id_for_image(img, batch_dir): i for i, img in enumerate(images)
|
||||
}
|
||||
rows = (
|
||||
db.query(LabelingTaskAssignment)
|
||||
.filter(
|
||||
LabelingTaskAssignment.campaign_id == campaign_id,
|
||||
LabelingTaskAssignment.user_id == user_id,
|
||||
)
|
||||
.all()
|
||||
)
|
||||
assignment_map = {r.task_id: r.completed_at for r in rows}
|
||||
|
||||
items: list[dict[str, Any]] = []
|
||||
for task_id, completed_at in assignment_map.items():
|
||||
idx = task_id_to_index.get(task_id)
|
||||
filename = ""
|
||||
relative_path = ""
|
||||
if idx is not None:
|
||||
img = images[idx]
|
||||
try:
|
||||
relative_path = img.relative_to(batch_dir).as_posix()
|
||||
except ValueError:
|
||||
relative_path = img.name
|
||||
filename = img.name
|
||||
completed = bool(completed_at) or task_id in completed_ids
|
||||
items.append({
|
||||
"task_id": task_id,
|
||||
"filename": filename,
|
||||
"relative_path": relative_path,
|
||||
"completed": completed,
|
||||
"frame_index": idx if idx is not None else -1,
|
||||
})
|
||||
|
||||
items.sort(key=lambda x: (x["frame_index"] if x["frame_index"] >= 0 else 9999, x["filename"]))
|
||||
assigned = len(items)
|
||||
completed_count = sum(1 for i in items if i["completed"])
|
||||
return {
|
||||
"campaign_id": campaign_id,
|
||||
"items": items,
|
||||
"assigned": assigned,
|
||||
"completed": completed_count,
|
||||
"pending": max(0, assigned - completed_count),
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ DOMAIN_LABELS = {"dms": "舱内 DMS", "forward": "前向 ADAS"}
|
||||
|
||||
|
||||
def format_scope_key(project: str, task: str, mode: str | None = None) -> str:
|
||||
if project == "adas":
|
||||
return f"adas:{task}"
|
||||
if project == "lane":
|
||||
return f"lane:{task}"
|
||||
if mode:
|
||||
@@ -41,6 +43,8 @@ def load_labeling_registry() -> dict[str, Any]:
|
||||
|
||||
|
||||
def labeling_profile_key(project: str, task: str, mode: str | None, reg: dict | None = None) -> str:
|
||||
if project == "adas":
|
||||
return task
|
||||
if project == "lane":
|
||||
return f"lane__{task}"
|
||||
get_mode_config, resolve_task_id, train_yaml_key = _dms_registry_api()
|
||||
@@ -71,6 +75,10 @@ def enrich_batch_labels(batch: dict[str, Any], reg: dict | None = None) -> dict[
|
||||
except Exception:
|
||||
out["domain"] = "dms"
|
||||
out["domain_label"] = DOMAIN_LABELS["dms"]
|
||||
elif project == "adas":
|
||||
out["domain"] = "adas"
|
||||
out["domain_label"] = "前向 ADAS"
|
||||
out["task_label"] = task
|
||||
else:
|
||||
out["domain_label"] = "车道线 Lane"
|
||||
out["task_label"] = task
|
||||
|
||||
@@ -5,6 +5,7 @@ import hashlib
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from as_platform.config import WORKSPACE
|
||||
@@ -12,7 +13,7 @@ from as_platform.data.core import get_pending_report, load_wf
|
||||
from as_platform.db.engine import session_scope
|
||||
from as_platform.db.models import LabelingCampaign, LabelingExportJob, User
|
||||
from as_platform.jobs.queue import enqueue_job, get_job
|
||||
from as_platform.labeling.annotate import resolve_editor_xml, sync_campaign_config_xml
|
||||
from as_platform.labeling.annotate import resolve_campaign_batch_dir, _iter_batch_images
|
||||
from as_platform.labeling.batch_stage import (
|
||||
on_labeling_export_job_succeeded,
|
||||
update_campaign_batch_meta_stage,
|
||||
@@ -35,6 +36,8 @@ def _parse_scope_key(scope_key: str) -> tuple[str, str, str | None]:
|
||||
parts = scope_key.split(":")
|
||||
if parts[0] == "lane":
|
||||
return "lane", parts[1] if len(parts) > 1 else "lane_v1", None
|
||||
if parts[0] == "adas":
|
||||
return "adas", parts[1] if len(parts) > 1 else "cuboid_7cls", None
|
||||
if len(parts) >= 3:
|
||||
return "dms", parts[1], parts[2]
|
||||
if len(parts) == 2:
|
||||
@@ -115,6 +118,8 @@ def list_labeling_batches(
|
||||
allowed_stages = ("raw_pool", "out_for_labeling", "returned", "labeling_submitted", "in_review", "review_approved", "review_rejected")
|
||||
|
||||
def _append(b: dict[str, Any]) -> None:
|
||||
if b.get("registry_only"):
|
||||
return
|
||||
if stage and b.get("stage") != stage:
|
||||
return
|
||||
if b.get("stage") not in allowed_stages:
|
||||
@@ -169,10 +174,24 @@ def open_campaign(
|
||||
mode: str | None = None,
|
||||
pack: str | None = None,
|
||||
location: str = "inbox",
|
||||
annotation_types: list[str] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
cid = _campaign_id(project, task, mode, batch, location)
|
||||
config_xml = resolve_editor_xml(project, task, mode)
|
||||
now = datetime.now(timezone.utc)
|
||||
ann_types = annotation_types or _resolve_default_annotation_types(project, task, mode)
|
||||
|
||||
from as_platform.labeling.cvat_client import get_cvat_client
|
||||
from as_platform.labeling.cvat_config import build_cvat_labels
|
||||
|
||||
cvat = get_cvat_client()
|
||||
if not cvat.ping():
|
||||
raise ValueError("CVAT 标注引擎不可用,请执行: docker compose -f docker-compose.yml -f docker-compose.cvat.yml up -d")
|
||||
|
||||
cvat_labels = build_cvat_labels(project, task, mode, ann_types)
|
||||
cvat_task = cvat.create_task(name=cid, labels=cvat_labels)
|
||||
cvat_task_id = cvat_task.id
|
||||
cvat_job_url = cvat_task.job_url
|
||||
|
||||
with session_scope() as db:
|
||||
camp = db.get(LabelingCampaign, cid)
|
||||
if not camp:
|
||||
@@ -185,7 +204,9 @@ def open_campaign(
|
||||
pack=pack,
|
||||
location=location,
|
||||
status="in_progress",
|
||||
config_xml=config_xml,
|
||||
cvat_task_id=cvat_task_id,
|
||||
cvat_job_url=cvat_job_url,
|
||||
annotation_types=ann_types,
|
||||
created_at=now,
|
||||
updated_at=now,
|
||||
)
|
||||
@@ -193,10 +214,25 @@ def open_campaign(
|
||||
else:
|
||||
camp.status = "in_progress"
|
||||
camp.updated_at = now
|
||||
sync_campaign_config_xml(camp)
|
||||
if cvat_task_id and not camp.cvat_task_id:
|
||||
camp.cvat_task_id = cvat_task_id
|
||||
camp.cvat_job_url = cvat_job_url
|
||||
if ann_types and not camp.annotation_types:
|
||||
camp.annotation_types = ann_types
|
||||
db.flush()
|
||||
out = camp.to_dict()
|
||||
out["config_xml"] = camp.config_xml
|
||||
|
||||
# CVAT 图片上传(异步,不阻塞)
|
||||
try:
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
images = _iter_batch_images(batch_dir)
|
||||
if images:
|
||||
import threading
|
||||
cvat_uploader = _cvat_upload_thread(cvat_task_id, images)
|
||||
threading.Thread(target=cvat_uploader, daemon=True).start()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
update_campaign_batch_meta_stage(camp, "out_for_labeling")
|
||||
reg = load_dms_registry() if project == "dms" else None
|
||||
row = enrich_batch_labels(out, reg)
|
||||
@@ -210,7 +246,6 @@ def get_campaign(campaign_id: str) -> dict[str, Any] | None:
|
||||
if not camp:
|
||||
return None
|
||||
row = camp.to_dict()
|
||||
row["config_xml"] = camp.config_xml
|
||||
reg = load_dms_registry() if row.get("project") == "dms" else None
|
||||
return enrich_batch_labels(row, reg)
|
||||
|
||||
@@ -285,21 +320,55 @@ def list_campaign_export_jobs(campaign_id: str, *, limit: int = 30) -> dict[str,
|
||||
|
||||
|
||||
def list_labeling_assignees() -> dict[str, Any]:
|
||||
"""可指派为批次负责人的用户(标注相关角色)。"""
|
||||
"""可指派用户:从飞书通讯录同步组织全员,供分配下拉选择。"""
|
||||
from as_platform.auth.feishu import is_feishu_configured, sync_feishu_users_to_db
|
||||
|
||||
role_codes = ("labeler", "internal_labeler", "vendor_labeler", "engineer", "admin")
|
||||
sync_meta: dict[str, Any] = {"feishu_configured": is_feishu_configured()}
|
||||
if sync_meta["feishu_configured"]:
|
||||
from as_platform.config import FEISHU_APP_ID
|
||||
sync_meta["contact_scope_url"] = (
|
||||
f"https://open.feishu.cn/app/{FEISHU_APP_ID}/auth"
|
||||
"?q=contact:contact:readonly_as_app,contact:department.organize:readonly,contact:contact.base:readonly"
|
||||
"&op_from=openapi&token_type=tenant"
|
||||
)
|
||||
sync_meta["publish_url"] = f"https://open.feishu.cn/app/{FEISHU_APP_ID}/appPublish"
|
||||
with session_scope() as db:
|
||||
if is_feishu_configured():
|
||||
try:
|
||||
sync_result = sync_feishu_users_to_db(db)
|
||||
sync_meta.update(sync_result)
|
||||
except Exception as exc:
|
||||
sync_meta["error"] = str(exc)
|
||||
users = (
|
||||
db.query(User)
|
||||
.filter(User.is_active.is_(True))
|
||||
.filter(User.is_active.is_(True), User.feishu_open_id.isnot(None))
|
||||
.order_by(User.name)
|
||||
.all()
|
||||
)
|
||||
if not users:
|
||||
users = (
|
||||
db.query(User)
|
||||
.filter(User.is_active.is_(True))
|
||||
.order_by(User.name)
|
||||
.all()
|
||||
)
|
||||
users = [
|
||||
u for u in users
|
||||
if {r.code for r in (u.roles or [])}.intersection(role_codes)
|
||||
]
|
||||
sync_meta["fallback"] = "local_roles"
|
||||
items = []
|
||||
for u in users:
|
||||
codes = {r.code for r in (u.roles or [])}
|
||||
if codes.intersection(role_codes):
|
||||
items.append({"id": u.id, "name": u.name or f"user-{u.id}", "roles": sorted(codes)})
|
||||
return {"items": items}
|
||||
items.append({
|
||||
"id": u.id,
|
||||
"name": u.name or f"user-{u.id}",
|
||||
"avatar_url": u.avatar_url,
|
||||
"roles": sorted({r.code for r in (u.roles or [])}),
|
||||
"department_names": u.feishu_department_ids(),
|
||||
"feishu_open_id": u.feishu_open_id,
|
||||
})
|
||||
return {"items": items, "sync": sync_meta}
|
||||
|
||||
|
||||
def _find_batch_for_campaign_id(campaign_id: str) -> dict[str, Any] | None:
|
||||
@@ -399,3 +468,148 @@ def trigger_labeling_export(campaign_id: str) -> dict[str, Any]:
|
||||
)
|
||||
ej = _record_export_job(campaign_id, "labeling_export", job)
|
||||
return {"ok": True, "job": job, "export_job": ej, "export_default": row.get("export_default")}
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════
|
||||
# CVAT 集成辅助
|
||||
# ═══════════════════════════════════════════════════════
|
||||
|
||||
def _resolve_default_annotation_types(project: str, task: str | None, mode: str | None) -> list[str]:
|
||||
"""根据 project 推断默认标注类型。"""
|
||||
from as_platform.labeling.cvat_config import resolve_annotation_types
|
||||
return resolve_annotation_types(project, task, mode)
|
||||
|
||||
|
||||
def _cvat_upload_thread(cvat_task_id: int, image_paths: list):
|
||||
"""在线程中上传图片到 CVAT。"""
|
||||
def _run():
|
||||
try:
|
||||
from as_platform.labeling.cvat_client import get_cvat_client
|
||||
cvat = get_cvat_client()
|
||||
cvat.upload_images(cvat_task_id, image_paths)
|
||||
except Exception:
|
||||
pass
|
||||
return _run
|
||||
|
||||
|
||||
def sync_cvat_annotations(campaign_id: str) -> dict[str, Any]:
|
||||
"""从 CVAT Job 拉取标注,写入 HSAP 数据湖 labels/ls_annotations。"""
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from as_platform.labeling.annotate import _annotations_dir, _iter_batch_images, _task_id_for_image
|
||||
from as_platform.labeling.cvat_client import get_cvat_client
|
||||
from as_platform.labeling.format_converter import (
|
||||
cvat_job_shapes_to_yolo_lines,
|
||||
cvat_shapes_to_export_regions,
|
||||
group_cvat_job_shapes_by_frame,
|
||||
)
|
||||
|
||||
with session_scope() as db:
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
if not camp:
|
||||
raise FileNotFoundError("campaign not found")
|
||||
if not camp.cvat_task_id:
|
||||
raise ValueError("该 campaign 未关联 CVAT Task")
|
||||
|
||||
cvat = get_cvat_client()
|
||||
task = cvat.get_task(camp.cvat_task_id)
|
||||
if not task.job_id:
|
||||
raise ValueError("CVAT Job 尚未就绪,请等待图片上传完成")
|
||||
|
||||
job_id = task.job_id
|
||||
job_ann = cvat.get_job_annotations(job_id)
|
||||
meta = cvat.get_job_data_meta(job_id)
|
||||
label_map = cvat.get_job_label_map(job_id)
|
||||
frames = meta.get("frames") or []
|
||||
shapes_by_frame = group_cvat_job_shapes_by_frame(job_ann)
|
||||
|
||||
batch_dir = resolve_campaign_batch_dir(camp)
|
||||
images = _iter_batch_images(batch_dir)
|
||||
name_to_path = {p.name: p for p in images}
|
||||
ann_dir = _annotations_dir(batch_dir)
|
||||
synced_at = datetime.now(timezone.utc).isoformat()
|
||||
|
||||
from as_platform.labeling.scope import load_dms_registry
|
||||
|
||||
reg = load_dms_registry() if camp.project == "dms" else None
|
||||
class_map = _build_class_map(camp, reg)
|
||||
|
||||
saved_count = 0
|
||||
shape_count = 0
|
||||
for frame_idx, shapes in shapes_by_frame.items():
|
||||
if frame_idx >= len(frames):
|
||||
continue
|
||||
frame_name = frames[frame_idx].get("name") or f"frame_{frame_idx}"
|
||||
img_path = name_to_path.get(Path(frame_name).name)
|
||||
if not img_path:
|
||||
continue
|
||||
|
||||
task_id = _task_id_for_image(img_path, batch_dir)
|
||||
fw = int(frames[frame_idx].get("width") or 1920)
|
||||
fh = int(frames[frame_idx].get("height") or 1080)
|
||||
result_items = cvat_shapes_to_export_regions(shapes, label_map, fw, fh)
|
||||
shape_count += len(result_items)
|
||||
|
||||
payload: dict[str, Any] = {
|
||||
"task_id": task_id,
|
||||
"result": result_items,
|
||||
"source": "cvat",
|
||||
"synced_at": synced_at,
|
||||
"cvat_job_id": job_id,
|
||||
"image": frame_name,
|
||||
}
|
||||
ann_file = ann_dir / f"{task_id}.json"
|
||||
ann_file.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
saved_count += 1
|
||||
|
||||
# DMS / ADAS 2D:额外写 YOLO txt 供训练导出
|
||||
if camp.project in ("dms", "adas") and class_map:
|
||||
yolo_lines = cvat_job_shapes_to_yolo_lines(shapes, label_map, class_map, fw, fh)
|
||||
if yolo_lines:
|
||||
yolo_dir = batch_dir / "labels" / "yolo"
|
||||
yolo_dir.mkdir(parents=True, exist_ok=True)
|
||||
stem = Path(frame_name).stem
|
||||
(yolo_dir / f"{stem}.txt").write_text("\n".join(yolo_lines) + "\n", encoding="utf-8")
|
||||
|
||||
return {
|
||||
"ok": True,
|
||||
"saved": saved_count,
|
||||
"shapes": shape_count,
|
||||
"campaign_id": campaign_id,
|
||||
"cvat_job_id": job_id,
|
||||
}
|
||||
|
||||
|
||||
def _build_class_map(camp, reg: dict | None) -> dict[str, int]:
|
||||
"""从 DMS registry 构建 class_name → class_id 映射。"""
|
||||
if reg:
|
||||
tasks = reg.get("tasks") or {}
|
||||
tcfg = tasks.get(camp.task) or {}
|
||||
names = tcfg.get("names") or []
|
||||
if isinstance(names, list):
|
||||
return {n: i for i, n in enumerate(names)}
|
||||
return {}
|
||||
|
||||
|
||||
def get_cvat_status(campaign_id: str) -> dict[str, Any]:
|
||||
"""查询 CVAT 侧 Task 状态。"""
|
||||
with session_scope() as db:
|
||||
camp = db.get(LabelingCampaign, campaign_id)
|
||||
if not camp:
|
||||
raise FileNotFoundError("campaign not found")
|
||||
if not camp.cvat_task_id:
|
||||
return {"cvat_available": False, "campaign_id": campaign_id}
|
||||
|
||||
from as_platform.labeling.cvat_client import get_cvat_client
|
||||
cvat = get_cvat_client()
|
||||
try:
|
||||
task = cvat.get_task(camp.cvat_task_id)
|
||||
return {
|
||||
"cvat_available": True,
|
||||
"campaign_id": campaign_id,
|
||||
"cvat_task_id": camp.cvat_task_id,
|
||||
"cvat_job_url": task.job_url or camp.cvat_job_url,
|
||||
"cvat_status": task.status,
|
||||
}
|
||||
except Exception as e:
|
||||
return {"cvat_available": False, "campaign_id": campaign_id, "error": str(e)}
|
||||
|
||||
1
platform/web/node_modules/.bin/autoprefixer
generated
vendored
1
platform/web/node_modules/.bin/autoprefixer
generated
vendored
@@ -1 +0,0 @@
|
||||
../autoprefixer/bin/autoprefixer
|
||||
1
platform/web/node_modules/.bin/baseline-browser-mapping
generated
vendored
1
platform/web/node_modules/.bin/baseline-browser-mapping
generated
vendored
@@ -1 +0,0 @@
|
||||
../baseline-browser-mapping/dist/cli.cjs
|
||||
1
platform/web/node_modules/.bin/browserslist
generated
vendored
1
platform/web/node_modules/.bin/browserslist
generated
vendored
@@ -1 +0,0 @@
|
||||
../browserslist/cli.js
|
||||
1
platform/web/node_modules/.bin/cssesc
generated
vendored
1
platform/web/node_modules/.bin/cssesc
generated
vendored
@@ -1 +0,0 @@
|
||||
../cssesc/bin/cssesc
|
||||
1
platform/web/node_modules/.bin/esbuild
generated
vendored
1
platform/web/node_modules/.bin/esbuild
generated
vendored
@@ -1 +0,0 @@
|
||||
../esbuild/bin/esbuild
|
||||
1
platform/web/node_modules/.bin/jiti
generated
vendored
1
platform/web/node_modules/.bin/jiti
generated
vendored
@@ -1 +0,0 @@
|
||||
../jiti/bin/jiti.js
|
||||
1
platform/web/node_modules/.bin/jsesc
generated
vendored
1
platform/web/node_modules/.bin/jsesc
generated
vendored
@@ -1 +0,0 @@
|
||||
../jsesc/bin/jsesc
|
||||
1
platform/web/node_modules/.bin/json5
generated
vendored
1
platform/web/node_modules/.bin/json5
generated
vendored
@@ -1 +0,0 @@
|
||||
../json5/lib/cli.js
|
||||
1
platform/web/node_modules/.bin/loose-envify
generated
vendored
1
platform/web/node_modules/.bin/loose-envify
generated
vendored
@@ -1 +0,0 @@
|
||||
../loose-envify/cli.js
|
||||
1
platform/web/node_modules/.bin/nanoid
generated
vendored
1
platform/web/node_modules/.bin/nanoid
generated
vendored
@@ -1 +0,0 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
platform/web/node_modules/.bin/parser
generated
vendored
1
platform/web/node_modules/.bin/parser
generated
vendored
@@ -1 +0,0 @@
|
||||
../@babel/parser/bin/babel-parser.js
|
||||
1
platform/web/node_modules/.bin/resolve
generated
vendored
1
platform/web/node_modules/.bin/resolve
generated
vendored
@@ -1 +0,0 @@
|
||||
../resolve/bin/resolve
|
||||
1
platform/web/node_modules/.bin/rollup
generated
vendored
1
platform/web/node_modules/.bin/rollup
generated
vendored
@@ -1 +0,0 @@
|
||||
../rollup/dist/bin/rollup
|
||||
1
platform/web/node_modules/.bin/semver
generated
vendored
1
platform/web/node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver.js
|
||||
1
platform/web/node_modules/.bin/sucrase
generated
vendored
1
platform/web/node_modules/.bin/sucrase
generated
vendored
@@ -1 +0,0 @@
|
||||
../sucrase/bin/sucrase
|
||||
1
platform/web/node_modules/.bin/sucrase-node
generated
vendored
1
platform/web/node_modules/.bin/sucrase-node
generated
vendored
@@ -1 +0,0 @@
|
||||
../sucrase/bin/sucrase-node
|
||||
1
platform/web/node_modules/.bin/tailwind
generated
vendored
1
platform/web/node_modules/.bin/tailwind
generated
vendored
@@ -1 +0,0 @@
|
||||
../tailwindcss/lib/cli.js
|
||||
1
platform/web/node_modules/.bin/tailwindcss
generated
vendored
1
platform/web/node_modules/.bin/tailwindcss
generated
vendored
@@ -1 +0,0 @@
|
||||
../tailwindcss/lib/cli.js
|
||||
1
platform/web/node_modules/.bin/tsc
generated
vendored
1
platform/web/node_modules/.bin/tsc
generated
vendored
@@ -1 +0,0 @@
|
||||
../typescript/bin/tsc
|
||||
1
platform/web/node_modules/.bin/tsserver
generated
vendored
1
platform/web/node_modules/.bin/tsserver
generated
vendored
@@ -1 +0,0 @@
|
||||
../typescript/bin/tsserver
|
||||
1
platform/web/node_modules/.bin/update-browserslist-db
generated
vendored
1
platform/web/node_modules/.bin/update-browserslist-db
generated
vendored
@@ -1 +0,0 @@
|
||||
../update-browserslist-db/cli.js
|
||||
1
platform/web/node_modules/.bin/vite
generated
vendored
1
platform/web/node_modules/.bin/vite
generated
vendored
@@ -1 +0,0 @@
|
||||
../vite/bin/vite.js
|
||||
2106
platform/web/node_modules/.package-lock.json
generated
vendored
2106
platform/web/node_modules/.package-lock.json
generated
vendored
File diff suppressed because it is too large
Load Diff
128
platform/web/node_modules/@alloc/quick-lru/index.d.ts
generated
vendored
128
platform/web/node_modules/@alloc/quick-lru/index.d.ts
generated
vendored
@@ -1,128 +0,0 @@
|
||||
declare namespace QuickLRU {
|
||||
interface Options<KeyType, ValueType> {
|
||||
/**
|
||||
The maximum number of milliseconds an item should remain in the cache.
|
||||
|
||||
@default Infinity
|
||||
|
||||
By default, `maxAge` will be `Infinity`, which means that items will never expire.
|
||||
Lazy expiration upon the next write or read call.
|
||||
|
||||
Individual expiration of an item can be specified by the `set(key, value, maxAge)` method.
|
||||
*/
|
||||
readonly maxAge?: number;
|
||||
|
||||
/**
|
||||
The maximum number of items before evicting the least recently used items.
|
||||
*/
|
||||
readonly maxSize: number;
|
||||
|
||||
/**
|
||||
Called right before an item is evicted from the cache.
|
||||
|
||||
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
|
||||
*/
|
||||
onEviction?: (key: KeyType, value: ValueType) => void;
|
||||
}
|
||||
}
|
||||
|
||||
declare class QuickLRU<KeyType, ValueType>
|
||||
implements Iterable<[KeyType, ValueType]> {
|
||||
/**
|
||||
The stored item count.
|
||||
*/
|
||||
readonly size: number;
|
||||
|
||||
/**
|
||||
Simple ["Least Recently Used" (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29).
|
||||
|
||||
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
|
||||
|
||||
@example
|
||||
```
|
||||
import QuickLRU = require('quick-lru');
|
||||
|
||||
const lru = new QuickLRU({maxSize: 1000});
|
||||
|
||||
lru.set('🦄', '🌈');
|
||||
|
||||
lru.has('🦄');
|
||||
//=> true
|
||||
|
||||
lru.get('🦄');
|
||||
//=> '🌈'
|
||||
```
|
||||
*/
|
||||
constructor(options: QuickLRU.Options<KeyType, ValueType>);
|
||||
|
||||
[Symbol.iterator](): IterableIterator<[KeyType, ValueType]>;
|
||||
|
||||
/**
|
||||
Set an item. Returns the instance.
|
||||
|
||||
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified in the constructor, otherwise the item will never expire.
|
||||
|
||||
@returns The list instance.
|
||||
*/
|
||||
set(key: KeyType, value: ValueType, options?: {maxAge?: number}): this;
|
||||
|
||||
/**
|
||||
Get an item.
|
||||
|
||||
@returns The stored item or `undefined`.
|
||||
*/
|
||||
get(key: KeyType): ValueType | undefined;
|
||||
|
||||
/**
|
||||
Check if an item exists.
|
||||
*/
|
||||
has(key: KeyType): boolean;
|
||||
|
||||
/**
|
||||
Get an item without marking it as recently used.
|
||||
|
||||
@returns The stored item or `undefined`.
|
||||
*/
|
||||
peek(key: KeyType): ValueType | undefined;
|
||||
|
||||
/**
|
||||
Delete an item.
|
||||
|
||||
@returns `true` if the item is removed or `false` if the item doesn't exist.
|
||||
*/
|
||||
delete(key: KeyType): boolean;
|
||||
|
||||
/**
|
||||
Delete all items.
|
||||
*/
|
||||
clear(): void;
|
||||
|
||||
/**
|
||||
Update the `maxSize` in-place, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
|
||||
|
||||
Useful for on-the-fly tuning of cache sizes in live systems.
|
||||
*/
|
||||
resize(maxSize: number): void;
|
||||
|
||||
/**
|
||||
Iterable for all the keys.
|
||||
*/
|
||||
keys(): IterableIterator<KeyType>;
|
||||
|
||||
/**
|
||||
Iterable for all the values.
|
||||
*/
|
||||
values(): IterableIterator<ValueType>;
|
||||
|
||||
/**
|
||||
Iterable for all entries, starting with the oldest (ascending in recency).
|
||||
*/
|
||||
entriesAscending(): IterableIterator<[KeyType, ValueType]>;
|
||||
|
||||
/**
|
||||
Iterable for all entries, starting with the newest (descending in recency).
|
||||
*/
|
||||
entriesDescending(): IterableIterator<[KeyType, ValueType]>;
|
||||
}
|
||||
|
||||
export = QuickLRU;
|
||||
263
platform/web/node_modules/@alloc/quick-lru/index.js
generated
vendored
263
platform/web/node_modules/@alloc/quick-lru/index.js
generated
vendored
@@ -1,263 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
class QuickLRU {
|
||||
constructor(options = {}) {
|
||||
if (!(options.maxSize && options.maxSize > 0)) {
|
||||
throw new TypeError('`maxSize` must be a number greater than 0');
|
||||
}
|
||||
|
||||
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
|
||||
throw new TypeError('`maxAge` must be a number greater than 0');
|
||||
}
|
||||
|
||||
this.maxSize = options.maxSize;
|
||||
this.maxAge = options.maxAge || Infinity;
|
||||
this.onEviction = options.onEviction;
|
||||
this.cache = new Map();
|
||||
this.oldCache = new Map();
|
||||
this._size = 0;
|
||||
}
|
||||
|
||||
_emitEvictions(cache) {
|
||||
if (typeof this.onEviction !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const [key, item] of cache) {
|
||||
this.onEviction(key, item.value);
|
||||
}
|
||||
}
|
||||
|
||||
_deleteIfExpired(key, item) {
|
||||
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
|
||||
if (typeof this.onEviction === 'function') {
|
||||
this.onEviction(key, item.value);
|
||||
}
|
||||
|
||||
return this.delete(key);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_getOrDeleteIfExpired(key, item) {
|
||||
const deleted = this._deleteIfExpired(key, item);
|
||||
if (deleted === false) {
|
||||
return item.value;
|
||||
}
|
||||
}
|
||||
|
||||
_getItemValue(key, item) {
|
||||
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
|
||||
}
|
||||
|
||||
_peek(key, cache) {
|
||||
const item = cache.get(key);
|
||||
|
||||
return this._getItemValue(key, item);
|
||||
}
|
||||
|
||||
_set(key, value) {
|
||||
this.cache.set(key, value);
|
||||
this._size++;
|
||||
|
||||
if (this._size >= this.maxSize) {
|
||||
this._size = 0;
|
||||
this._emitEvictions(this.oldCache);
|
||||
this.oldCache = this.cache;
|
||||
this.cache = new Map();
|
||||
}
|
||||
}
|
||||
|
||||
_moveToRecent(key, item) {
|
||||
this.oldCache.delete(key);
|
||||
this._set(key, item);
|
||||
}
|
||||
|
||||
* _entriesAscending() {
|
||||
for (const item of this.oldCache) {
|
||||
const [key, value] = item;
|
||||
if (!this.cache.has(key)) {
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of this.cache) {
|
||||
const [key, value] = item;
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get(key) {
|
||||
if (this.cache.has(key)) {
|
||||
const item = this.cache.get(key);
|
||||
|
||||
return this._getItemValue(key, item);
|
||||
}
|
||||
|
||||
if (this.oldCache.has(key)) {
|
||||
const item = this.oldCache.get(key);
|
||||
if (this._deleteIfExpired(key, item) === false) {
|
||||
this._moveToRecent(key, item);
|
||||
return item.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set(key, value, {maxAge = this.maxAge === Infinity ? undefined : Date.now() + this.maxAge} = {}) {
|
||||
if (this.cache.has(key)) {
|
||||
this.cache.set(key, {
|
||||
value,
|
||||
maxAge
|
||||
});
|
||||
} else {
|
||||
this._set(key, {value, expiry: maxAge});
|
||||
}
|
||||
}
|
||||
|
||||
has(key) {
|
||||
if (this.cache.has(key)) {
|
||||
return !this._deleteIfExpired(key, this.cache.get(key));
|
||||
}
|
||||
|
||||
if (this.oldCache.has(key)) {
|
||||
return !this._deleteIfExpired(key, this.oldCache.get(key));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
peek(key) {
|
||||
if (this.cache.has(key)) {
|
||||
return this._peek(key, this.cache);
|
||||
}
|
||||
|
||||
if (this.oldCache.has(key)) {
|
||||
return this._peek(key, this.oldCache);
|
||||
}
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
const deleted = this.cache.delete(key);
|
||||
if (deleted) {
|
||||
this._size--;
|
||||
}
|
||||
|
||||
return this.oldCache.delete(key) || deleted;
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.cache.clear();
|
||||
this.oldCache.clear();
|
||||
this._size = 0;
|
||||
}
|
||||
|
||||
resize(newSize) {
|
||||
if (!(newSize && newSize > 0)) {
|
||||
throw new TypeError('`maxSize` must be a number greater than 0');
|
||||
}
|
||||
|
||||
const items = [...this._entriesAscending()];
|
||||
const removeCount = items.length - newSize;
|
||||
if (removeCount < 0) {
|
||||
this.cache = new Map(items);
|
||||
this.oldCache = new Map();
|
||||
this._size = items.length;
|
||||
} else {
|
||||
if (removeCount > 0) {
|
||||
this._emitEvictions(items.slice(0, removeCount));
|
||||
}
|
||||
|
||||
this.oldCache = new Map(items.slice(removeCount));
|
||||
this.cache = new Map();
|
||||
this._size = 0;
|
||||
}
|
||||
|
||||
this.maxSize = newSize;
|
||||
}
|
||||
|
||||
* keys() {
|
||||
for (const [key] of this) {
|
||||
yield key;
|
||||
}
|
||||
}
|
||||
|
||||
* values() {
|
||||
for (const [, value] of this) {
|
||||
yield value;
|
||||
}
|
||||
}
|
||||
|
||||
* [Symbol.iterator]() {
|
||||
for (const item of this.cache) {
|
||||
const [key, value] = item;
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield [key, value.value];
|
||||
}
|
||||
}
|
||||
|
||||
for (const item of this.oldCache) {
|
||||
const [key, value] = item;
|
||||
if (!this.cache.has(key)) {
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield [key, value.value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
* entriesDescending() {
|
||||
let items = [...this.cache];
|
||||
for (let i = items.length - 1; i >= 0; --i) {
|
||||
const item = items[i];
|
||||
const [key, value] = item;
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield [key, value.value];
|
||||
}
|
||||
}
|
||||
|
||||
items = [...this.oldCache];
|
||||
for (let i = items.length - 1; i >= 0; --i) {
|
||||
const item = items[i];
|
||||
const [key, value] = item;
|
||||
if (!this.cache.has(key)) {
|
||||
const deleted = this._deleteIfExpired(key, value);
|
||||
if (deleted === false) {
|
||||
yield [key, value.value];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
* entriesAscending() {
|
||||
for (const [key, value] of this._entriesAscending()) {
|
||||
yield [key, value.value];
|
||||
}
|
||||
}
|
||||
|
||||
get size() {
|
||||
if (!this._size) {
|
||||
return this.oldCache.size;
|
||||
}
|
||||
|
||||
let oldCacheSize = 0;
|
||||
for (const key of this.oldCache.keys()) {
|
||||
if (!this.cache.has(key)) {
|
||||
oldCacheSize++;
|
||||
}
|
||||
}
|
||||
|
||||
return Math.min(this._size + oldCacheSize, this.maxSize);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = QuickLRU;
|
||||
9
platform/web/node_modules/@alloc/quick-lru/license
generated
vendored
9
platform/web/node_modules/@alloc/quick-lru/license
generated
vendored
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
43
platform/web/node_modules/@alloc/quick-lru/package.json
generated
vendored
43
platform/web/node_modules/@alloc/quick-lru/package.json
generated
vendored
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "@alloc/quick-lru",
|
||||
"version": "5.2.0",
|
||||
"description": "Simple “Least Recently Used” (LRU) cache",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/quick-lru",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"lru",
|
||||
"quick",
|
||||
"cache",
|
||||
"caching",
|
||||
"least",
|
||||
"recently",
|
||||
"used",
|
||||
"fast",
|
||||
"map",
|
||||
"hash",
|
||||
"buffer"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^2.0.0",
|
||||
"coveralls": "^3.0.3",
|
||||
"nyc": "^15.0.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.26.0"
|
||||
}
|
||||
}
|
||||
139
platform/web/node_modules/@alloc/quick-lru/readme.md
generated
vendored
139
platform/web/node_modules/@alloc/quick-lru/readme.md
generated
vendored
@@ -1,139 +0,0 @@
|
||||
# quick-lru [](https://travis-ci.org/sindresorhus/quick-lru) [](https://coveralls.io/github/sindresorhus/quick-lru?branch=master)
|
||||
|
||||
> Simple [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29)
|
||||
|
||||
Useful when you need to cache something and limit memory usage.
|
||||
|
||||
Inspired by the [`hashlru` algorithm](https://github.com/dominictarr/hashlru#algorithm), but instead uses [`Map`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Map) to support keys of any type, not just strings, and values can be `undefined`.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install quick-lru
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const QuickLRU = require('quick-lru');
|
||||
|
||||
const lru = new QuickLRU({maxSize: 1000});
|
||||
|
||||
lru.set('🦄', '🌈');
|
||||
|
||||
lru.has('🦄');
|
||||
//=> true
|
||||
|
||||
lru.get('🦄');
|
||||
//=> '🌈'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### new QuickLRU(options?)
|
||||
|
||||
Returns a new instance.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
#### maxSize
|
||||
|
||||
*Required*\
|
||||
Type: `number`
|
||||
|
||||
The maximum number of items before evicting the least recently used items.
|
||||
|
||||
#### maxAge
|
||||
|
||||
Type: `number`\
|
||||
Default: `Infinity`
|
||||
|
||||
The maximum number of milliseconds an item should remain in cache.
|
||||
By default maxAge will be Infinity, which means that items will never expire.
|
||||
|
||||
Lazy expiration happens upon the next `write` or `read` call.
|
||||
|
||||
Individual expiration of an item can be specified by the `set(key, value, options)` method.
|
||||
|
||||
#### onEviction
|
||||
|
||||
*Optional*\
|
||||
Type: `(key, value) => void`
|
||||
|
||||
Called right before an item is evicted from the cache.
|
||||
|
||||
Useful for side effects or for items like object URLs that need explicit cleanup (`revokeObjectURL`).
|
||||
|
||||
### Instance
|
||||
|
||||
The instance is [`iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols) so you can use it directly in a [`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of) loop.
|
||||
|
||||
Both `key` and `value` can be of any type.
|
||||
|
||||
#### .set(key, value, options?)
|
||||
|
||||
Set an item. Returns the instance.
|
||||
|
||||
Individual expiration of an item can be specified with the `maxAge` option. If not specified, the global `maxAge` value will be used in case it is specified on the constructor, otherwise the item will never expire.
|
||||
|
||||
#### .get(key)
|
||||
|
||||
Get an item.
|
||||
|
||||
#### .has(key)
|
||||
|
||||
Check if an item exists.
|
||||
|
||||
#### .peek(key)
|
||||
|
||||
Get an item without marking it as recently used.
|
||||
|
||||
#### .delete(key)
|
||||
|
||||
Delete an item.
|
||||
|
||||
Returns `true` if the item is removed or `false` if the item doesn't exist.
|
||||
|
||||
#### .clear()
|
||||
|
||||
Delete all items.
|
||||
|
||||
#### .resize(maxSize)
|
||||
|
||||
Update the `maxSize`, discarding items as necessary. Insertion order is mostly preserved, though this is not a strong guarantee.
|
||||
|
||||
Useful for on-the-fly tuning of cache sizes in live systems.
|
||||
|
||||
#### .keys()
|
||||
|
||||
Iterable for all the keys.
|
||||
|
||||
#### .values()
|
||||
|
||||
Iterable for all the values.
|
||||
|
||||
#### .entriesAscending()
|
||||
|
||||
Iterable for all entries, starting with the oldest (ascending in recency).
|
||||
|
||||
#### .entriesDescending()
|
||||
|
||||
Iterable for all entries, starting with the newest (descending in recency).
|
||||
|
||||
#### .size
|
||||
|
||||
The stored item count.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-quick-lru?utm_source=npm-quick-lru&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
||||
22
platform/web/node_modules/@babel/code-frame/LICENSE
generated
vendored
22
platform/web/node_modules/@babel/code-frame/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
platform/web/node_modules/@babel/code-frame/README.md
generated
vendored
19
platform/web/node_modules/@babel/code-frame/README.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
# @babel/code-frame
|
||||
|
||||
> Generate errors that contain a code frame that point to source locations.
|
||||
|
||||
See our website [@babel/code-frame](https://babeljs.io/docs/babel-code-frame) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/code-frame
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/code-frame --dev
|
||||
```
|
||||
217
platform/web/node_modules/@babel/code-frame/lib/index.js
generated
vendored
217
platform/web/node_modules/@babel/code-frame/lib/index.js
generated
vendored
@@ -1,217 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var picocolors = require('picocolors');
|
||||
var jsTokens = require('js-tokens');
|
||||
var helperValidatorIdentifier = require('@babel/helper-validator-identifier');
|
||||
|
||||
function isColorSupported() {
|
||||
return (typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported
|
||||
);
|
||||
}
|
||||
const compose = (f, g) => v => f(g(v));
|
||||
function buildDefs(colors) {
|
||||
return {
|
||||
keyword: colors.cyan,
|
||||
capitalized: colors.yellow,
|
||||
jsxIdentifier: colors.yellow,
|
||||
punctuator: colors.yellow,
|
||||
number: colors.magenta,
|
||||
string: colors.green,
|
||||
regex: colors.magenta,
|
||||
comment: colors.gray,
|
||||
invalid: compose(compose(colors.white, colors.bgRed), colors.bold),
|
||||
gutter: colors.gray,
|
||||
marker: compose(colors.red, colors.bold),
|
||||
message: compose(colors.red, colors.bold),
|
||||
reset: colors.reset
|
||||
};
|
||||
}
|
||||
const defsOn = buildDefs(picocolors.createColors(true));
|
||||
const defsOff = buildDefs(picocolors.createColors(false));
|
||||
function getDefs(enabled) {
|
||||
return enabled ? defsOn : defsOff;
|
||||
}
|
||||
|
||||
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
let tokenize;
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
const tokenValue = token.value;
|
||||
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
|
||||
if (firstChar !== firstChar.toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
return token.type;
|
||||
};
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
while (match = jsTokens.default.exec(text)) {
|
||||
const token = jsTokens.matchToToken(match);
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
function highlight(text) {
|
||||
if (text === "") return "";
|
||||
const defs = getDefs(true);
|
||||
let highlighted = "";
|
||||
for (const {
|
||||
type,
|
||||
value
|
||||
} of tokenize(text)) {
|
||||
if (type in defs) {
|
||||
highlighted += value.split(NEWLINE$1).map(str => defs[type](str)).join("\n");
|
||||
} else {
|
||||
highlighted += value;
|
||||
}
|
||||
}
|
||||
return highlighted;
|
||||
}
|
||||
|
||||
let deprecationWarningShown = false;
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
function getMarkerLines(loc, source, opts, startLineBaseZero) {
|
||||
const startLoc = Object.assign({
|
||||
column: 0,
|
||||
line: -1
|
||||
}, loc.start);
|
||||
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||
const {
|
||||
linesAbove = 2,
|
||||
linesBelow = 3
|
||||
} = opts || {};
|
||||
const startLine = startLoc.line - startLineBaseZero;
|
||||
const startColumn = startLoc.column;
|
||||
const endLine = endLoc.line - startLineBaseZero;
|
||||
const endColumn = endLoc.column;
|
||||
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||
let end = Math.min(source.length, endLine + linesBelow);
|
||||
if (startLine === -1) {
|
||||
start = 0;
|
||||
}
|
||||
if (endLine === -1) {
|
||||
end = source.length;
|
||||
}
|
||||
const lineDiff = endLine - startLine;
|
||||
const markerLines = {};
|
||||
if (lineDiff) {
|
||||
for (let i = 0; i <= lineDiff; i++) {
|
||||
const lineNumber = i + startLine;
|
||||
if (!startColumn) {
|
||||
markerLines[lineNumber] = true;
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
const sourceLength = source[lineNumber - i].length;
|
||||
markerLines[lineNumber] = [0, sourceLength];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (startColumn === endColumn) {
|
||||
if (startColumn) {
|
||||
markerLines[startLine] = [startColumn, 0];
|
||||
} else {
|
||||
markerLines[startLine] = true;
|
||||
}
|
||||
} else {
|
||||
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||
}
|
||||
}
|
||||
return {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
};
|
||||
}
|
||||
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||
const shouldHighlight = opts.forceColor || isColorSupported() && opts.highlightCode;
|
||||
const startLineBaseZero = (opts.startLine || 1) - 1;
|
||||
const defs = getDefs(shouldHighlight);
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const {
|
||||
start,
|
||||
end,
|
||||
markerLines
|
||||
} = getMarkerLines(loc, lines, opts, startLineBaseZero);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
const numberMaxWidth = String(end + startLineBaseZero).length;
|
||||
const highlightedLines = shouldHighlight ? highlight(rawLines) : rawLines;
|
||||
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
||||
const number = start + 1 + index;
|
||||
const paddedNumber = ` ${number + startLineBaseZero}`.slice(-numberMaxWidth);
|
||||
const gutter = ` ${paddedNumber} |`;
|
||||
const hasMarker = markerLines[number];
|
||||
const lastMarkerLine = !markerLines[number + 1];
|
||||
if (hasMarker) {
|
||||
let markerLine = "";
|
||||
if (Array.isArray(hasMarker)) {
|
||||
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||
const numberOfMarkers = hasMarker[1] || 1;
|
||||
markerLine = ["\n ", defs.gutter(gutter.replace(/\d/g, " ")), " ", markerSpacing, defs.marker("^").repeat(numberOfMarkers)].join("");
|
||||
if (lastMarkerLine && opts.message) {
|
||||
markerLine += " " + defs.message(opts.message);
|
||||
}
|
||||
}
|
||||
return [defs.marker(">"), defs.gutter(gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
||||
} else {
|
||||
return ` ${defs.gutter(gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
||||
}
|
||||
}).join("\n");
|
||||
if (opts.message && !hasColumns) {
|
||||
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||
}
|
||||
if (shouldHighlight) {
|
||||
return defs.reset(frame);
|
||||
} else {
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
function index (rawLines, lineNumber, colNumber, opts = {}) {
|
||||
if (!deprecationWarningShown) {
|
||||
deprecationWarningShown = true;
|
||||
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||
if (process.emitWarning) {
|
||||
process.emitWarning(message, "DeprecationWarning");
|
||||
} else {
|
||||
const deprecationError = new Error(message);
|
||||
deprecationError.name = "DeprecationWarning";
|
||||
console.warn(new Error(message));
|
||||
}
|
||||
}
|
||||
colNumber = Math.max(colNumber, 0);
|
||||
const location = {
|
||||
start: {
|
||||
column: colNumber,
|
||||
line: lineNumber
|
||||
}
|
||||
};
|
||||
return codeFrameColumns(rawLines, location, opts);
|
||||
}
|
||||
|
||||
exports.codeFrameColumns = codeFrameColumns;
|
||||
exports.default = index;
|
||||
exports.highlight = highlight;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
platform/web/node_modules/@babel/code-frame/lib/index.js.map
generated
vendored
1
platform/web/node_modules/@babel/code-frame/lib/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
32
platform/web/node_modules/@babel/code-frame/package.json
generated
vendored
32
platform/web/node_modules/@babel/code-frame/package.json
generated
vendored
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "@babel/code-frame",
|
||||
"version": "7.29.7",
|
||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
|
||||
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-code-frame"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.29.7",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"charcodes": "^0.2.0",
|
||||
"import-meta-resolve": "^4.1.0",
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
||||
22
platform/web/node_modules/@babel/compat-data/LICENSE
generated
vendored
22
platform/web/node_modules/@babel/compat-data/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
platform/web/node_modules/@babel/compat-data/README.md
generated
vendored
19
platform/web/node_modules/@babel/compat-data/README.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
# @babel/compat-data
|
||||
|
||||
> The compat-data to determine required Babel plugins
|
||||
|
||||
See our website [@babel/compat-data](https://babeljs.io/docs/babel-compat-data) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/compat-data
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/compat-data
|
||||
```
|
||||
2
platform/web/node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/corejs2-built-ins.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file as Babel 8 drop support of core-js 2
|
||||
module.exports = require("./data/corejs2-built-ins.json");
|
||||
2
platform/web/node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/corejs3-shipped-proposals.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file now that it is included in babel-plugin-polyfill-corejs3
|
||||
module.exports = require("./data/corejs3-shipped-proposals.json");
|
||||
2120
platform/web/node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
2120
platform/web/node_modules/@babel/compat-data/data/corejs2-built-ins.json
generated
vendored
File diff suppressed because it is too large
Load Diff
5
platform/web/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json
generated
vendored
5
platform/web/node_modules/@babel/compat-data/data/corejs3-shipped-proposals.json
generated
vendored
@@ -1,5 +0,0 @@
|
||||
[
|
||||
"esnext.promise.all-settled",
|
||||
"esnext.string.match-all",
|
||||
"esnext.global-this"
|
||||
]
|
||||
18
platform/web/node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
18
platform/web/node_modules/@babel/compat-data/data/native-modules.json
generated
vendored
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"es6.module": {
|
||||
"chrome": "61",
|
||||
"and_chr": "61",
|
||||
"edge": "16",
|
||||
"firefox": "60",
|
||||
"and_ff": "60",
|
||||
"node": "13.2.0",
|
||||
"opera": "48",
|
||||
"op_mob": "45",
|
||||
"safari": "10.1",
|
||||
"ios": "10.3",
|
||||
"samsung": "8.2",
|
||||
"android": "61",
|
||||
"electron": "2.0",
|
||||
"ios_saf": "10.3"
|
||||
}
|
||||
}
|
||||
38
platform/web/node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
38
platform/web/node_modules/@babel/compat-data/data/overlapping-plugins.json
generated
vendored
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"transform-async-to-generator": [
|
||||
"bugfix/transform-async-arrows-in-class"
|
||||
],
|
||||
"transform-parameters": [
|
||||
"bugfix/transform-edge-default-parameters",
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression"
|
||||
],
|
||||
"transform-function-name": [
|
||||
"bugfix/transform-edge-function-name"
|
||||
],
|
||||
"transform-block-scoping": [
|
||||
"bugfix/transform-safari-block-shadowing",
|
||||
"bugfix/transform-safari-for-shadowing"
|
||||
],
|
||||
"transform-destructuring": [
|
||||
"bugfix/transform-safari-rest-destructuring-rhs-array"
|
||||
],
|
||||
"transform-template-literals": [
|
||||
"bugfix/transform-tagged-template-caching"
|
||||
],
|
||||
"transform-optional-chaining": [
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining"
|
||||
],
|
||||
"proposal-optional-chaining": [
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining"
|
||||
],
|
||||
"transform-class-properties": [
|
||||
"bugfix/transform-v8-static-class-fields-redefine-readonly",
|
||||
"bugfix/transform-firefox-class-in-computed-class-key",
|
||||
"bugfix/transform-safari-class-field-initializer-scope"
|
||||
],
|
||||
"proposal-class-properties": [
|
||||
"bugfix/transform-v8-static-class-fields-redefine-readonly",
|
||||
"bugfix/transform-firefox-class-in-computed-class-key",
|
||||
"bugfix/transform-safari-class-field-initializer-scope"
|
||||
]
|
||||
}
|
||||
231
platform/web/node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
231
platform/web/node_modules/@babel/compat-data/data/plugin-bugfixes.json
generated
vendored
@@ -1,231 +0,0 @@
|
||||
{
|
||||
"bugfix/transform-async-arrows-in-class": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "11",
|
||||
"node": "7.6",
|
||||
"deno": "1",
|
||||
"ios": "11",
|
||||
"samsung": "6",
|
||||
"opera_mobile": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"bugfix/transform-edge-default-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-edge-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "79",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"bugfix/transform-safari-block-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "44",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-for-shadowing": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "12",
|
||||
"firefox": "4",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ie": "11",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-id-destructuring-collision-in-function-expression": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "2",
|
||||
"safari": "16.3",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "16.3",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-safari-rest-destructuring-rhs-array": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "14",
|
||||
"firefox": "34",
|
||||
"safari": "14.1",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"bugfix/transform-tagged-template-caching": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "13",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"bugfix/transform-v8-spread-parameters-in-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "13.4",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"transform-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"deno": "1",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"opera_mobile": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-destructuring": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
}
|
||||
}
|
||||
843
platform/web/node_modules/@babel/compat-data/data/plugins.json
generated
vendored
843
platform/web/node_modules/@babel/compat-data/data/plugins.json
generated
vendored
@@ -1,843 +0,0 @@
|
||||
{
|
||||
"transform-explicit-resource-management": {
|
||||
"chrome": "141",
|
||||
"edge": "141",
|
||||
"firefox": "141",
|
||||
"node": "25",
|
||||
"electron": "39.0"
|
||||
},
|
||||
"transform-duplicate-named-capturing-groups-regex": {
|
||||
"chrome": "126",
|
||||
"opera": "112",
|
||||
"edge": "126",
|
||||
"firefox": "129",
|
||||
"safari": "17.4",
|
||||
"node": "23",
|
||||
"ios": "17.4",
|
||||
"rhino": "1.9",
|
||||
"electron": "31.0"
|
||||
},
|
||||
"transform-regexp-modifiers": {
|
||||
"chrome": "125",
|
||||
"opera": "111",
|
||||
"edge": "125",
|
||||
"firefox": "132",
|
||||
"node": "23",
|
||||
"samsung": "27",
|
||||
"electron": "31.0"
|
||||
},
|
||||
"transform-unicode-sets-regex": {
|
||||
"chrome": "112",
|
||||
"opera": "98",
|
||||
"edge": "112",
|
||||
"firefox": "116",
|
||||
"safari": "17",
|
||||
"node": "20",
|
||||
"deno": "1.32",
|
||||
"ios": "17",
|
||||
"samsung": "23",
|
||||
"opera_mobile": "75",
|
||||
"electron": "24.0"
|
||||
},
|
||||
"bugfix/transform-v8-static-class-fields-redefine-readonly": {
|
||||
"chrome": "98",
|
||||
"opera": "84",
|
||||
"edge": "98",
|
||||
"firefox": "75",
|
||||
"safari": "15",
|
||||
"node": "12",
|
||||
"deno": "1.18",
|
||||
"ios": "15",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "52",
|
||||
"electron": "17.0"
|
||||
},
|
||||
"bugfix/transform-firefox-class-in-computed-class-key": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "126",
|
||||
"safari": "16",
|
||||
"node": "12",
|
||||
"deno": "1",
|
||||
"ios": "16",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "53",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"bugfix/transform-safari-class-field-initializer-scope": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "69",
|
||||
"safari": "16",
|
||||
"node": "12",
|
||||
"deno": "1",
|
||||
"ios": "16",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "53",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"transform-class-static-block": {
|
||||
"chrome": "94",
|
||||
"opera": "80",
|
||||
"edge": "94",
|
||||
"firefox": "93",
|
||||
"safari": "16.4",
|
||||
"node": "16.11",
|
||||
"deno": "1.14",
|
||||
"ios": "16.4",
|
||||
"samsung": "17",
|
||||
"opera_mobile": "66",
|
||||
"electron": "15.0"
|
||||
},
|
||||
"proposal-class-static-block": {
|
||||
"chrome": "94",
|
||||
"opera": "80",
|
||||
"edge": "94",
|
||||
"firefox": "93",
|
||||
"safari": "16.4",
|
||||
"node": "16.11",
|
||||
"deno": "1.14",
|
||||
"ios": "16.4",
|
||||
"samsung": "17",
|
||||
"opera_mobile": "66",
|
||||
"electron": "15.0"
|
||||
},
|
||||
"transform-private-property-in-object": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "15",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-private-property-in-object": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "15",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"transform-class-properties": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "90",
|
||||
"safari": "14.1",
|
||||
"node": "12",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "53",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-class-properties": {
|
||||
"chrome": "74",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "90",
|
||||
"safari": "14.1",
|
||||
"node": "12",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"samsung": "11",
|
||||
"opera_mobile": "53",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"transform-private-methods": {
|
||||
"chrome": "84",
|
||||
"opera": "70",
|
||||
"edge": "84",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "14.6",
|
||||
"deno": "1",
|
||||
"ios": "15",
|
||||
"samsung": "14",
|
||||
"opera_mobile": "60",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-private-methods": {
|
||||
"chrome": "84",
|
||||
"opera": "70",
|
||||
"edge": "84",
|
||||
"firefox": "90",
|
||||
"safari": "15",
|
||||
"node": "14.6",
|
||||
"deno": "1",
|
||||
"ios": "15",
|
||||
"samsung": "14",
|
||||
"opera_mobile": "60",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"transform-numeric-separator": {
|
||||
"chrome": "75",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "70",
|
||||
"safari": "13",
|
||||
"node": "12.5",
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "11",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "54",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"proposal-numeric-separator": {
|
||||
"chrome": "75",
|
||||
"opera": "62",
|
||||
"edge": "79",
|
||||
"firefox": "70",
|
||||
"safari": "13",
|
||||
"node": "12.5",
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "11",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "54",
|
||||
"electron": "6.0"
|
||||
},
|
||||
"transform-logical-assignment-operators": {
|
||||
"chrome": "85",
|
||||
"opera": "71",
|
||||
"edge": "85",
|
||||
"firefox": "79",
|
||||
"safari": "14",
|
||||
"node": "15",
|
||||
"deno": "1.2",
|
||||
"ios": "14",
|
||||
"samsung": "14",
|
||||
"opera_mobile": "60",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"proposal-logical-assignment-operators": {
|
||||
"chrome": "85",
|
||||
"opera": "71",
|
||||
"edge": "85",
|
||||
"firefox": "79",
|
||||
"safari": "14",
|
||||
"node": "15",
|
||||
"deno": "1.2",
|
||||
"ios": "14",
|
||||
"samsung": "14",
|
||||
"opera_mobile": "60",
|
||||
"electron": "10.0"
|
||||
},
|
||||
"transform-nullish-coalescing-operator": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "72",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"proposal-nullish-coalescing-operator": {
|
||||
"chrome": "80",
|
||||
"opera": "67",
|
||||
"edge": "80",
|
||||
"firefox": "72",
|
||||
"safari": "13.1",
|
||||
"node": "14",
|
||||
"deno": "1",
|
||||
"ios": "13.4",
|
||||
"samsung": "13",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "57",
|
||||
"electron": "8.0"
|
||||
},
|
||||
"transform-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "13.4",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"proposal-optional-chaining": {
|
||||
"chrome": "91",
|
||||
"opera": "77",
|
||||
"edge": "91",
|
||||
"firefox": "74",
|
||||
"safari": "13.1",
|
||||
"node": "16.9",
|
||||
"deno": "1.9",
|
||||
"ios": "13.4",
|
||||
"samsung": "16",
|
||||
"opera_mobile": "64",
|
||||
"electron": "13.0"
|
||||
},
|
||||
"transform-json-strings": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "62",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "12",
|
||||
"samsung": "9",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-json-strings": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "62",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "12",
|
||||
"samsung": "9",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-optional-catch-binding": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "58",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-optional-catch-binding": {
|
||||
"chrome": "66",
|
||||
"opera": "53",
|
||||
"edge": "79",
|
||||
"firefox": "58",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-parameters": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "18",
|
||||
"firefox": "52",
|
||||
"safari": "16.3",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "16.3",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-async-generator-functions": {
|
||||
"chrome": "63",
|
||||
"opera": "50",
|
||||
"edge": "79",
|
||||
"firefox": "57",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "12",
|
||||
"samsung": "8",
|
||||
"opera_mobile": "46",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-async-generator-functions": {
|
||||
"chrome": "63",
|
||||
"opera": "50",
|
||||
"edge": "79",
|
||||
"firefox": "57",
|
||||
"safari": "12",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "12",
|
||||
"samsung": "8",
|
||||
"opera_mobile": "46",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
"opera": "47",
|
||||
"edge": "79",
|
||||
"firefox": "55",
|
||||
"safari": "11.1",
|
||||
"node": "8.3",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"opera_mobile": "44",
|
||||
"electron": "2.0"
|
||||
},
|
||||
"proposal-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
"opera": "47",
|
||||
"edge": "79",
|
||||
"firefox": "55",
|
||||
"safari": "11.1",
|
||||
"node": "8.3",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"opera_mobile": "44",
|
||||
"electron": "2.0"
|
||||
},
|
||||
"transform-dotall-regex": {
|
||||
"chrome": "62",
|
||||
"opera": "49",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "8.10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "8",
|
||||
"rhino": "1.7.15",
|
||||
"opera_mobile": "46",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-unicode-property-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"proposal-unicode-property-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-named-capturing-groups-regex": {
|
||||
"chrome": "64",
|
||||
"opera": "51",
|
||||
"edge": "79",
|
||||
"firefox": "78",
|
||||
"safari": "11.1",
|
||||
"node": "10",
|
||||
"deno": "1",
|
||||
"ios": "11.3",
|
||||
"samsung": "9",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "47",
|
||||
"electron": "3.0"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"opera": "42",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "11",
|
||||
"node": "7.6",
|
||||
"deno": "1",
|
||||
"ios": "11",
|
||||
"samsung": "6",
|
||||
"opera_mobile": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"transform-exponentiation-operator": {
|
||||
"chrome": "52",
|
||||
"opera": "39",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"deno": "1",
|
||||
"ios": "10.3",
|
||||
"samsung": "6",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.3"
|
||||
},
|
||||
"transform-template-literals": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "13",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "13",
|
||||
"samsung": "3.4",
|
||||
"rhino": "1.9",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-literals": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"rhino": "1.7.15",
|
||||
"opera_mobile": "32",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-function-name": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "79",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-arrow-functions": {
|
||||
"chrome": "47",
|
||||
"opera": "34",
|
||||
"edge": "13",
|
||||
"firefox": "43",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "34",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-block-scoped-functions": {
|
||||
"chrome": "41",
|
||||
"opera": "28",
|
||||
"edge": "12",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ie": "11",
|
||||
"ios": "10",
|
||||
"samsung": "3.4",
|
||||
"opera_mobile": "28",
|
||||
"electron": "0.21"
|
||||
},
|
||||
"transform-classes": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-object-super": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-shorthand-properties": {
|
||||
"chrome": "43",
|
||||
"opera": "30",
|
||||
"edge": "12",
|
||||
"firefox": "33",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"rhino": "1.7.14",
|
||||
"opera_mobile": "30",
|
||||
"electron": "0.27"
|
||||
},
|
||||
"transform-duplicate-keys": {
|
||||
"chrome": "42",
|
||||
"opera": "29",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "3.4",
|
||||
"opera_mobile": "29",
|
||||
"electron": "0.25"
|
||||
},
|
||||
"transform-computed-properties": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "8",
|
||||
"samsung": "4",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "32",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-for-of": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-sticky-regex": {
|
||||
"chrome": "49",
|
||||
"opera": "36",
|
||||
"edge": "13",
|
||||
"firefox": "3",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"rhino": "1.7.15",
|
||||
"opera_mobile": "36",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-unicode-escapes": {
|
||||
"chrome": "44",
|
||||
"opera": "31",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "4",
|
||||
"rhino": "1.7.15",
|
||||
"opera_mobile": "32",
|
||||
"electron": "0.30"
|
||||
},
|
||||
"transform-unicode-regex": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "13",
|
||||
"firefox": "46",
|
||||
"safari": "12",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "12",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-spread": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-destructuring": {
|
||||
"chrome": "51",
|
||||
"opera": "38",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "14.1",
|
||||
"node": "6.5",
|
||||
"deno": "1",
|
||||
"ios": "14.5",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "41",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-block-scoping": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "11",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "11",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-typeof-symbol": {
|
||||
"chrome": "48",
|
||||
"opera": "35",
|
||||
"edge": "12",
|
||||
"firefox": "36",
|
||||
"safari": "9",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "9",
|
||||
"samsung": "5",
|
||||
"rhino": "1.8",
|
||||
"opera_mobile": "35",
|
||||
"electron": "0.37"
|
||||
},
|
||||
"transform-new-target": {
|
||||
"chrome": "46",
|
||||
"opera": "33",
|
||||
"edge": "14",
|
||||
"firefox": "41",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-regenerator": {
|
||||
"chrome": "50",
|
||||
"opera": "37",
|
||||
"edge": "13",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"deno": "1",
|
||||
"ios": "10",
|
||||
"samsung": "5",
|
||||
"opera_mobile": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-member-expression-literals": {
|
||||
"chrome": "7",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.4",
|
||||
"deno": "1",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "12",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-property-literals": {
|
||||
"chrome": "7",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "5.1",
|
||||
"node": "0.4",
|
||||
"deno": "1",
|
||||
"ie": "9",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "12",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-reserved-words": {
|
||||
"chrome": "13",
|
||||
"opera": "10.50",
|
||||
"edge": "12",
|
||||
"firefox": "2",
|
||||
"safari": "3.1",
|
||||
"node": "0.6",
|
||||
"deno": "1",
|
||||
"ie": "9",
|
||||
"android": "4.4",
|
||||
"ios": "6",
|
||||
"phantom": "1.9",
|
||||
"samsung": "1",
|
||||
"rhino": "1.7.13",
|
||||
"opera_mobile": "10.1",
|
||||
"electron": "0.20"
|
||||
},
|
||||
"transform-export-namespace-from": {
|
||||
"chrome": "72",
|
||||
"deno": "1.0",
|
||||
"edge": "79",
|
||||
"firefox": "80",
|
||||
"node": "13.2.0",
|
||||
"opera": "60",
|
||||
"opera_mobile": "51",
|
||||
"safari": "14.1",
|
||||
"ios": "14.5",
|
||||
"samsung": "11.0",
|
||||
"android": "72",
|
||||
"electron": "5.0"
|
||||
},
|
||||
"proposal-export-namespace-from": {
|
||||
"chrome": "72",
|
||||
"deno": "1.0",
|
||||
"edge": "79",
|
||||
"firefox": "80",
|
||||
"node": "13.2.0",
|
||||
"opera": "60",
|
||||
"opera_mobile": "51",
|
||||
"safari": "14.1",
|
||||
"ios": "14.5",
|
||||
"samsung": "11.0",
|
||||
"android": "72",
|
||||
"electron": "5.0"
|
||||
}
|
||||
}
|
||||
2
platform/web/node_modules/@babel/compat-data/native-modules.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/native-modules.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file, in Babel 8 users import the .json directly
|
||||
module.exports = require("./data/native-modules.json");
|
||||
2
platform/web/node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/overlapping-plugins.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file, in Babel 8 users import the .json directly
|
||||
module.exports = require("./data/overlapping-plugins.json");
|
||||
40
platform/web/node_modules/@babel/compat-data/package.json
generated
vendored
40
platform/web/node_modules/@babel/compat-data/package.json
generated
vendored
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "@babel/compat-data",
|
||||
"version": "7.29.7",
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"license": "MIT",
|
||||
"description": "The compat-data to determine required Babel plugins",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-compat-data"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"exports": {
|
||||
"./plugins": "./plugins.js",
|
||||
"./native-modules": "./native-modules.js",
|
||||
"./corejs2-built-ins": "./corejs2-built-ins.js",
|
||||
"./corejs3-shipped-proposals": "./corejs3-shipped-proposals.js",
|
||||
"./overlapping-plugins": "./overlapping-plugins.js",
|
||||
"./plugin-bugfixes": "./plugin-bugfixes.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build-data": "./scripts/download-compat-table.sh && node ./scripts/build-data.mjs && node ./scripts/build-modules-support.mjs && node ./scripts/build-bugfixes-targets.mjs"
|
||||
},
|
||||
"keywords": [
|
||||
"babel",
|
||||
"compat-table",
|
||||
"compat-data"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@mdn/browser-compat-data": "^6.0.8",
|
||||
"core-js-compat": "^3.48.0",
|
||||
"electron-to-chromium": "^1.5.278"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"type": "commonjs"
|
||||
}
|
||||
2
platform/web/node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/plugin-bugfixes.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file, in Babel 8 users import the .json directly
|
||||
module.exports = require("./data/plugin-bugfixes.json");
|
||||
2
platform/web/node_modules/@babel/compat-data/plugins.js
generated
vendored
2
platform/web/node_modules/@babel/compat-data/plugins.js
generated
vendored
@@ -1,2 +0,0 @@
|
||||
// Todo (Babel 8): remove this file, in Babel 8 users import the .json directly
|
||||
module.exports = require("./data/plugins.json");
|
||||
22
platform/web/node_modules/@babel/core/LICENSE
generated
vendored
22
platform/web/node_modules/@babel/core/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
platform/web/node_modules/@babel/core/README.md
generated
vendored
19
platform/web/node_modules/@babel/core/README.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
# @babel/core
|
||||
|
||||
> Babel compiler core.
|
||||
|
||||
See our website [@babel/core](https://babeljs.io/docs/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/core
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/core --dev
|
||||
```
|
||||
5
platform/web/node_modules/@babel/core/lib/config/cache-contexts.js
generated
vendored
5
platform/web/node_modules/@babel/core/lib/config/cache-contexts.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=cache-contexts.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/cache-contexts.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/cache-contexts.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":[],"sources":["../../src/config/cache-contexts.ts"],"sourcesContent":["import type { ConfigContext } from \"./config-chain.ts\";\nimport type {\n CallerMetadata,\n TargetsListOrObject,\n} from \"./validation/options.ts\";\n\nexport type { ConfigContext as FullConfig };\n\nexport type FullPreset = {\n targets: TargetsListOrObject;\n} & ConfigContext;\nexport type FullPlugin = {\n assumptions: Record<string, boolean>;\n} & FullPreset;\n\n// Context not including filename since it is used in places that cannot\n// process 'ignore'/'only' and other filename-based logic.\nexport type SimpleConfig = {\n envName: string;\n caller: CallerMetadata | undefined;\n};\nexport type SimplePreset = {\n targets: TargetsListOrObject;\n} & SimpleConfig;\nexport type SimplePlugin = {\n assumptions: Record<string, boolean>;\n} & SimplePreset;\n"],"mappings":"","ignoreList":[]}
|
||||
261
platform/web/node_modules/@babel/core/lib/config/caching.js
generated
vendored
261
platform/web/node_modules/@babel/core/lib/config/caching.js
generated
vendored
@@ -1,261 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.assertSimpleType = assertSimpleType;
|
||||
exports.makeStrongCache = makeStrongCache;
|
||||
exports.makeStrongCacheSync = makeStrongCacheSync;
|
||||
exports.makeWeakCache = makeWeakCache;
|
||||
exports.makeWeakCacheSync = makeWeakCacheSync;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _async = require("../gensync-utils/async.js");
|
||||
var _util = require("./util.js");
|
||||
const synchronize = gen => {
|
||||
return _gensync()(gen).sync;
|
||||
};
|
||||
function* genTrue() {
|
||||
return true;
|
||||
}
|
||||
function makeWeakCache(handler) {
|
||||
return makeCachedFunction(WeakMap, handler);
|
||||
}
|
||||
function makeWeakCacheSync(handler) {
|
||||
return synchronize(makeWeakCache(handler));
|
||||
}
|
||||
function makeStrongCache(handler) {
|
||||
return makeCachedFunction(Map, handler);
|
||||
}
|
||||
function makeStrongCacheSync(handler) {
|
||||
return synchronize(makeStrongCache(handler));
|
||||
}
|
||||
function makeCachedFunction(CallCache, handler) {
|
||||
const callCacheSync = new CallCache();
|
||||
const callCacheAsync = new CallCache();
|
||||
const futureCache = new CallCache();
|
||||
return function* cachedFunction(arg, data) {
|
||||
const asyncContext = yield* (0, _async.isAsync)();
|
||||
const callCache = asyncContext ? callCacheAsync : callCacheSync;
|
||||
const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data);
|
||||
if (cached.valid) return cached.value;
|
||||
const cache = new CacheConfigurator(data);
|
||||
const handlerResult = handler(arg, cache);
|
||||
let finishLock;
|
||||
let value;
|
||||
if ((0, _util.isIterableIterator)(handlerResult)) {
|
||||
value = yield* (0, _async.onFirstPause)(handlerResult, () => {
|
||||
finishLock = setupAsyncLocks(cache, futureCache, arg);
|
||||
});
|
||||
} else {
|
||||
value = handlerResult;
|
||||
}
|
||||
updateFunctionCache(callCache, cache, arg, value);
|
||||
if (finishLock) {
|
||||
futureCache.delete(arg);
|
||||
finishLock.release(value);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
}
|
||||
function* getCachedValue(cache, arg, data) {
|
||||
const cachedValue = cache.get(arg);
|
||||
if (cachedValue) {
|
||||
for (const {
|
||||
value,
|
||||
valid
|
||||
} of cachedValue) {
|
||||
if (yield* valid(data)) return {
|
||||
valid: true,
|
||||
value
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) {
|
||||
const cached = yield* getCachedValue(callCache, arg, data);
|
||||
if (cached.valid) {
|
||||
return cached;
|
||||
}
|
||||
if (asyncContext) {
|
||||
const cached = yield* getCachedValue(futureCache, arg, data);
|
||||
if (cached.valid) {
|
||||
const value = yield* (0, _async.waitFor)(cached.value.promise);
|
||||
return {
|
||||
valid: true,
|
||||
value
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
valid: false,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
function setupAsyncLocks(config, futureCache, arg) {
|
||||
const finishLock = new Lock();
|
||||
updateFunctionCache(futureCache, config, arg, finishLock);
|
||||
return finishLock;
|
||||
}
|
||||
function updateFunctionCache(cache, config, arg, value) {
|
||||
if (!config.configured()) config.forever();
|
||||
let cachedValue = cache.get(arg);
|
||||
config.deactivate();
|
||||
switch (config.mode()) {
|
||||
case "forever":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: genTrue
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
break;
|
||||
case "invalidate":
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: config.validator()
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
break;
|
||||
case "valid":
|
||||
if (cachedValue) {
|
||||
cachedValue.push({
|
||||
value,
|
||||
valid: config.validator()
|
||||
});
|
||||
} else {
|
||||
cachedValue = [{
|
||||
value,
|
||||
valid: config.validator()
|
||||
}];
|
||||
cache.set(arg, cachedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
class CacheConfigurator {
|
||||
constructor(data) {
|
||||
this._active = true;
|
||||
this._never = false;
|
||||
this._forever = false;
|
||||
this._invalidate = false;
|
||||
this._configured = false;
|
||||
this._pairs = [];
|
||||
this._data = void 0;
|
||||
this._data = data;
|
||||
}
|
||||
simple() {
|
||||
return makeSimpleConfigurator(this);
|
||||
}
|
||||
mode() {
|
||||
if (this._never) return "never";
|
||||
if (this._forever) return "forever";
|
||||
if (this._invalidate) return "invalidate";
|
||||
return "valid";
|
||||
}
|
||||
forever() {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
if (this._never) {
|
||||
throw new Error("Caching has already been configured with .never()");
|
||||
}
|
||||
this._forever = true;
|
||||
this._configured = true;
|
||||
}
|
||||
never() {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
if (this._forever) {
|
||||
throw new Error("Caching has already been configured with .forever()");
|
||||
}
|
||||
this._never = true;
|
||||
this._configured = true;
|
||||
}
|
||||
using(handler) {
|
||||
if (!this._active) {
|
||||
throw new Error("Cannot change caching after evaluation has completed.");
|
||||
}
|
||||
if (this._never || this._forever) {
|
||||
throw new Error("Caching has already been configured with .never or .forever()");
|
||||
}
|
||||
this._configured = true;
|
||||
const key = handler(this._data);
|
||||
const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`);
|
||||
if ((0, _async.isThenable)(key)) {
|
||||
return key.then(key => {
|
||||
this._pairs.push([key, fn]);
|
||||
return key;
|
||||
});
|
||||
}
|
||||
this._pairs.push([key, fn]);
|
||||
return key;
|
||||
}
|
||||
invalidate(handler) {
|
||||
this._invalidate = true;
|
||||
return this.using(handler);
|
||||
}
|
||||
validator() {
|
||||
const pairs = this._pairs;
|
||||
return function* (data) {
|
||||
for (const [key, fn] of pairs) {
|
||||
if (key !== (yield* fn(data))) return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
deactivate() {
|
||||
this._active = false;
|
||||
}
|
||||
configured() {
|
||||
return this._configured;
|
||||
}
|
||||
}
|
||||
function makeSimpleConfigurator(cache) {
|
||||
function cacheFn(val) {
|
||||
if (typeof val === "boolean") {
|
||||
if (val) cache.forever();else cache.never();
|
||||
return;
|
||||
}
|
||||
return cache.using(() => assertSimpleType(val()));
|
||||
}
|
||||
cacheFn.forever = () => cache.forever();
|
||||
cacheFn.never = () => cache.never();
|
||||
cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
|
||||
cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
|
||||
return cacheFn;
|
||||
}
|
||||
function assertSimpleType(value) {
|
||||
if ((0, _async.isThenable)(value)) {
|
||||
throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`);
|
||||
}
|
||||
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
|
||||
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
class Lock {
|
||||
constructor() {
|
||||
this.released = false;
|
||||
this.promise = void 0;
|
||||
this._resolve = void 0;
|
||||
this.promise = new Promise(resolve => {
|
||||
this._resolve = resolve;
|
||||
});
|
||||
}
|
||||
release(value) {
|
||||
this.released = true;
|
||||
this._resolve(value);
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=caching.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/caching.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/caching.js.map
generated
vendored
File diff suppressed because one or more lines are too long
469
platform/web/node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
469
platform/web/node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
@@ -1,469 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.buildPresetChain = buildPresetChain;
|
||||
exports.buildPresetChainWalker = void 0;
|
||||
exports.buildRootChain = buildRootChain;
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _debug() {
|
||||
const data = require("debug");
|
||||
_debug = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _options = require("./validation/options.js");
|
||||
var _patternToRegex = require("./pattern-to-regex.js");
|
||||
var _printer = require("./printer.js");
|
||||
var _rewriteStackTrace = require("../errors/rewrite-stack-trace.js");
|
||||
var _configError = require("../errors/config-error.js");
|
||||
var _index = require("./files/index.js");
|
||||
var _caching = require("./caching.js");
|
||||
var _configDescriptors = require("./config-descriptors.js");
|
||||
const debug = _debug()("babel:config:config-chain");
|
||||
function* buildPresetChain(arg, context) {
|
||||
const chain = yield* buildPresetChainWalker(arg, context);
|
||||
if (!chain) return null;
|
||||
return {
|
||||
plugins: dedupDescriptors(chain.plugins),
|
||||
presets: dedupDescriptors(chain.presets),
|
||||
options: chain.options.map(o => createConfigChainOptions(o)),
|
||||
files: new Set()
|
||||
};
|
||||
}
|
||||
const buildPresetChainWalker = exports.buildPresetChainWalker = makeChainWalker({
|
||||
root: preset => loadPresetDescriptors(preset),
|
||||
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
|
||||
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
|
||||
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
|
||||
createLogger: () => () => {}
|
||||
});
|
||||
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||
const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
function* buildRootChain(opts, context) {
|
||||
let configReport, babelRcReport;
|
||||
const programmaticLogger = new _printer.ConfigPrinter();
|
||||
const programmaticChain = yield* loadProgrammaticChain({
|
||||
options: opts,
|
||||
dirname: context.cwd
|
||||
}, context, undefined, programmaticLogger);
|
||||
if (!programmaticChain) return null;
|
||||
const programmaticReport = yield* programmaticLogger.output();
|
||||
let configFile;
|
||||
if (typeof opts.configFile === "string") {
|
||||
configFile = yield* (0, _index.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
|
||||
} else if (opts.configFile !== false) {
|
||||
configFile = yield* (0, _index.findRootConfig)(context.root, context.envName, context.caller);
|
||||
}
|
||||
let {
|
||||
babelrc,
|
||||
babelrcRoots
|
||||
} = opts;
|
||||
let babelrcRootsDirectory = context.cwd;
|
||||
const configFileChain = emptyChain();
|
||||
const configFileLogger = new _printer.ConfigPrinter();
|
||||
if (configFile) {
|
||||
const validatedFile = validateConfigFile(configFile);
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
|
||||
if (!result) return null;
|
||||
configReport = yield* configFileLogger.output();
|
||||
if (babelrc === undefined) {
|
||||
babelrc = validatedFile.options.babelrc;
|
||||
}
|
||||
if (babelrcRoots === undefined) {
|
||||
babelrcRootsDirectory = validatedFile.dirname;
|
||||
babelrcRoots = validatedFile.options.babelrcRoots;
|
||||
}
|
||||
mergeChain(configFileChain, result);
|
||||
}
|
||||
let ignoreFile, babelrcFile;
|
||||
let isIgnored = false;
|
||||
const fileChain = emptyChain();
|
||||
if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") {
|
||||
const pkgData = yield* (0, _index.findPackageData)(context.filename);
|
||||
if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
|
||||
({
|
||||
ignore: ignoreFile,
|
||||
config: babelrcFile
|
||||
} = yield* (0, _index.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||
if (ignoreFile) {
|
||||
fileChain.files.add(ignoreFile.filepath);
|
||||
}
|
||||
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||
isIgnored = true;
|
||||
}
|
||||
if (babelrcFile && !isIgnored) {
|
||||
const validatedFile = validateBabelrcFile(babelrcFile);
|
||||
const babelrcLogger = new _printer.ConfigPrinter();
|
||||
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
|
||||
if (!result) {
|
||||
isIgnored = true;
|
||||
} else {
|
||||
babelRcReport = yield* babelrcLogger.output();
|
||||
mergeChain(fileChain, result);
|
||||
}
|
||||
}
|
||||
if (babelrcFile && isIgnored) {
|
||||
fileChain.files.add(babelrcFile.filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (context.showConfig) {
|
||||
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----");
|
||||
}
|
||||
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||
return {
|
||||
plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),
|
||||
presets: isIgnored ? [] : dedupDescriptors(chain.presets),
|
||||
options: isIgnored ? [] : chain.options.map(o => createConfigChainOptions(o)),
|
||||
fileHandling: isIgnored ? "ignored" : "transpile",
|
||||
ignore: ignoreFile || undefined,
|
||||
babelrc: babelrcFile || undefined,
|
||||
config: configFile || undefined,
|
||||
files: chain.files
|
||||
};
|
||||
}
|
||||
function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) {
|
||||
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
||||
const absoluteRoot = context.root;
|
||||
if (babelrcRoots === undefined) {
|
||||
return pkgData.directories.includes(absoluteRoot);
|
||||
}
|
||||
let babelrcPatterns = babelrcRoots;
|
||||
if (!Array.isArray(babelrcPatterns)) {
|
||||
babelrcPatterns = [babelrcPatterns];
|
||||
}
|
||||
babelrcPatterns = babelrcPatterns.map(pat => {
|
||||
return typeof pat === "string" ? _path().resolve(babelrcRootsDirectory, pat) : pat;
|
||||
});
|
||||
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
|
||||
return pkgData.directories.includes(absoluteRoot);
|
||||
}
|
||||
return babelrcPatterns.some(pat => {
|
||||
if (typeof pat === "string") {
|
||||
pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory);
|
||||
}
|
||||
return pkgData.directories.some(directory => {
|
||||
return matchPattern(pat, babelrcRootsDirectory, directory, context);
|
||||
});
|
||||
});
|
||||
}
|
||||
const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("configfile", file.options, file.filepath)
|
||||
}));
|
||||
const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("babelrcfile", file.options, file.filepath)
|
||||
}));
|
||||
const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: (0, _options.validate)("extendsfile", file.options, file.filepath)
|
||||
}));
|
||||
const loadProgrammaticChain = makeChainWalker({
|
||||
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
|
||||
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
|
||||
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
|
||||
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
|
||||
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
|
||||
});
|
||||
const loadFileChainWalker = makeChainWalker({
|
||||
root: file => loadFileDescriptors(file),
|
||||
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
|
||||
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
|
||||
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
|
||||
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
|
||||
});
|
||||
function* loadFileChain(input, context, files, baseLogger) {
|
||||
const chain = yield* loadFileChainWalker(input, context, files, baseLogger);
|
||||
chain == null || chain.files.add(input.filepath);
|
||||
return chain;
|
||||
}
|
||||
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||
function buildFileLogger(filepath, context, baseLogger) {
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
|
||||
filepath
|
||||
});
|
||||
}
|
||||
function buildRootDescriptors({
|
||||
dirname,
|
||||
options
|
||||
}, alias, descriptors) {
|
||||
return descriptors(dirname, options, alias);
|
||||
}
|
||||
function buildProgrammaticLogger(_, context, baseLogger) {
|
||||
var _context$caller;
|
||||
if (!baseLogger) {
|
||||
return () => {};
|
||||
}
|
||||
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
|
||||
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
|
||||
});
|
||||
}
|
||||
function buildEnvDescriptors({
|
||||
dirname,
|
||||
options
|
||||
}, alias, descriptors, envName) {
|
||||
var _options$env;
|
||||
const opts = (_options$env = options.env) == null ? void 0 : _options$env[envName];
|
||||
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
|
||||
}
|
||||
function buildOverrideDescriptors({
|
||||
dirname,
|
||||
options
|
||||
}, alias, descriptors, index) {
|
||||
var _options$overrides;
|
||||
const opts = (_options$overrides = options.overrides) == null ? void 0 : _options$overrides[index];
|
||||
if (!opts) throw new Error("Assertion failure - missing override");
|
||||
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
|
||||
}
|
||||
function buildOverrideEnvDescriptors({
|
||||
dirname,
|
||||
options
|
||||
}, alias, descriptors, index, envName) {
|
||||
var _options$overrides2, _override$env;
|
||||
const override = (_options$overrides2 = options.overrides) == null ? void 0 : _options$overrides2[index];
|
||||
if (!override) throw new Error("Assertion failure - missing override");
|
||||
const opts = (_override$env = override.env) == null ? void 0 : _override$env[envName];
|
||||
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
|
||||
}
|
||||
function makeChainWalker({
|
||||
root,
|
||||
env,
|
||||
overrides,
|
||||
overridesEnv,
|
||||
createLogger
|
||||
}) {
|
||||
return function* chainWalker(input, context, files = new Set(), baseLogger) {
|
||||
const {
|
||||
dirname
|
||||
} = input;
|
||||
const flattenedConfigs = [];
|
||||
const rootOpts = root(input);
|
||||
if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {
|
||||
flattenedConfigs.push({
|
||||
config: rootOpts,
|
||||
envName: undefined,
|
||||
index: undefined
|
||||
});
|
||||
const envOpts = env(input, context.envName);
|
||||
if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) {
|
||||
flattenedConfigs.push({
|
||||
config: envOpts,
|
||||
envName: context.envName,
|
||||
index: undefined
|
||||
});
|
||||
}
|
||||
(rootOpts.options.overrides || []).forEach((_, index) => {
|
||||
const overrideOps = overrides(input, index);
|
||||
if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {
|
||||
flattenedConfigs.push({
|
||||
config: overrideOps,
|
||||
index,
|
||||
envName: undefined
|
||||
});
|
||||
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) {
|
||||
flattenedConfigs.push({
|
||||
config: overrideEnvOpts,
|
||||
index,
|
||||
envName: context.envName
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (flattenedConfigs.some(({
|
||||
config: {
|
||||
options: {
|
||||
ignore,
|
||||
only
|
||||
}
|
||||
}
|
||||
}) => shouldIgnore(context, ignore, only, dirname))) {
|
||||
return null;
|
||||
}
|
||||
const chain = emptyChain();
|
||||
const logger = createLogger(input, context, baseLogger);
|
||||
for (const {
|
||||
config,
|
||||
index,
|
||||
envName
|
||||
} of flattenedConfigs) {
|
||||
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
|
||||
return null;
|
||||
}
|
||||
logger(config, index, envName);
|
||||
yield* mergeChainOpts(chain, config);
|
||||
}
|
||||
return chain;
|
||||
};
|
||||
}
|
||||
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
|
||||
if (opts.extends === undefined) return true;
|
||||
const file = yield* (0, _index.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||
if (files.has(file)) {
|
||||
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
|
||||
}
|
||||
files.add(file);
|
||||
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
|
||||
files.delete(file);
|
||||
if (!fileChain) return false;
|
||||
mergeChain(chain, fileChain);
|
||||
return true;
|
||||
}
|
||||
function mergeChain(target, source) {
|
||||
target.options.push(...source.options);
|
||||
target.plugins.push(...source.plugins);
|
||||
target.presets.push(...source.presets);
|
||||
for (const file of source.files) {
|
||||
target.files.add(file);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
function* mergeChainOpts(target, {
|
||||
options,
|
||||
plugins,
|
||||
presets
|
||||
}) {
|
||||
target.options.push(options);
|
||||
target.plugins.push(...(yield* plugins()));
|
||||
target.presets.push(...(yield* presets()));
|
||||
return target;
|
||||
}
|
||||
function emptyChain() {
|
||||
return {
|
||||
options: [],
|
||||
presets: [],
|
||||
plugins: [],
|
||||
files: new Set()
|
||||
};
|
||||
}
|
||||
function createConfigChainOptions(opts) {
|
||||
const options = Object.assign({}, opts);
|
||||
delete options.extends;
|
||||
delete options.env;
|
||||
delete options.overrides;
|
||||
delete options.plugins;
|
||||
delete options.presets;
|
||||
delete options.passPerPreset;
|
||||
delete options.ignore;
|
||||
delete options.only;
|
||||
delete options.test;
|
||||
delete options.include;
|
||||
delete options.exclude;
|
||||
if (hasOwnProperty.call(options, "sourceMap")) {
|
||||
options.sourceMaps = options.sourceMap;
|
||||
delete options.sourceMap;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
function dedupDescriptors(items) {
|
||||
const map = new Map();
|
||||
const descriptors = [];
|
||||
for (const item of items) {
|
||||
if (typeof item.value === "function") {
|
||||
const fnKey = item.value;
|
||||
let nameMap = map.get(fnKey);
|
||||
if (!nameMap) {
|
||||
nameMap = new Map();
|
||||
map.set(fnKey, nameMap);
|
||||
}
|
||||
let desc = nameMap.get(item.name);
|
||||
if (!desc) {
|
||||
desc = {
|
||||
value: item
|
||||
};
|
||||
descriptors.push(desc);
|
||||
if (!item.ownPass) nameMap.set(item.name, desc);
|
||||
} else {
|
||||
desc.value = item;
|
||||
}
|
||||
} else {
|
||||
descriptors.push({
|
||||
value: item
|
||||
});
|
||||
}
|
||||
}
|
||||
return descriptors.reduce((acc, desc) => {
|
||||
acc.push(desc.value);
|
||||
return acc;
|
||||
}, []);
|
||||
}
|
||||
function configIsApplicable({
|
||||
options
|
||||
}, dirname, context, configName) {
|
||||
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname, configName)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname, configName)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname, configName));
|
||||
}
|
||||
function configFieldIsApplicable(context, test, dirname, configName) {
|
||||
const patterns = Array.isArray(test) ? test : [test];
|
||||
return matchesPatterns(context, patterns, dirname, configName);
|
||||
}
|
||||
function ignoreListReplacer(_key, value) {
|
||||
if (value instanceof RegExp) {
|
||||
return String(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
function shouldIgnore(context, ignore, only, dirname) {
|
||||
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||
var _context$filename;
|
||||
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (only && !matchesPatterns(context, only, dirname)) {
|
||||
var _context$filename2;
|
||||
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`;
|
||||
debug(message);
|
||||
if (context.showConfig) {
|
||||
console.log(message);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function matchesPatterns(context, patterns, dirname, configName) {
|
||||
return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context, configName));
|
||||
}
|
||||
function matchPattern(pattern, dirname, pathToTest, context, configName) {
|
||||
if (typeof pattern === "function") {
|
||||
return !!(0, _rewriteStackTrace.endHiddenCallStack)(pattern)(pathToTest, {
|
||||
dirname,
|
||||
envName: context.envName,
|
||||
caller: context.caller
|
||||
});
|
||||
}
|
||||
if (typeof pathToTest !== "string") {
|
||||
throw new _configError.default(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`, configName);
|
||||
}
|
||||
if (typeof pattern === "string") {
|
||||
pattern = (0, _patternToRegex.default)(pattern, dirname);
|
||||
}
|
||||
return pattern.test(pathToTest);
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=config-chain.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/config-chain.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/config-chain.js.map
generated
vendored
File diff suppressed because one or more lines are too long
190
platform/web/node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
190
platform/web/node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
@@ -1,190 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createCachedDescriptors = createCachedDescriptors;
|
||||
exports.createDescriptor = createDescriptor;
|
||||
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _functional = require("../gensync-utils/functional.js");
|
||||
var _index = require("./files/index.js");
|
||||
var _item = require("./item.js");
|
||||
var _caching = require("./caching.js");
|
||||
var _resolveTargets = require("./resolve-targets.js");
|
||||
function isEqualDescriptor(a, b) {
|
||||
var _a$file, _b$file, _a$file2, _b$file2;
|
||||
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && ((_a$file = a.file) == null ? void 0 : _a$file.request) === ((_b$file = b.file) == null ? void 0 : _b$file.request) && ((_a$file2 = a.file) == null ? void 0 : _a$file2.resolved) === ((_b$file2 = b.file) == null ? void 0 : _b$file2.resolved);
|
||||
}
|
||||
function* handlerOf(value) {
|
||||
return value;
|
||||
}
|
||||
function optionsWithResolvedBrowserslistConfigFile(options, dirname) {
|
||||
if (typeof options.browserslistConfigFile === "string") {
|
||||
options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile, dirname);
|
||||
}
|
||||
return options;
|
||||
}
|
||||
function createCachedDescriptors(dirname, options, alias) {
|
||||
const {
|
||||
plugins,
|
||||
presets,
|
||||
passPerPreset
|
||||
} = options;
|
||||
return {
|
||||
options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
|
||||
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]),
|
||||
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([])
|
||||
};
|
||||
}
|
||||
function createUncachedDescriptors(dirname, options, alias) {
|
||||
return {
|
||||
options: optionsWithResolvedBrowserslistConfigFile(options, dirname),
|
||||
plugins: (0, _functional.once)(() => createPluginDescriptors(options.plugins || [], dirname, alias)),
|
||||
presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset))
|
||||
};
|
||||
}
|
||||
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCache)(function* (passPerPreset) {
|
||||
const descriptors = yield* createPresetDescriptors(items, dirname, alias, passPerPreset);
|
||||
return descriptors.map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc));
|
||||
}));
|
||||
});
|
||||
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
|
||||
const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||
const dirname = cache.using(dir => dir);
|
||||
return (0, _caching.makeStrongCache)(function* (alias) {
|
||||
const descriptors = yield* createPluginDescriptors(items, dirname, alias);
|
||||
return descriptors.map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc));
|
||||
});
|
||||
});
|
||||
const DEFAULT_OPTIONS = {};
|
||||
function loadCachedDescriptor(cache, desc) {
|
||||
const {
|
||||
value,
|
||||
options = DEFAULT_OPTIONS
|
||||
} = desc;
|
||||
if (options === false) return desc;
|
||||
let cacheByOptions = cache.get(value);
|
||||
if (!cacheByOptions) {
|
||||
cacheByOptions = new WeakMap();
|
||||
cache.set(value, cacheByOptions);
|
||||
}
|
||||
let possibilities = cacheByOptions.get(options);
|
||||
if (!possibilities) {
|
||||
possibilities = [];
|
||||
cacheByOptions.set(options, possibilities);
|
||||
}
|
||||
if (!possibilities.includes(desc)) {
|
||||
const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc));
|
||||
if (matches.length > 0) {
|
||||
return matches[0];
|
||||
}
|
||||
possibilities.push(desc);
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
function* createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||
return yield* createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||
}
|
||||
function* createPluginDescriptors(items, dirname, alias) {
|
||||
return yield* createDescriptors("plugin", items, dirname, alias);
|
||||
}
|
||||
function* createDescriptors(type, items, dirname, alias, ownPass) {
|
||||
const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item, dirname, {
|
||||
type,
|
||||
alias: `${alias}$${index}`,
|
||||
ownPass: !!ownPass
|
||||
})));
|
||||
assertNoDuplicates(descriptors);
|
||||
return descriptors;
|
||||
}
|
||||
function* createDescriptor(pair, dirname, {
|
||||
type,
|
||||
alias,
|
||||
ownPass
|
||||
}) {
|
||||
const desc = (0, _item.getItemDescriptor)(pair);
|
||||
if (desc) {
|
||||
return desc;
|
||||
}
|
||||
let name;
|
||||
let options;
|
||||
let value = pair;
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length === 3) {
|
||||
[value, options, name] = value;
|
||||
} else {
|
||||
[value, options] = value;
|
||||
}
|
||||
}
|
||||
let file = undefined;
|
||||
let filepath = null;
|
||||
if (typeof value === "string") {
|
||||
if (typeof type !== "string") {
|
||||
throw new Error("To resolve a string-based item, the type of item must be given");
|
||||
}
|
||||
const resolver = type === "plugin" ? _index.loadPlugin : _index.loadPreset;
|
||||
const request = value;
|
||||
({
|
||||
filepath,
|
||||
value
|
||||
} = yield* resolver(value, dirname));
|
||||
file = {
|
||||
request,
|
||||
resolved: filepath
|
||||
};
|
||||
}
|
||||
if (!value) {
|
||||
throw new Error(`Unexpected falsy value: ${String(value)}`);
|
||||
}
|
||||
if (typeof value === "object" && value.__esModule) {
|
||||
if (value.default) {
|
||||
value = value.default;
|
||||
} else {
|
||||
throw new Error("Must export a default export when using ES6 modules.");
|
||||
}
|
||||
}
|
||||
if (typeof value !== "object" && typeof value !== "function") {
|
||||
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
|
||||
}
|
||||
if (filepath !== null && typeof value === "object" && value) {
|
||||
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
|
||||
}
|
||||
return {
|
||||
name,
|
||||
alias: filepath || alias,
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
ownPass,
|
||||
file
|
||||
};
|
||||
}
|
||||
function assertNoDuplicates(items) {
|
||||
const map = new Map();
|
||||
for (const item of items) {
|
||||
if (typeof item.value !== "function") continue;
|
||||
let nameMap = map.get(item.value);
|
||||
if (!nameMap) {
|
||||
nameMap = new Set();
|
||||
map.set(item.value, nameMap);
|
||||
}
|
||||
if (nameMap.has(item.name)) {
|
||||
const conflicts = items.filter(i => i.value === item.value);
|
||||
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n"));
|
||||
}
|
||||
nameMap.add(item.name);
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=config-descriptors.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/config-descriptors.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/config-descriptors.js.map
generated
vendored
File diff suppressed because one or more lines are too long
290
platform/web/node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
290
platform/web/node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
@@ -1,290 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.findConfigUpwards = findConfigUpwards;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
function _debug() {
|
||||
const data = require("debug");
|
||||
_debug = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _json() {
|
||||
const data = require("json5");
|
||||
_json = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _caching = require("../caching.js");
|
||||
var _configApi = require("../helpers/config-api.js");
|
||||
var _utils = require("./utils.js");
|
||||
var _moduleTypes = require("./module-types.js");
|
||||
var _patternToRegex = require("../pattern-to-regex.js");
|
||||
var _configError = require("../../errors/config-error.js");
|
||||
var fs = require("../../gensync-utils/fs.js");
|
||||
require("module");
|
||||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
|
||||
var _async = require("../../gensync-utils/async.js");
|
||||
const debug = _debug()("babel:config:loading:files:configuration");
|
||||
const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts", "babel.config.ts", "babel.config.mts"];
|
||||
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json", ".babelrc.cts"];
|
||||
const BABELIGNORE_FILENAME = ".babelignore";
|
||||
const runConfig = (0, _caching.makeWeakCache)(function* runConfig(options, cache) {
|
||||
yield* [];
|
||||
return {
|
||||
options: (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)),
|
||||
cacheNeedsConfiguration: !cache.configured()
|
||||
};
|
||||
});
|
||||
function* readConfigCode(filepath, data) {
|
||||
if (!_fs().existsSync(filepath)) return null;
|
||||
let options = yield* (0, _moduleTypes.default)(filepath, (yield* (0, _async.isAsync)()) ? "auto" : "require", "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", "You appear to be using a configuration file that contains top-level " + "await, which is only supported when running Babel asynchronously.");
|
||||
let cacheNeedsConfiguration = false;
|
||||
if (typeof options === "function") {
|
||||
({
|
||||
options,
|
||||
cacheNeedsConfiguration
|
||||
} = yield* runConfig(options, data));
|
||||
}
|
||||
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
||||
throw new _configError.default(`Configuration should be an exported JavaScript object.`, filepath);
|
||||
}
|
||||
if (typeof options.then === "function") {
|
||||
options.catch == null || options.catch(() => {});
|
||||
throw new _configError.default(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`, filepath);
|
||||
}
|
||||
if (cacheNeedsConfiguration) throwConfigError(filepath);
|
||||
return buildConfigFileObject(options, filepath);
|
||||
}
|
||||
const cfboaf = new WeakMap();
|
||||
function buildConfigFileObject(options, filepath) {
|
||||
let configFilesByFilepath = cfboaf.get(options);
|
||||
if (!configFilesByFilepath) {
|
||||
cfboaf.set(options, configFilesByFilepath = new Map());
|
||||
}
|
||||
let configFile = configFilesByFilepath.get(filepath);
|
||||
if (!configFile) {
|
||||
configFile = {
|
||||
filepath,
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
configFilesByFilepath.set(filepath, configFile);
|
||||
}
|
||||
return configFile;
|
||||
}
|
||||
const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
|
||||
const babel = file.options.babel;
|
||||
if (babel === undefined) return null;
|
||||
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
|
||||
throw new _configError.default(`.babel property must be an object`, file.filepath);
|
||||
}
|
||||
return {
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: babel
|
||||
};
|
||||
});
|
||||
const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
let options;
|
||||
try {
|
||||
options = _json().parse(content);
|
||||
} catch (err) {
|
||||
throw new _configError.default(`Error while parsing config - ${err.message}`, filepath);
|
||||
}
|
||||
if (!options) throw new _configError.default(`No config detected`, filepath);
|
||||
if (typeof options !== "object") {
|
||||
throw new _configError.default(`Config returned typeof ${typeof options}`, filepath);
|
||||
}
|
||||
if (Array.isArray(options)) {
|
||||
throw new _configError.default(`Expected config object but found array`, filepath);
|
||||
}
|
||||
delete options.$schema;
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
const ignoreDir = _path().dirname(filepath);
|
||||
const ignorePatterns = content.split("\n").map(line => line.replace(/#.*$/, "").trim()).filter(Boolean);
|
||||
for (const pattern of ignorePatterns) {
|
||||
if (pattern.startsWith("!")) {
|
||||
throw new _configError.default(`Negation of file paths is not supported.`, filepath);
|
||||
}
|
||||
}
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().dirname(filepath),
|
||||
ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
|
||||
};
|
||||
});
|
||||
function findConfigUpwards(rootDir) {
|
||||
let dirname = rootDir;
|
||||
for (;;) {
|
||||
for (const filename of ROOT_CONFIG_FILENAMES) {
|
||||
if (_fs().existsSync(_path().join(dirname, filename))) {
|
||||
return dirname;
|
||||
}
|
||||
}
|
||||
const nextDir = _path().dirname(dirname);
|
||||
if (dirname === nextDir) break;
|
||||
dirname = nextDir;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function* findRelativeConfig(packageData, envName, caller) {
|
||||
let config = null;
|
||||
let ignore = null;
|
||||
const dirname = _path().dirname(packageData.filepath);
|
||||
for (const loc of packageData.directories) {
|
||||
if (!config) {
|
||||
var _packageData$pkg;
|
||||
config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null);
|
||||
}
|
||||
if (!ignore) {
|
||||
const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME);
|
||||
ignore = yield* readIgnoreConfig(ignoreLoc);
|
||||
if (ignore) {
|
||||
debug("Found ignore %o from %o.", ignore.filepath, dirname);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
config,
|
||||
ignore
|
||||
};
|
||||
}
|
||||
function findRootConfig(dirname, envName, caller) {
|
||||
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
|
||||
}
|
||||
function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
|
||||
const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller)));
|
||||
const config = configs.reduce((previousConfig, config) => {
|
||||
if (config && previousConfig) {
|
||||
throw new _configError.default(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
|
||||
}
|
||||
return config || previousConfig;
|
||||
}, previousConfig);
|
||||
if (config) {
|
||||
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||
}
|
||||
return config;
|
||||
}
|
||||
function* loadConfig(name, dirname, envName, caller) {
|
||||
const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
||||
paths: [b]
|
||||
}, M = require("module")) => {
|
||||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
|
||||
if (f) return f;
|
||||
f = new Error(`Cannot resolve module '${r}'`);
|
||||
f.code = "MODULE_NOT_FOUND";
|
||||
throw f;
|
||||
})(name, {
|
||||
paths: [dirname]
|
||||
});
|
||||
const conf = yield* readConfig(filepath, envName, caller);
|
||||
if (!conf) {
|
||||
throw new _configError.default(`Config file contains no configuration data`, filepath);
|
||||
}
|
||||
debug("Loaded config %o from %o.", name, dirname);
|
||||
return conf;
|
||||
}
|
||||
function readConfig(filepath, envName, caller) {
|
||||
const ext = _path().extname(filepath);
|
||||
switch (ext) {
|
||||
case ".js":
|
||||
case ".cjs":
|
||||
case ".mjs":
|
||||
case ".ts":
|
||||
case ".cts":
|
||||
case ".mts":
|
||||
return readConfigCode(filepath, {
|
||||
envName,
|
||||
caller
|
||||
});
|
||||
default:
|
||||
return readConfigJSON5(filepath);
|
||||
}
|
||||
}
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
|
||||
if (targetPath != null) {
|
||||
const absolutePath = _path().resolve(dirname, targetPath);
|
||||
const stats = yield* fs.stat(absolutePath);
|
||||
if (!stats.isFile()) {
|
||||
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
|
||||
}
|
||||
return absolutePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function throwConfigError(filepath) {
|
||||
throw new _configError.default(`\
|
||||
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
|
||||
for various types of caching, using the first param of their handler functions:
|
||||
|
||||
module.exports = function(api) {
|
||||
// The API exposes the following:
|
||||
|
||||
// Cache the returned value forever and don't call this function again.
|
||||
api.cache(true);
|
||||
|
||||
// Don't cache at all. Not recommended because it will be very slow.
|
||||
api.cache(false);
|
||||
|
||||
// Cached based on the value of some function. If this function returns a value different from
|
||||
// a previously-encountered value, the plugins will re-evaluate.
|
||||
var env = api.cache(() => process.env.NODE_ENV);
|
||||
|
||||
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
|
||||
// any possible NODE_ENV value that might come up during plugin execution.
|
||||
var isProd = api.cache(() => process.env.NODE_ENV === "production");
|
||||
|
||||
// .cache(fn) will perform a linear search though instances to find the matching plugin based
|
||||
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
|
||||
// previous instance whenever something changes, you may use:
|
||||
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
|
||||
|
||||
// Note, we also expose the following more-verbose versions of the above examples:
|
||||
api.cache.forever(); // api.cache(true)
|
||||
api.cache.never(); // api.cache(false)
|
||||
api.cache.using(fn); // api.cache(fn)
|
||||
|
||||
// Return the value that will be cached.
|
||||
return { };
|
||||
};`, filepath);
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=configuration.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/configuration.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/configuration.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
platform/web/node_modules/@babel/core/lib/config/files/import.cjs
generated
vendored
6
platform/web/node_modules/@babel/core/lib/config/files/import.cjs
generated
vendored
@@ -1,6 +0,0 @@
|
||||
module.exports = function import_(filepath) {
|
||||
return import(filepath);
|
||||
};
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=import.cjs.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/import.cjs.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/import.cjs.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["module","exports","import_","filepath"],"sources":["../../../src/config/files/import.cjs"],"sourcesContent":["// We keep this in a separate file so that in older node versions, where\n// import() isn't supported, we can try/catch around the require() call\n// when loading this file.\n\nmodule.exports = function import_(filepath) {\n return import(filepath);\n};\n"],"mappings":"AAIAA,MAAM,CAACC,OAAO,GAAG,SAASC,OAAOA,CAACC,QAAQ,EAAE;EAC1C,OAAO,OAAOA,QAAQ,CAAC;AACzB,CAAC;AAAC","ignoreList":[]}
|
||||
58
platform/web/node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
58
platform/web/node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
@@ -1,58 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||
exports.findConfigUpwards = findConfigUpwards;
|
||||
exports.findPackageData = findPackageData;
|
||||
exports.findRelativeConfig = findRelativeConfig;
|
||||
exports.findRootConfig = findRootConfig;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.resolvePreset = resolvePreset;
|
||||
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||
function findConfigUpwards(rootDir) {
|
||||
return null;
|
||||
}
|
||||
function* findPackageData(filepath) {
|
||||
return {
|
||||
filepath,
|
||||
directories: [],
|
||||
pkg: null,
|
||||
isPackage: false
|
||||
};
|
||||
}
|
||||
function* findRelativeConfig(pkgData, envName, caller) {
|
||||
return {
|
||||
config: null,
|
||||
ignore: null
|
||||
};
|
||||
}
|
||||
function* findRootConfig(dirname, envName, caller) {
|
||||
return null;
|
||||
}
|
||||
function* loadConfig(name, dirname, envName, caller) {
|
||||
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
function* resolveShowConfigPath(dirname) {
|
||||
return null;
|
||||
}
|
||||
const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = [];
|
||||
function resolvePlugin(name, dirname) {
|
||||
return null;
|
||||
}
|
||||
function resolvePreset(name, dirname) {
|
||||
return null;
|
||||
}
|
||||
function loadPlugin(name, dirname) {
|
||||
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
function loadPreset(name, dirname) {
|
||||
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=index-browser.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/index-browser.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/index-browser.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["findConfigUpwards","rootDir","findPackageData","filepath","directories","pkg","isPackage","findRelativeConfig","pkgData","envName","caller","config","ignore","findRootConfig","dirname","loadConfig","name","Error","resolveShowConfigPath","ROOT_CONFIG_FILENAMES","exports","resolvePlugin","resolvePreset","loadPlugin","loadPreset"],"sources":["../../../src/config/files/index-browser.ts"],"sourcesContent":["/* c8 ignore start */\n\nimport type { Handler } from \"gensync\";\n\nimport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types.ts\";\n\nimport type { CallerMetadata } from \"../validation/options.ts\";\n\nexport type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };\n\nexport function findConfigUpwards(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n rootDir: string,\n): string | null {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* findPackageData(filepath: string): Handler<FilePackageData> {\n return {\n filepath,\n directories: [],\n pkg: null,\n isPackage: false,\n };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRelativeConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n pkgData: FilePackageData,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<RelativeConfig> {\n return { config: null, ignore: null };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRootConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<ConfigFile | null> {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* loadConfig(\n name: string,\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler<ConfigFile> {\n throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);\n}\n\n// eslint-disable-next-line require-yield\nexport function* resolveShowConfigPath(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n): Handler<string | null> {\n return null;\n}\n\nexport const ROOT_CONFIG_FILENAMES: string[] = [];\n\ntype Resolved =\n | { loader: \"require\"; filepath: string }\n | { loader: \"import\"; filepath: string };\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePlugin(name: string, dirname: string): Resolved | null {\n return null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePreset(name: string, dirname: string): Resolved | null {\n return null;\n}\n\nexport function loadPlugin(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load plugin ${name} relative to ${dirname} in a browser`,\n );\n}\n\nexport function loadPreset(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load preset ${name} relative to ${dirname} in a browser`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeO,SAASA,iBAAiBA,CAE/BC,OAAe,EACA;EACf,OAAO,IAAI;AACb;AAGO,UAAUC,eAAeA,CAACC,QAAgB,EAA4B;EAC3E,OAAO;IACLA,QAAQ;IACRC,WAAW,EAAE,EAAE;IACfC,GAAG,EAAE,IAAI;IACTC,SAAS,EAAE;EACb,CAAC;AACH;AAGO,UAAUC,kBAAkBA,CAEjCC,OAAwB,EAExBC,OAAe,EAEfC,MAAkC,EACT;EACzB,OAAO;IAAEC,MAAM,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAK,CAAC;AACvC;AAGO,UAAUC,cAAcA,CAE7BC,OAAe,EAEfL,OAAe,EAEfC,MAAkC,EACN;EAC5B,OAAO,IAAI;AACb;AAGO,UAAUK,UAAUA,CACzBC,IAAY,EACZF,OAAe,EAEfL,OAAe,EAEfC,MAAkC,EACb;EACrB,MAAM,IAAIO,KAAK,CAAC,eAAeD,IAAI,gBAAgBF,OAAO,eAAe,CAAC;AAC5E;AAGO,UAAUI,qBAAqBA,CAEpCJ,OAAe,EACS;EACxB,OAAO,IAAI;AACb;AAEO,MAAMK,qBAA+B,GAAAC,OAAA,CAAAD,qBAAA,GAAG,EAAE;AAO1C,SAASE,aAAaA,CAACL,IAAY,EAAEF,OAAe,EAAmB;EAC5E,OAAO,IAAI;AACb;AAGO,SAASQ,aAAaA,CAACN,IAAY,EAAEF,OAAe,EAAmB;EAC5E,OAAO,IAAI;AACb;AAEO,SAASS,UAAUA,CACxBP,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACb,sBAAsBD,IAAI,gBAAgBF,OAAO,eACnD,CAAC;AACH;AAEO,SAASU,UAAUA,CACxBR,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACb,sBAAsBD,IAAI,gBAAgBF,OAAO,eACnD,CAAC;AACH;AAAC","ignoreList":[]}
|
||||
78
platform/web/node_modules/@babel/core/lib/config/files/index.js
generated
vendored
78
platform/web/node_modules/@babel/core/lib/config/files/index.js
generated
vendored
@@ -1,78 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.ROOT_CONFIG_FILENAMES;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findConfigUpwards", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.findConfigUpwards;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findPackageData", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _package.findPackageData;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findRelativeConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.findRelativeConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findRootConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.findRootConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadConfig", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.loadConfig;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.loadPlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "loadPreset", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.loadPreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePlugin", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.resolvePlugin;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolvePreset", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _plugins.resolvePreset;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "resolveShowConfigPath", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _configuration.resolveShowConfigPath;
|
||||
}
|
||||
});
|
||||
var _package = require("./package.js");
|
||||
var _configuration = require("./configuration.js");
|
||||
var _plugins = require("./plugins.js");
|
||||
({});
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/index.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["_package","require","_configuration","_plugins"],"sources":["../../../src/config/files/index.ts"],"sourcesContent":["type indexBrowserType = typeof import(\"./index-browser\");\ntype indexType = typeof import(\"./index\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n({}) as any as indexBrowserType as indexType;\n\nexport { findPackageData } from \"./package.ts\";\n\nexport {\n findConfigUpwards,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./configuration.ts\";\nexport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types.ts\";\nexport {\n loadPlugin,\n loadPreset,\n resolvePlugin,\n resolvePreset,\n} from \"./plugins.ts\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAcA,IAAAE,QAAA,GAAAF,OAAA;AAlBA,CAAC,CAAC,CAAC;AAA0C","ignoreList":[]}
|
||||
203
platform/web/node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
203
platform/web/node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
@@ -1,203 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = loadCodeDefault;
|
||||
exports.supportsESM = void 0;
|
||||
var _async = require("../../gensync-utils/async.js");
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _url() {
|
||||
const data = require("url");
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
require("module");
|
||||
function _semver() {
|
||||
const data = require("semver");
|
||||
_semver = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _debug() {
|
||||
const data = require("debug");
|
||||
_debug = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
|
||||
var _configError = require("../../errors/config-error.js");
|
||||
var _transformFile = require("../../transform-file.js");
|
||||
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
||||
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
||||
const debug = _debug()("babel:config:loading:files:module-types");
|
||||
try {
|
||||
var import_ = require("./import.cjs");
|
||||
} catch (_unused) {}
|
||||
const supportsESM = exports.supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2");
|
||||
const LOADING_CJS_FILES = new Set();
|
||||
function loadCjsDefault(filepath) {
|
||||
if (LOADING_CJS_FILES.has(filepath)) {
|
||||
debug("Auto-ignoring usage of config %o.", filepath);
|
||||
return {};
|
||||
}
|
||||
let module;
|
||||
try {
|
||||
LOADING_CJS_FILES.add(filepath);
|
||||
module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath);
|
||||
} finally {
|
||||
LOADING_CJS_FILES.delete(filepath);
|
||||
}
|
||||
return module != null && (module.__esModule || module[Symbol.toStringTag] === "Module") ? module.default || (arguments[1] ? module : undefined) : module;
|
||||
}
|
||||
const loadMjsFromPath = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
|
||||
var _loadMjsFromPath = _asyncToGenerator(function* (filepath) {
|
||||
const url = (0, _url().pathToFileURL)(filepath).toString() + "?import";
|
||||
if (!import_) {
|
||||
throw new _configError.default("Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath);
|
||||
}
|
||||
return yield import_(url);
|
||||
});
|
||||
function loadMjsFromPath(_x) {
|
||||
return _loadMjsFromPath.apply(this, arguments);
|
||||
}
|
||||
return loadMjsFromPath;
|
||||
}());
|
||||
const tsNotSupportedError = ext => `\
|
||||
You are using a ${ext} config file, but Babel only supports transpiling .cts configs. Either:
|
||||
- Use a .cts config file
|
||||
- Update to Node.js 23.6.0, which has native TypeScript support
|
||||
- Install tsx to transpile ${ext} files on the fly\
|
||||
`;
|
||||
const SUPPORTED_EXTENSIONS = {
|
||||
".js": "unknown",
|
||||
".mjs": "esm",
|
||||
".cjs": "cjs",
|
||||
".ts": "unknown",
|
||||
".mts": "esm",
|
||||
".cts": "cjs"
|
||||
};
|
||||
const asyncModules = new Set();
|
||||
function* loadCodeDefault(filepath, loader, esmError, tlaError) {
|
||||
let async;
|
||||
const ext = _path().extname(filepath);
|
||||
const isTS = ext === ".ts" || ext === ".cts" || ext === ".mts";
|
||||
const type = SUPPORTED_EXTENSIONS[hasOwnProperty.call(SUPPORTED_EXTENSIONS, ext) ? ext : ".js"];
|
||||
const pattern = `${loader} ${type}`;
|
||||
switch (pattern) {
|
||||
case "require cjs":
|
||||
case "auto cjs":
|
||||
if (isTS) {
|
||||
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
|
||||
} else {
|
||||
return loadCjsDefault(filepath, arguments[2]);
|
||||
}
|
||||
case "auto unknown":
|
||||
case "require unknown":
|
||||
case "require esm":
|
||||
try {
|
||||
if (isTS) {
|
||||
return ensureTsSupport(filepath, ext, () => loadCjsDefault(filepath));
|
||||
} else {
|
||||
return loadCjsDefault(filepath, arguments[2]);
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) {
|
||||
asyncModules.add(filepath);
|
||||
if (!(async != null ? async : async = yield* (0, _async.isAsync)())) {
|
||||
throw new _configError.default(tlaError, filepath);
|
||||
}
|
||||
} else if (e.code === "ERR_REQUIRE_ESM" || type === "esm") {} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
case "auto esm":
|
||||
if (async != null ? async : async = yield* (0, _async.isAsync)()) {
|
||||
const promise = isTS ? ensureTsSupport(filepath, ext, () => loadMjsFromPath(filepath)) : loadMjsFromPath(filepath);
|
||||
return (yield* (0, _async.waitFor)(promise)).default;
|
||||
}
|
||||
if (isTS) {
|
||||
throw new _configError.default(tsNotSupportedError(ext), filepath);
|
||||
} else {
|
||||
throw new _configError.default(esmError, filepath);
|
||||
}
|
||||
default:
|
||||
throw new Error("Internal Babel error: unreachable code.");
|
||||
}
|
||||
}
|
||||
function ensureTsSupport(filepath, ext, callback) {
|
||||
if (process.features.typescript || require.extensions[".ts"] || require.extensions[".cts"] || require.extensions[".mts"]) {
|
||||
return callback();
|
||||
}
|
||||
if (ext !== ".cts") {
|
||||
throw new _configError.default(tsNotSupportedError(ext), filepath);
|
||||
}
|
||||
const opts = {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
sourceType: "unambiguous",
|
||||
sourceMaps: "inline",
|
||||
sourceFileName: _path().basename(filepath),
|
||||
presets: [[getTSPreset(filepath), Object.assign({
|
||||
onlyRemoveTypeImports: true,
|
||||
optimizeConstEnums: true
|
||||
}, {
|
||||
allowDeclareFields: true
|
||||
})]]
|
||||
};
|
||||
let handler = function (m, filename) {
|
||||
if (handler && filename.endsWith(".cts")) {
|
||||
try {
|
||||
return m._compile((0, _transformFile.transformFileSync)(filename, Object.assign({}, opts, {
|
||||
filename
|
||||
})).code, filename);
|
||||
} catch (error) {
|
||||
const packageJson = require("@babel/preset-typescript/package.json");
|
||||
if (_semver().lt(packageJson.version, "7.21.4")) {
|
||||
console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.");
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return require.extensions[".js"](m, filename);
|
||||
};
|
||||
require.extensions[ext] = handler;
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
if (require.extensions[ext] === handler) delete require.extensions[ext];
|
||||
handler = undefined;
|
||||
}
|
||||
}
|
||||
function getTSPreset(filepath) {
|
||||
try {
|
||||
return require("@babel/preset-typescript");
|
||||
} catch (error) {
|
||||
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
||||
let message = "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!";
|
||||
if (process.versions.pnp) {
|
||||
message += `
|
||||
If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:
|
||||
|
||||
packageExtensions:
|
||||
\t"@babel/core@*":
|
||||
\t\tpeerDependencies:
|
||||
\t\t\t"@babel/preset-typescript": "*"
|
||||
`;
|
||||
}
|
||||
throw new _configError.default(message, filepath);
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=module-types.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/module-types.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/module-types.js.map
generated
vendored
File diff suppressed because one or more lines are too long
61
platform/web/node_modules/@babel/core/lib/config/files/package.js
generated
vendored
61
platform/web/node_modules/@babel/core/lib/config/files/package.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findPackageData = findPackageData;
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _utils = require("./utils.js");
|
||||
var _configError = require("../../errors/config-error.js");
|
||||
const PACKAGE_FILENAME = "package.json";
|
||||
const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||
let options;
|
||||
try {
|
||||
options = JSON.parse(content);
|
||||
} catch (err) {
|
||||
throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath);
|
||||
}
|
||||
if (!options) throw new Error(`${filepath}: No config detected`);
|
||||
if (typeof options !== "object") {
|
||||
throw new _configError.default(`Config returned typeof ${typeof options}`, filepath);
|
||||
}
|
||||
if (Array.isArray(options)) {
|
||||
throw new _configError.default(`Expected config object but found array`, filepath);
|
||||
}
|
||||
return {
|
||||
filepath,
|
||||
dirname: _path().dirname(filepath),
|
||||
options
|
||||
};
|
||||
});
|
||||
function* findPackageData(filepath) {
|
||||
let pkg = null;
|
||||
const directories = [];
|
||||
let isPackage = true;
|
||||
let dirname = _path().dirname(filepath);
|
||||
while (!pkg && _path().basename(dirname) !== "node_modules") {
|
||||
directories.push(dirname);
|
||||
pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME));
|
||||
const nextLoc = _path().dirname(dirname);
|
||||
if (dirname === nextLoc) {
|
||||
isPackage = false;
|
||||
break;
|
||||
}
|
||||
dirname = nextLoc;
|
||||
}
|
||||
return {
|
||||
filepath,
|
||||
directories,
|
||||
pkg,
|
||||
isPackage
|
||||
};
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=package.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/package.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/package.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["_path","data","require","_utils","_configError","PACKAGE_FILENAME","readConfigPackage","makeStaticFileCache","filepath","content","options","JSON","parse","err","ConfigError","message","Error","Array","isArray","dirname","path","findPackageData","pkg","directories","isPackage","basename","push","join","nextLoc"],"sources":["../../../src/config/files/package.ts"],"sourcesContent":["import path from \"node:path\";\nimport type { Handler } from \"gensync\";\nimport { makeStaticFileCache } from \"./utils.ts\";\n\nimport type { ConfigFile, FilePackageData } from \"./types.ts\";\n\nimport ConfigError from \"../../errors/config-error.ts\";\n\nconst PACKAGE_FILENAME = \"package.json\";\n\nconst readConfigPackage = makeStaticFileCache(\n (filepath, content): ConfigFile => {\n let options;\n try {\n options = JSON.parse(content) as unknown;\n } catch (err) {\n throw new ConfigError(\n `Error while parsing JSON - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new Error(`${filepath}: No config detected`);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(\n `Config returned typeof ${typeof options}`,\n filepath,\n );\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n },\n);\n\n/**\n * Find metadata about the package that this file is inside of. Resolution\n * of Babel's config requires general package information to decide when to\n * search for .babelrc files\n */\nexport function* findPackageData(filepath: string): Handler<FilePackageData> {\n let pkg = null;\n const directories = [];\n let isPackage = true;\n\n let dirname = path.dirname(filepath);\n while (!pkg && path.basename(dirname) !== \"node_modules\") {\n directories.push(dirname);\n\n pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME));\n\n const nextLoc = path.dirname(dirname);\n if (dirname === nextLoc) {\n isPackage = false;\n break;\n }\n dirname = nextLoc;\n }\n\n return { filepath, directories, pkg, isPackage };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,IAAAE,MAAA,GAAAD,OAAA;AAIA,IAAAE,YAAA,GAAAF,OAAA;AAEA,MAAMG,gBAAgB,GAAG,cAAc;AAEvC,MAAMC,iBAAiB,GAAG,IAAAC,0BAAmB,EAC3C,CAACC,QAAQ,EAAEC,OAAO,KAAiB;EACjC,IAAIC,OAAO;EACX,IAAI;IACFA,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAY;EAC1C,CAAC,CAAC,OAAOI,GAAG,EAAE;IACZ,MAAM,IAAIC,oBAAW,CACnB,8BAA8BD,GAAG,CAACE,OAAO,EAAE,EAC3CP,QACF,CAAC;EACH;EAEA,IAAI,CAACE,OAAO,EAAE,MAAM,IAAIM,KAAK,CAAC,GAAGR,QAAQ,sBAAsB,CAAC;EAEhE,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,IAAII,oBAAW,CACnB,0BAA0B,OAAOJ,OAAO,EAAE,EAC1CF,QACF,CAAC;EACH;EACA,IAAIS,KAAK,CAACC,OAAO,CAACR,OAAO,CAAC,EAAE;IAC1B,MAAM,IAAII,oBAAW,CAAC,wCAAwC,EAAEN,QAAQ,CAAC;EAC3E;EAEA,OAAO;IACLA,QAAQ;IACRW,OAAO,EAAEC,MAAGA,CAAC,CAACD,OAAO,CAACX,QAAQ,CAAC;IAC/BE;EACF,CAAC;AACH,CACF,CAAC;AAOM,UAAUW,eAAeA,CAACb,QAAgB,EAA4B;EAC3E,IAAIc,GAAG,GAAG,IAAI;EACd,MAAMC,WAAW,GAAG,EAAE;EACtB,IAAIC,SAAS,GAAG,IAAI;EAEpB,IAAIL,OAAO,GAAGC,MAAGA,CAAC,CAACD,OAAO,CAACX,QAAQ,CAAC;EACpC,OAAO,CAACc,GAAG,IAAIF,MAAGA,CAAC,CAACK,QAAQ,CAACN,OAAO,CAAC,KAAK,cAAc,EAAE;IACxDI,WAAW,CAACG,IAAI,CAACP,OAAO,CAAC;IAEzBG,GAAG,GAAG,OAAOhB,iBAAiB,CAACc,MAAGA,CAAC,CAACO,IAAI,CAACR,OAAO,EAAEd,gBAAgB,CAAC,CAAC;IAEpE,MAAMuB,OAAO,GAAGR,MAAGA,CAAC,CAACD,OAAO,CAACA,OAAO,CAAC;IACrC,IAAIA,OAAO,KAAKS,OAAO,EAAE;MACvBJ,SAAS,GAAG,KAAK;MACjB;IACF;IACAL,OAAO,GAAGS,OAAO;EACnB;EAEA,OAAO;IAAEpB,QAAQ;IAAEe,WAAW;IAAED,GAAG;IAAEE;EAAU,CAAC;AAClD;AAAC","ignoreList":[]}
|
||||
220
platform/web/node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
220
platform/web/node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
@@ -1,220 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.loadPlugin = loadPlugin;
|
||||
exports.loadPreset = loadPreset;
|
||||
exports.resolvePreset = exports.resolvePlugin = void 0;
|
||||
function _debug() {
|
||||
const data = require("debug");
|
||||
_debug = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _async = require("../../gensync-utils/async.js");
|
||||
var _moduleTypes = require("./module-types.js");
|
||||
function _url() {
|
||||
const data = require("url");
|
||||
_url = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _importMetaResolve = require("../../vendor/import-meta-resolve.js");
|
||||
require("module");
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
const debug = _debug()("babel:config:loading:files:plugins");
|
||||
const EXACT_RE = /^module:/;
|
||||
const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
|
||||
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
|
||||
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
|
||||
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
|
||||
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
|
||||
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
|
||||
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
|
||||
const resolvePlugin = exports.resolvePlugin = resolveStandardizedName.bind(null, "plugin");
|
||||
const resolvePreset = exports.resolvePreset = resolveStandardizedName.bind(null, "preset");
|
||||
function* loadPlugin(name, dirname) {
|
||||
const {
|
||||
filepath,
|
||||
loader
|
||||
} = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
|
||||
const value = yield* requireModule("plugin", loader, filepath);
|
||||
debug("Loaded plugin %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath,
|
||||
value
|
||||
};
|
||||
}
|
||||
function* loadPreset(name, dirname) {
|
||||
const {
|
||||
filepath,
|
||||
loader
|
||||
} = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
|
||||
const value = yield* requireModule("preset", loader, filepath);
|
||||
debug("Loaded preset %o from %o.", name, dirname);
|
||||
return {
|
||||
filepath,
|
||||
value
|
||||
};
|
||||
}
|
||||
function standardizeName(type, name) {
|
||||
if (_path().isAbsolute(name)) return name;
|
||||
const isPreset = type === "preset";
|
||||
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, "");
|
||||
}
|
||||
function* resolveAlternativesHelper(type, name) {
|
||||
const standardizedName = standardizeName(type, name);
|
||||
const {
|
||||
error,
|
||||
value
|
||||
} = yield standardizedName;
|
||||
if (!error) return value;
|
||||
if (error.code !== "MODULE_NOT_FOUND") throw error;
|
||||
if (standardizedName !== name && !(yield name).error) {
|
||||
error.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||
}
|
||||
if (!(yield standardizeName(type, "@babel/" + name)).error) {
|
||||
error.message += `\n- Did you mean "@babel/${name}"?`;
|
||||
}
|
||||
const oppositeType = type === "preset" ? "plugin" : "preset";
|
||||
if (!(yield standardizeName(oppositeType, name)).error) {
|
||||
error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||
}
|
||||
if (type === "plugin") {
|
||||
const transformName = standardizedName.replace("-proposal-", "-transform-");
|
||||
if (transformName !== standardizedName && !(yield transformName).error) {
|
||||
error.message += `\n- Did you mean "${transformName}"?`;
|
||||
}
|
||||
}
|
||||
error.message += `\n
|
||||
Make sure that all the Babel plugins and presets you are using
|
||||
are defined as dependencies or devDependencies in your package.json
|
||||
file. It's possible that the missing plugin is loaded by a preset
|
||||
you are using that forgot to add the plugin to its dependencies: you
|
||||
can workaround this problem by explicitly adding the missing package
|
||||
to your top-level package.json.
|
||||
`;
|
||||
throw error;
|
||||
}
|
||||
function tryRequireResolve(id, dirname) {
|
||||
try {
|
||||
if (dirname) {
|
||||
return {
|
||||
error: null,
|
||||
value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
|
||||
paths: [b]
|
||||
}, M = require("module")) => {
|
||||
let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
|
||||
if (f) return f;
|
||||
f = new Error(`Cannot resolve module '${r}'`);
|
||||
f.code = "MODULE_NOT_FOUND";
|
||||
throw f;
|
||||
})(id, {
|
||||
paths: [dirname]
|
||||
})
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
error: null,
|
||||
value: require.resolve(id)
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
return {
|
||||
error,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
}
|
||||
function tryImportMetaResolve(id, options) {
|
||||
try {
|
||||
return {
|
||||
error: null,
|
||||
value: (0, _importMetaResolve.resolve)(id, options)
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
error,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
}
|
||||
function resolveStandardizedNameForRequire(type, name, dirname) {
|
||||
const it = resolveAlternativesHelper(type, name);
|
||||
let res = it.next();
|
||||
while (!res.done) {
|
||||
res = it.next(tryRequireResolve(res.value, dirname));
|
||||
}
|
||||
return {
|
||||
loader: "require",
|
||||
filepath: res.value
|
||||
};
|
||||
}
|
||||
function resolveStandardizedNameForImport(type, name, dirname) {
|
||||
const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href;
|
||||
const it = resolveAlternativesHelper(type, name);
|
||||
let res = it.next();
|
||||
while (!res.done) {
|
||||
res = it.next(tryImportMetaResolve(res.value, parentUrl));
|
||||
}
|
||||
return {
|
||||
loader: "auto",
|
||||
filepath: (0, _url().fileURLToPath)(res.value)
|
||||
};
|
||||
}
|
||||
function resolveStandardizedName(type, name, dirname, allowAsync) {
|
||||
if (!_moduleTypes.supportsESM || !allowAsync) {
|
||||
return resolveStandardizedNameForRequire(type, name, dirname);
|
||||
}
|
||||
try {
|
||||
const resolved = resolveStandardizedNameForImport(type, name, dirname);
|
||||
if (!(0, _fs().existsSync)(resolved.filepath)) {
|
||||
throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname}.`), {
|
||||
type: "MODULE_NOT_FOUND"
|
||||
});
|
||||
}
|
||||
return resolved;
|
||||
} catch (e) {
|
||||
try {
|
||||
return resolveStandardizedNameForRequire(type, name, dirname);
|
||||
} catch (e2) {
|
||||
if (e.type === "MODULE_NOT_FOUND") throw e;
|
||||
if (e2.type === "MODULE_NOT_FOUND") throw e2;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
var LOADING_MODULES = new Set();
|
||||
function* requireModule(type, loader, name) {
|
||||
if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) {
|
||||
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
||||
}
|
||||
try {
|
||||
LOADING_MODULES.add(name);
|
||||
return yield* (0, _moduleTypes.default)(name, loader, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", `You appear to be using a ${type} that contains top-level await, ` + "which is only supported when running Babel asynchronously.", true);
|
||||
} catch (err) {
|
||||
err.message = `[BABEL]: ${err.message} (While processing: ${name})`;
|
||||
throw err;
|
||||
} finally {
|
||||
LOADING_MODULES.delete(name);
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=plugins.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/plugins.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/plugins.js.map
generated
vendored
File diff suppressed because one or more lines are too long
5
platform/web/node_modules/@babel/core/lib/config/files/types.js
generated
vendored
5
platform/web/node_modules/@babel/core/lib/config/files/types.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/types.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/types.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":[],"sources":["../../../src/config/files/types.ts"],"sourcesContent":["import type { InputOptions } from \"../index.ts\";\n\nexport type ConfigFile = {\n filepath: string;\n dirname: string;\n options: InputOptions & { babel?: unknown };\n};\n\nexport type IgnoreFile = {\n filepath: string;\n dirname: string;\n ignore: RegExp[];\n};\n\nexport type RelativeConfig = {\n // The actual config, either from package.json#babel, .babelrc, or\n // .babelrc.js, if there was one.\n config: ConfigFile | null;\n // The .babelignore, if there was one.\n ignore: IgnoreFile | null;\n};\n\nexport type FilePackageData = {\n // The file in the package.\n filepath: string;\n // Any ancestor directories of the file that are within the package.\n directories: string[];\n // The contents of the package.json. May not be found if the package just\n // terminated at a node_modules folder without finding one.\n pkg: ConfigFile | null;\n // True if a package.json or node_modules folder was found while traversing\n // the directory structure.\n isPackage: boolean;\n};\n"],"mappings":"","ignoreList":[]}
|
||||
36
platform/web/node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
36
platform/web/node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
@@ -1,36 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeStaticFileCache = makeStaticFileCache;
|
||||
var _caching = require("../caching.js");
|
||||
var fs = require("../../gensync-utils/fs.js");
|
||||
function _fs2() {
|
||||
const data = require("fs");
|
||||
_fs2 = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function makeStaticFileCache(fn) {
|
||||
return (0, _caching.makeStrongCache)(function* (filepath, cache) {
|
||||
const cached = cache.invalidate(() => fileMtime(filepath));
|
||||
if (cached === null) {
|
||||
return null;
|
||||
}
|
||||
return fn(filepath, yield* fs.readFile(filepath, "utf8"));
|
||||
});
|
||||
}
|
||||
function fileMtime(filepath) {
|
||||
if (!_fs2().existsSync(filepath)) return null;
|
||||
try {
|
||||
return +_fs2().statSync(filepath).mtime;
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/files/utils.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/files/utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["_caching","require","fs","_fs2","data","makeStaticFileCache","fn","makeStrongCache","filepath","cache","cached","invalidate","fileMtime","readFile","nodeFs","existsSync","statSync","mtime","e","code"],"sources":["../../../src/config/files/utils.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { makeStrongCache } from \"../caching.ts\";\nimport type { CacheConfigurator } from \"../caching.ts\";\nimport * as fs from \"../../gensync-utils/fs.ts\";\nimport nodeFs from \"node:fs\";\n\nexport function makeStaticFileCache<T>(\n fn: (filepath: string, contents: string) => T,\n) {\n return makeStrongCache(function* (\n filepath: string,\n cache: CacheConfigurator<void>,\n ): Handler<null | T> {\n const cached = cache.invalidate(() => fileMtime(filepath));\n\n if (cached === null) {\n return null;\n }\n\n return fn(filepath, yield* fs.readFile(filepath, \"utf8\"));\n });\n}\n\nfunction fileMtime(filepath: string): number | null {\n if (!nodeFs.existsSync(filepath)) return null;\n\n try {\n return +nodeFs.statSync(filepath).mtime;\n } catch (e) {\n if (e.code !== \"ENOENT\" && e.code !== \"ENOTDIR\") throw e;\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,EAAA,GAAAD,OAAA;AACA,SAAAE,KAAA;EAAA,MAAAC,IAAA,GAAAH,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASC,mBAAmBA,CACjCC,EAA6C,EAC7C;EACA,OAAO,IAAAC,wBAAe,EAAC,WACrBC,QAAgB,EAChBC,KAA8B,EACX;IACnB,MAAMC,MAAM,GAAGD,KAAK,CAACE,UAAU,CAAC,MAAMC,SAAS,CAACJ,QAAQ,CAAC,CAAC;IAE1D,IAAIE,MAAM,KAAK,IAAI,EAAE;MACnB,OAAO,IAAI;IACb;IAEA,OAAOJ,EAAE,CAACE,QAAQ,EAAE,OAAON,EAAE,CAACW,QAAQ,CAACL,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC3D,CAAC,CAAC;AACJ;AAEA,SAASI,SAASA,CAACJ,QAAgB,EAAiB;EAClD,IAAI,CAACM,KAAKA,CAAC,CAACC,UAAU,CAACP,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE7C,IAAI;IACF,OAAO,CAACM,KAAKA,CAAC,CAACE,QAAQ,CAACR,QAAQ,CAAC,CAACS,KAAK;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,IAAIA,CAAC,CAACC,IAAI,KAAK,QAAQ,IAAID,CAAC,CAACC,IAAI,KAAK,SAAS,EAAE,MAAMD,CAAC;EAC1D;EAEA,OAAO,IAAI;AACb;AAAC","ignoreList":[]}
|
||||
312
platform/web/node_modules/@babel/core/lib/config/full.js
generated
vendored
312
platform/web/node_modules/@babel/core/lib/config/full.js
generated
vendored
@@ -1,312 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _async = require("../gensync-utils/async.js");
|
||||
var _util = require("./util.js");
|
||||
var context = require("../index.js");
|
||||
var _plugin = require("./plugin.js");
|
||||
var _item = require("./item.js");
|
||||
var _configChain = require("./config-chain.js");
|
||||
var _deepArray = require("./helpers/deep-array.js");
|
||||
function _traverse() {
|
||||
const data = require("@babel/traverse");
|
||||
_traverse = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _caching = require("./caching.js");
|
||||
var _options = require("./validation/options.js");
|
||||
var _plugins = require("./validation/plugins.js");
|
||||
var _configApi = require("./helpers/config-api.js");
|
||||
var _partial = require("./partial.js");
|
||||
var _configError = require("../errors/config-error.js");
|
||||
var _default = exports.default = _gensync()(function* loadFullConfig(inputOpts) {
|
||||
var _opts$assumptions;
|
||||
const result = yield* (0, _partial.default)(inputOpts);
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
const {
|
||||
options,
|
||||
context,
|
||||
fileHandling
|
||||
} = result;
|
||||
if (fileHandling === "ignored") {
|
||||
return null;
|
||||
}
|
||||
const optionDefaults = {};
|
||||
const {
|
||||
plugins,
|
||||
presets
|
||||
} = options;
|
||||
if (!plugins || !presets) {
|
||||
throw new Error("Assertion failure - plugins and presets exist");
|
||||
}
|
||||
const presetContext = Object.assign({}, context, {
|
||||
targets: options.targets
|
||||
});
|
||||
const toDescriptor = item => {
|
||||
const desc = (0, _item.getItemDescriptor)(item);
|
||||
if (!desc) {
|
||||
throw new Error("Assertion failure - must be config item");
|
||||
}
|
||||
return desc;
|
||||
};
|
||||
const presetsDescriptors = presets.map(toDescriptor);
|
||||
const initialPluginsDescriptors = plugins.map(toDescriptor);
|
||||
const pluginDescriptorsByPass = [[]];
|
||||
const passes = [];
|
||||
const externalDependencies = [];
|
||||
const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) {
|
||||
const presets = [];
|
||||
for (let i = 0; i < rawPresets.length; i++) {
|
||||
const descriptor = rawPresets[i];
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
var preset = yield* loadPresetDescriptor(descriptor, presetContext);
|
||||
} catch (e) {
|
||||
if (e.code === "BABEL_UNKNOWN_OPTION") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
externalDependencies.push(preset.externalDependencies);
|
||||
if (descriptor.ownPass) {
|
||||
presets.push({
|
||||
preset: preset.chain,
|
||||
pass: []
|
||||
});
|
||||
} else {
|
||||
presets.unshift({
|
||||
preset: preset.chain,
|
||||
pass: pluginDescriptorsPass
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (presets.length > 0) {
|
||||
pluginDescriptorsByPass.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass));
|
||||
for (const {
|
||||
preset,
|
||||
pass
|
||||
} of presets) {
|
||||
if (!preset) return true;
|
||||
pass.push(...preset.plugins);
|
||||
const ignored = yield* recursePresetDescriptors(preset.presets, pass);
|
||||
if (ignored) return true;
|
||||
preset.options.forEach(opts => {
|
||||
(0, _util.mergeOptions)(optionDefaults, opts);
|
||||
});
|
||||
}
|
||||
}
|
||||
})(presetsDescriptors, pluginDescriptorsByPass[0]);
|
||||
if (ignored) return null;
|
||||
const opts = optionDefaults;
|
||||
(0, _util.mergeOptions)(opts, options);
|
||||
const pluginContext = Object.assign({}, presetContext, {
|
||||
assumptions: (_opts$assumptions = opts.assumptions) != null ? _opts$assumptions : {}
|
||||
});
|
||||
yield* enhanceError(context, function* loadPluginDescriptors() {
|
||||
pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);
|
||||
for (const descs of pluginDescriptorsByPass) {
|
||||
const pass = [];
|
||||
passes.push(pass);
|
||||
for (let i = 0; i < descs.length; i++) {
|
||||
const descriptor = descs[i];
|
||||
if (descriptor.options !== false) {
|
||||
try {
|
||||
var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);
|
||||
} catch (e) {
|
||||
if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
|
||||
(0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
pass.push(plugin);
|
||||
externalDependencies.push(plugin.externalDependencies);
|
||||
}
|
||||
}
|
||||
}
|
||||
})();
|
||||
opts.plugins = passes[0];
|
||||
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
|
||||
plugins
|
||||
}));
|
||||
opts.passPerPreset = opts.presets.length > 0;
|
||||
return {
|
||||
options: opts,
|
||||
passes: passes,
|
||||
externalDependencies: (0, _deepArray.finalize)(externalDependencies)
|
||||
};
|
||||
});
|
||||
function enhanceError(context, fn) {
|
||||
return function* (arg1, arg2) {
|
||||
try {
|
||||
return yield* fn(arg1, arg2);
|
||||
} catch (e) {
|
||||
if (!e.message.startsWith("[BABEL]")) {
|
||||
var _context$filename;
|
||||
e.message = `[BABEL] ${(_context$filename = context.filename) != null ? _context$filename : "unknown file"}: ${e.message}`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
}
|
||||
const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
alias
|
||||
}, cache) {
|
||||
if (options === false) throw new Error("Assertion failure");
|
||||
options = options || {};
|
||||
const externalDependencies = [];
|
||||
let item = value;
|
||||
if (typeof value === "function") {
|
||||
const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
|
||||
const api = Object.assign({}, context, apiFactory(cache, externalDependencies));
|
||||
try {
|
||||
item = yield* factory(api, options, dirname);
|
||||
} catch (e) {
|
||||
if (alias) {
|
||||
e.message += ` (While processing: ${JSON.stringify(alias)})`;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
if (!item || typeof item !== "object") {
|
||||
throw new Error("Plugin/Preset did not return an object.");
|
||||
}
|
||||
if ((0, _async.isThenable)(item)) {
|
||||
yield* [];
|
||||
throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`);
|
||||
}
|
||||
if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) {
|
||||
let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `;
|
||||
if (!cache.configured()) {
|
||||
error += `has not been configured to be invalidated when the external dependencies change. `;
|
||||
} else {
|
||||
error += ` has been configured to never be invalidated. `;
|
||||
}
|
||||
error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`;
|
||||
throw new Error(error);
|
||||
}
|
||||
return {
|
||||
value: item,
|
||||
options,
|
||||
dirname,
|
||||
alias,
|
||||
externalDependencies: (0, _deepArray.finalize)(externalDependencies)
|
||||
};
|
||||
});
|
||||
const pluginDescriptorLoader = makeDescriptorLoader(_configApi.makePluginAPI);
|
||||
const presetDescriptorLoader = makeDescriptorLoader(_configApi.makePresetAPI);
|
||||
const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
||||
value,
|
||||
options,
|
||||
dirname,
|
||||
alias,
|
||||
externalDependencies
|
||||
}, cache) {
|
||||
const pluginObj = (0, _plugins.validatePluginObject)(value);
|
||||
const plugin = Object.assign({}, pluginObj);
|
||||
if (plugin.visitor) {
|
||||
plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor));
|
||||
}
|
||||
if (plugin.inherits) {
|
||||
const inheritsDescriptor = {
|
||||
name: undefined,
|
||||
alias: `${alias}$inherits`,
|
||||
value: plugin.inherits,
|
||||
options,
|
||||
dirname
|
||||
};
|
||||
const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => {
|
||||
return cache.invalidate(data => run(inheritsDescriptor, data));
|
||||
});
|
||||
plugin.pre = chainMaybeAsync(inherits.pre, plugin.pre);
|
||||
plugin.post = chainMaybeAsync(inherits.post, plugin.post);
|
||||
plugin.manipulateOptions = chainMaybeAsync(inherits.manipulateOptions, plugin.manipulateOptions);
|
||||
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
|
||||
if (inherits.externalDependencies.length > 0) {
|
||||
if (externalDependencies.length === 0) {
|
||||
externalDependencies = inherits.externalDependencies;
|
||||
} else {
|
||||
externalDependencies = (0, _deepArray.finalize)([externalDependencies, inherits.externalDependencies]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return new _plugin.default(plugin, options, alias, externalDependencies);
|
||||
});
|
||||
function* loadPluginDescriptor(descriptor, context) {
|
||||
if (descriptor.value instanceof _plugin.default) {
|
||||
if (descriptor.options) {
|
||||
throw new Error("Passed options to an existing Plugin instance will not work.");
|
||||
}
|
||||
return descriptor.value;
|
||||
}
|
||||
return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context);
|
||||
}
|
||||
const needsFilename = val => val && typeof val !== "function";
|
||||
const validateIfOptionNeedsFilename = (options, descriptor) => {
|
||||
if (needsFilename(options.test) || needsFilename(options.include) || needsFilename(options.exclude)) {
|
||||
const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
|
||||
throw new _configError.default([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
|
||||
}
|
||||
};
|
||||
const validatePreset = (preset, context, descriptor) => {
|
||||
if (!context.filename) {
|
||||
var _options$overrides;
|
||||
const {
|
||||
options
|
||||
} = preset;
|
||||
validateIfOptionNeedsFilename(options, descriptor);
|
||||
(_options$overrides = options.overrides) == null || _options$overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor));
|
||||
}
|
||||
};
|
||||
const instantiatePreset = (0, _caching.makeWeakCacheSync)(({
|
||||
value,
|
||||
dirname,
|
||||
alias,
|
||||
externalDependencies
|
||||
}) => {
|
||||
return {
|
||||
options: (0, _options.validate)("preset", value),
|
||||
alias,
|
||||
dirname,
|
||||
externalDependencies
|
||||
};
|
||||
});
|
||||
function* loadPresetDescriptor(descriptor, context) {
|
||||
const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context));
|
||||
validatePreset(preset, context, descriptor);
|
||||
return {
|
||||
chain: yield* (0, _configChain.buildPresetChain)(preset, context),
|
||||
externalDependencies: preset.externalDependencies
|
||||
};
|
||||
}
|
||||
function chainMaybeAsync(a, b) {
|
||||
if (!a) return b;
|
||||
if (!b) return a;
|
||||
return function (...args) {
|
||||
const res = a.apply(this, args);
|
||||
if (res && typeof res.then === "function") {
|
||||
return res.then(() => b.apply(this, args));
|
||||
}
|
||||
return b.apply(this, args);
|
||||
};
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=full.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/full.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/full.js.map
generated
vendored
File diff suppressed because one or more lines are too long
85
platform/web/node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
85
platform/web/node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
@@ -1,85 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.makeConfigAPI = makeConfigAPI;
|
||||
exports.makePluginAPI = makePluginAPI;
|
||||
exports.makePresetAPI = makePresetAPI;
|
||||
function _semver() {
|
||||
const data = require("semver");
|
||||
_semver = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _index = require("../../index.js");
|
||||
var _caching = require("../caching.js");
|
||||
function makeConfigAPI(cache) {
|
||||
const env = value => cache.using(data => {
|
||||
if (value === undefined) return data.envName;
|
||||
if (typeof value === "function") {
|
||||
return (0, _caching.assertSimpleType)(value(data.envName));
|
||||
}
|
||||
return (Array.isArray(value) ? value : [value]).some(entry => {
|
||||
if (typeof entry !== "string") {
|
||||
throw new Error("Unexpected non-string value");
|
||||
}
|
||||
return entry === data.envName;
|
||||
});
|
||||
});
|
||||
const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller)));
|
||||
return {
|
||||
version: _index.version,
|
||||
cache: cache.simple(),
|
||||
env,
|
||||
async: () => false,
|
||||
caller,
|
||||
assertVersion
|
||||
};
|
||||
}
|
||||
function makePresetAPI(cache, externalDependencies) {
|
||||
const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets)));
|
||||
const addExternalDependency = ref => {
|
||||
externalDependencies.push(ref);
|
||||
};
|
||||
return Object.assign({}, makeConfigAPI(cache), {
|
||||
targets,
|
||||
addExternalDependency
|
||||
});
|
||||
}
|
||||
function makePluginAPI(cache, externalDependencies) {
|
||||
const assumption = name => cache.using(data => data.assumptions[name]);
|
||||
return Object.assign({}, makePresetAPI(cache, externalDependencies), {
|
||||
assumption
|
||||
});
|
||||
}
|
||||
function assertVersion(range) {
|
||||
if (typeof range === "number") {
|
||||
if (!Number.isInteger(range)) {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
range = `^${range}.0.0-0`;
|
||||
}
|
||||
if (typeof range !== "string") {
|
||||
throw new Error("Expected string or integer value.");
|
||||
}
|
||||
if (range === "*" || _semver().satisfies(_index.version, range)) return;
|
||||
const message = `Requires Babel "${range}", but was loaded with "${_index.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`;
|
||||
const limit = Error.stackTraceLimit;
|
||||
if (typeof limit === "number" && limit < 25) {
|
||||
Error.stackTraceLimit = 25;
|
||||
}
|
||||
const err = new Error(message);
|
||||
if (typeof limit === "number") {
|
||||
Error.stackTraceLimit = limit;
|
||||
}
|
||||
throw Object.assign(err, {
|
||||
code: "BABEL_VERSION_UNSUPPORTED",
|
||||
version: _index.version,
|
||||
range
|
||||
});
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=config-api.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/helpers/config-api.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/helpers/config-api.js.map
generated
vendored
File diff suppressed because one or more lines are too long
23
platform/web/node_modules/@babel/core/lib/config/helpers/deep-array.js
generated
vendored
23
platform/web/node_modules/@babel/core/lib/config/helpers/deep-array.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.finalize = finalize;
|
||||
exports.flattenToSet = flattenToSet;
|
||||
function finalize(deepArr) {
|
||||
return Object.freeze(deepArr);
|
||||
}
|
||||
function flattenToSet(arr) {
|
||||
const result = new Set();
|
||||
const stack = [arr];
|
||||
while (stack.length > 0) {
|
||||
for (const el of stack.pop()) {
|
||||
if (Array.isArray(el)) stack.push(el);else result.add(el);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=deep-array.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/helpers/deep-array.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/helpers/deep-array.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["finalize","deepArr","Object","freeze","flattenToSet","arr","result","Set","stack","length","el","pop","Array","isArray","push","add"],"sources":["../../../src/config/helpers/deep-array.ts"],"sourcesContent":["export type DeepArray<T> = (T | ReadonlyDeepArray<T>)[];\n\n// Just to make sure that DeepArray<T> is not assignable to ReadonlyDeepArray<T>\ndeclare const __marker: unique symbol;\nexport type ReadonlyDeepArray<T> = readonly (T | ReadonlyDeepArray<T>)[] & {\n [__marker]: true;\n};\n\nexport function finalize<T>(deepArr: DeepArray<T>): ReadonlyDeepArray<T> {\n return Object.freeze(deepArr) as ReadonlyDeepArray<T>;\n}\n\nexport function flattenToSet<T extends string>(\n arr: ReadonlyDeepArray<T>,\n): Set<T> {\n const result = new Set<T>();\n const stack = [arr];\n while (stack.length > 0) {\n for (const el of stack.pop()) {\n if (Array.isArray(el)) stack.push(el as ReadonlyDeepArray<T>);\n else result.add(el as T);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;AAQO,SAASA,QAAQA,CAAIC,OAAqB,EAAwB;EACvE,OAAOC,MAAM,CAACC,MAAM,CAACF,OAAO,CAAC;AAC/B;AAEO,SAASG,YAAYA,CAC1BC,GAAyB,EACjB;EACR,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAI,CAAC;EAC3B,MAAMC,KAAK,GAAG,CAACH,GAAG,CAAC;EACnB,OAAOG,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IACvB,KAAK,MAAMC,EAAE,IAAIF,KAAK,CAACG,GAAG,CAAC,CAAC,EAAE;MAC5B,IAAIC,KAAK,CAACC,OAAO,CAACH,EAAE,CAAC,EAAEF,KAAK,CAACM,IAAI,CAACJ,EAA0B,CAAC,CAAC,KACzDJ,MAAM,CAACS,GAAG,CAACL,EAAO,CAAC;IAC1B;EACF;EACA,OAAOJ,MAAM;AACf;AAAC","ignoreList":[]}
|
||||
12
platform/web/node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
12
platform/web/node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getEnv = getEnv;
|
||||
function getEnv(defaultValue = "development") {
|
||||
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=environment.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/helpers/environment.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/helpers/environment.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"names":["getEnv","defaultValue","process","env","BABEL_ENV","NODE_ENV"],"sources":["../../../src/config/helpers/environment.ts"],"sourcesContent":["export function getEnv(defaultValue: string = \"development\"): string {\n return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;\n}\n"],"mappings":";;;;;;AAAO,SAASA,MAAMA,CAACC,YAAoB,GAAG,aAAa,EAAU;EACnE,OAAOC,OAAO,CAACC,GAAG,CAACC,SAAS,IAAIF,OAAO,CAACC,GAAG,CAACE,QAAQ,IAAIJ,YAAY;AACtE;AAAC","ignoreList":[]}
|
||||
87
platform/web/node_modules/@babel/core/lib/config/index.js
generated
vendored
87
platform/web/node_modules/@babel/core/lib/config/index.js
generated
vendored
@@ -1,87 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createConfigItem = createConfigItem;
|
||||
exports.createConfigItemAsync = createConfigItemAsync;
|
||||
exports.createConfigItemSync = createConfigItemSync;
|
||||
Object.defineProperty(exports, "default", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _full.default;
|
||||
}
|
||||
});
|
||||
exports.loadOptions = loadOptions;
|
||||
exports.loadOptionsAsync = loadOptionsAsync;
|
||||
exports.loadOptionsSync = loadOptionsSync;
|
||||
exports.loadPartialConfig = loadPartialConfig;
|
||||
exports.loadPartialConfigAsync = loadPartialConfigAsync;
|
||||
exports.loadPartialConfigSync = loadPartialConfigSync;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _full = require("./full.js");
|
||||
var _partial = require("./partial.js");
|
||||
var _item = require("./item.js");
|
||||
var _rewriteStackTrace = require("../errors/rewrite-stack-trace.js");
|
||||
const loadPartialConfigRunner = _gensync()(_partial.loadPartialConfig);
|
||||
function loadPartialConfigAsync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.async)(...args);
|
||||
}
|
||||
function loadPartialConfigSync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.sync)(...args);
|
||||
}
|
||||
function loadPartialConfig(opts, callback) {
|
||||
if (callback !== undefined) {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(opts, callback);
|
||||
} else if (typeof opts === "function") {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadPartialConfigRunner.errback)(undefined, opts);
|
||||
} else {
|
||||
return loadPartialConfigSync(opts);
|
||||
}
|
||||
}
|
||||
function* loadOptionsImpl(opts) {
|
||||
var _config$options;
|
||||
const config = yield* (0, _full.default)(opts);
|
||||
return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
|
||||
}
|
||||
const loadOptionsRunner = _gensync()(loadOptionsImpl);
|
||||
function loadOptionsAsync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.async)(...args);
|
||||
}
|
||||
function loadOptionsSync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.sync)(...args);
|
||||
}
|
||||
function loadOptions(opts, callback) {
|
||||
if (callback !== undefined) {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(opts, callback);
|
||||
} else if (typeof opts === "function") {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(loadOptionsRunner.errback)(undefined, opts);
|
||||
} else {
|
||||
return loadOptionsSync(opts);
|
||||
}
|
||||
}
|
||||
const createConfigItemRunner = _gensync()(_item.createConfigItem);
|
||||
function createConfigItemAsync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.async)(...args);
|
||||
}
|
||||
function createConfigItemSync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.sync)(...args);
|
||||
}
|
||||
function createConfigItem(target, options, callback) {
|
||||
if (callback !== undefined) {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, options, callback);
|
||||
} else if (typeof options === "function") {
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(createConfigItemRunner.errback)(target, undefined, callback);
|
||||
} else {
|
||||
return createConfigItemSync(target, options);
|
||||
}
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
platform/web/node_modules/@babel/core/lib/config/index.js.map
generated
vendored
1
platform/web/node_modules/@babel/core/lib/config/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
67
platform/web/node_modules/@babel/core/lib/config/item.js
generated
vendored
67
platform/web/node_modules/@babel/core/lib/config/item.js
generated
vendored
@@ -1,67 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createConfigItem = createConfigItem;
|
||||
exports.createItemFromDescriptor = createItemFromDescriptor;
|
||||
exports.getItemDescriptor = getItemDescriptor;
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _configDescriptors = require("./config-descriptors.js");
|
||||
function createItemFromDescriptor(desc) {
|
||||
return new ConfigItem(desc);
|
||||
}
|
||||
function* createConfigItem(value, {
|
||||
dirname = ".",
|
||||
type
|
||||
} = {}) {
|
||||
const descriptor = yield* (0, _configDescriptors.createDescriptor)(value, _path().resolve(dirname), {
|
||||
type,
|
||||
alias: "programmatic item"
|
||||
});
|
||||
return createItemFromDescriptor(descriptor);
|
||||
}
|
||||
const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem");
|
||||
function getItemDescriptor(item) {
|
||||
if (item != null && item[CONFIG_ITEM_BRAND]) {
|
||||
return item._descriptor;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
class ConfigItem {
|
||||
constructor(descriptor) {
|
||||
this._descriptor = void 0;
|
||||
this[CONFIG_ITEM_BRAND] = true;
|
||||
this.value = void 0;
|
||||
this.options = void 0;
|
||||
this.dirname = void 0;
|
||||
this.name = void 0;
|
||||
this.file = void 0;
|
||||
this._descriptor = descriptor;
|
||||
Object.defineProperty(this, "_descriptor", {
|
||||
enumerable: false
|
||||
});
|
||||
Object.defineProperty(this, CONFIG_ITEM_BRAND, {
|
||||
enumerable: false
|
||||
});
|
||||
this.value = this._descriptor.value;
|
||||
this.options = this._descriptor.options;
|
||||
this.dirname = this._descriptor.dirname;
|
||||
this.name = this._descriptor.name;
|
||||
this.file = this._descriptor.file ? {
|
||||
request: this._descriptor.file.request,
|
||||
resolved: this._descriptor.file.resolved
|
||||
} : undefined;
|
||||
Object.freeze(this);
|
||||
}
|
||||
}
|
||||
Object.freeze(ConfigItem.prototype);
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=item.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user