ci: 统一测试入口 scripts/ci.mjs(协议/用户管理/单测/双设备/实时链路/构建/依赖审计)+ Gitea Actions 工作流
This commit is contained in:
@@ -0,0 +1,51 @@
|
|||||||
|
# CI:每次推送自动运行完整测试套件(本地与云端同一入口:node scripts/ci.mjs)
|
||||||
|
# 首次启用需要在 Gitea 服务器上:
|
||||||
|
# 1) 管理后台开启 Actions
|
||||||
|
# 2) 部署 act_runner(docker compose 服务,见 server/DEPLOY.md)
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: 测试套件(协议/用户管理/单测/双设备/实时链路/构建)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: node:22-bookworm
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装 pnpm
|
||||||
|
run: npm install -g pnpm@11
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
working-directory: intern-log
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: 运行测试与构建
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
run: node scripts/ci.mjs
|
||||||
|
|
||||||
|
audit:
|
||||||
|
name: 依赖漏洞扫描(软性检查)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: node:22-bookworm
|
||||||
|
continue-on-error: true
|
||||||
|
steps:
|
||||||
|
- name: 检出代码
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装 pnpm
|
||||||
|
run: npm install -g pnpm@11
|
||||||
|
|
||||||
|
- name: 安装依赖
|
||||||
|
working-directory: intern-log
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: pnpm audit(高危及以上)
|
||||||
|
working-directory: intern-log
|
||||||
|
run: pnpm audit --prod --audit-level=high
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
allowBuilds:
|
allowBuilds:
|
||||||
esbuild: true
|
esbuild: true
|
||||||
electron: true
|
electron: true
|
||||||
|
|
||||||
|
# 允许执行安装脚本的依赖(esbuild 需要准备平台二进制)
|
||||||
|
onlyBuiltDependencies:
|
||||||
|
- esbuild
|
||||||
|
- electron
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
// 纯函数单元测试:日期库 / 考勤计算 / 加解密(node:test 运行器,esbuild 打包后执行)
|
||||||
|
import test from 'node:test'
|
||||||
|
import assert from 'node:assert/strict'
|
||||||
|
|
||||||
|
import { addDays, addMonths, hhmm, isWeekend, nowLocalISO, parseDateStr, toDateStr, tsMinutes, weekStart, formatDateCN } from '../src/lib/date'
|
||||||
|
import { computeDay } from '../src/domain/attendance'
|
||||||
|
import { aesGcmDecrypt, aesGcmEncrypt, deriveKeyFromPassword, pbkdf2Hash, randomSaltB64 } from '../src/lib/crypto'
|
||||||
|
|
||||||
|
const RULE = { work_start: '09:00', work_end: '18:00', grace_minutes: 10, lunch_minutes: 60, remind_weekly: 'friday' }
|
||||||
|
function rec(kind: string, inAt: string | null, outAt: string | null) {
|
||||||
|
return { date: inAt ? inAt.slice(0, 10) : '2025-01-02', kind, clock_in_at: inAt, clock_out_at: outAt, note: null, location: null, created_at: '2025-01-02T00:00:00' } as never
|
||||||
|
}
|
||||||
|
|
||||||
|
test('日期库:addDays 跨月与闰年', () => {
|
||||||
|
assert.equal(addDays('2025-01-31', 1), '2025-02-01')
|
||||||
|
assert.equal(addDays('2024-02-28', 1), '2024-02-29') // 闰年
|
||||||
|
assert.equal(addDays('2023-02-28', 1), '2023-03-01') // 平年
|
||||||
|
assert.equal(addDays('2025-03-01', -1), '2025-02-28')
|
||||||
|
assert.equal(addDays('2024-12-31', 1), '2025-01-01')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('日期库:addMonths 日期截断(1-31 加一个月)', () => {
|
||||||
|
assert.equal(addMonths('2025-01-31', 1), '2025-02-28')
|
||||||
|
assert.equal(addMonths('2024-01-31', 1), '2024-02-29')
|
||||||
|
assert.equal(addMonths('2025-01-15', 1), '2025-02-15')
|
||||||
|
assert.equal(addMonths('2025-11-30', 2), '2026-01-30')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('日期库:weekStart 以周一为一周开始', () => {
|
||||||
|
assert.equal(weekStart('2025-01-05'), '2024-12-30') // 周日
|
||||||
|
assert.equal(weekStart('2025-01-06'), '2025-01-06') // 周一
|
||||||
|
assert.equal(weekStart('2025-01-12'), '2025-01-06') // 周日
|
||||||
|
assert.equal(weekStart('2025-01-08'), '2025-01-06') // 周中
|
||||||
|
})
|
||||||
|
|
||||||
|
test('日期库:isWeekend 与格式化', () => {
|
||||||
|
assert.equal(isWeekend('2025-01-04'), true)
|
||||||
|
assert.equal(isWeekend('2025-01-05'), true)
|
||||||
|
assert.equal(isWeekend('2025-01-06'), false)
|
||||||
|
assert.equal(hhmm('2025-01-02T09:05:00'), '09:05')
|
||||||
|
assert.equal(hhmm(null), '--:--')
|
||||||
|
assert.match(nowLocalISO(), /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/)
|
||||||
|
assert.equal(formatDateCN('2025-01-06'), '2025 年 1 月 6 日 周一')
|
||||||
|
assert.equal(toDateStr(parseDateStr('2025-02-27')), '2025-02-27')
|
||||||
|
assert.equal(tsMinutes('2025-01-02T09:00:00', '2025-01-02T18:00:00'), 540)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('考勤:正常/迟到/早退/宽限边界', () => {
|
||||||
|
const day = '2025-01-02' // 周四
|
||||||
|
const normal = computeDay(rec('normal', day + 'T09:00:00', day + 'T18:00:00'), day, RULE, false)
|
||||||
|
assert.equal(normal.status, 'normal')
|
||||||
|
assert.equal(normal.label, '正常')
|
||||||
|
assert.equal(normal.workedMinutes, 480) // 9 小时 - 1 小时午休
|
||||||
|
// 宽限边界:09:10 恰好等于上班时间+10 分钟 → 不算迟到
|
||||||
|
const edge = computeDay(rec('normal', day + 'T09:10:00', day + 'T18:00:00'), day, RULE, false)
|
||||||
|
assert.equal(edge.status, 'normal')
|
||||||
|
// 迟到:09:11
|
||||||
|
const late = computeDay(rec('normal', day + 'T09:11:00', day + 'T18:00:00'), day, RULE, false)
|
||||||
|
assert.equal(late.status, 'late')
|
||||||
|
// 早退:17:29 下班
|
||||||
|
const early = computeDay(rec('normal', day + 'T09:00:00', day + 'T17:29:00'), day, RULE, false)
|
||||||
|
assert.equal(early.status, 'early')
|
||||||
|
// 补卡不判迟到早退
|
||||||
|
const makeup = computeDay(rec('makeup', day + 'T10:30:00', day + 'T17:00:00'), day, RULE, false)
|
||||||
|
assert.equal(makeup.status, 'normal')
|
||||||
|
assert.equal(makeup.label, '补卡')
|
||||||
|
assert.equal(makeup.makeup, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('考勤:进行中/未完成/缺勤/未打卡', () => {
|
||||||
|
const day = '2025-01-02'
|
||||||
|
const running = computeDay(rec('normal', day + 'T09:00:00', null), day, RULE, true)
|
||||||
|
assert.equal(running.status, 'incomplete')
|
||||||
|
assert.equal(running.label, '进行中')
|
||||||
|
const unfinished = computeDay(rec('normal', day + 'T09:00:00', null), day, RULE, false)
|
||||||
|
assert.equal(unfinished.status, 'incomplete')
|
||||||
|
assert.equal(unfinished.label, '未完成')
|
||||||
|
const absent = computeDay(undefined, day, RULE, false)
|
||||||
|
assert.equal(absent.status, 'absent')
|
||||||
|
const none = computeDay(undefined, day, RULE, true)
|
||||||
|
assert.equal(none.status, 'none')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('考勤:休假与休息日', () => {
|
||||||
|
const saturday = '2025-01-04'
|
||||||
|
const leave = computeDay(rec('leave', '2025-01-02T09:00:00', '2025-01-02T18:00:00'), '2025-01-02', RULE, false)
|
||||||
|
assert.equal(leave.status, 'leave')
|
||||||
|
assert.equal(leave.label, '请假')
|
||||||
|
// 休息日:即使有打卡记录也显示休息日(当前产品行为,锁定语义)
|
||||||
|
const rest = computeDay(rec('normal', saturday + 'T10:00:00', saturday + 'T18:00:00'), saturday, RULE, false)
|
||||||
|
assert.equal(rest.status, 'rest')
|
||||||
|
assert.equal(rest.label, '休息日')
|
||||||
|
// 休息日无记录
|
||||||
|
const restEmpty = computeDay(undefined, saturday, RULE, false)
|
||||||
|
assert.equal(restEmpty.status, 'rest')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('考勤:异常时长不出现负数', () => {
|
||||||
|
const bad = computeDay(rec('normal', '2025-01-02T18:00:00', '2025-01-02T09:00:00'), '2025-01-02', RULE, false)
|
||||||
|
assert.equal(bad.workedMinutes, 0)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('加密:哈希确定性、加盐、AES-GCM 往返', async () => {
|
||||||
|
// 盐必须是合法 base64(与 randomSaltB64 的产出格式一致)
|
||||||
|
const saltA = Buffer.from('salt-a').toString('base64')
|
||||||
|
const saltB = Buffer.from('salt-b').toString('base64')
|
||||||
|
const h1 = await pbkdf2Hash('密码abc123', saltA)
|
||||||
|
const h2 = await pbkdf2Hash('密码abc123', saltA)
|
||||||
|
const h3 = await pbkdf2Hash('密码abc123', saltB)
|
||||||
|
const h4 = await pbkdf2Hash('密码abc124', saltA)
|
||||||
|
assert.equal(h1, h2)
|
||||||
|
assert.notEqual(h1, h3)
|
||||||
|
assert.notEqual(h1, h4)
|
||||||
|
assert.equal(Buffer.from(h1, 'base64').length, 32)
|
||||||
|
|
||||||
|
const salt = randomSaltB64()
|
||||||
|
assert.equal(Buffer.from(salt, 'base64').length, 16)
|
||||||
|
|
||||||
|
const key = await deriveKeyFromPassword('主密码!@#', salt)
|
||||||
|
const enc = await aesGcmEncrypt(key, '机密内容:服务器管理员密码')
|
||||||
|
assert.notEqual(enc, '机密内容:服务器管理员密码')
|
||||||
|
assert.equal(await aesGcmDecrypt(key, enc), '机密内容:服务器管理员密码')
|
||||||
|
|
||||||
|
const otherKey = await deriveKeyFromPassword('错误主密码', salt)
|
||||||
|
await assert.rejects(() => aesGcmDecrypt(otherKey, enc))
|
||||||
|
})
|
||||||
@@ -2,7 +2,7 @@ import type { Attendance } from '../db/schema'
|
|||||||
import type { WorkRule } from '../db/repo'
|
import type { WorkRule } from '../db/repo'
|
||||||
import { hhmm, isWeekend, tsMinutes } from '../lib/date'
|
import { hhmm, isWeekend, tsMinutes } from '../lib/date'
|
||||||
|
|
||||||
export type DayStatus = 'normal' | 'late' | 'early' | 'incomplete' | 'absent' | 'none' | 'rest'
|
export type DayStatus = 'normal' | 'late' | 'early' | 'incomplete' | 'absent' | 'none' | 'rest' | 'leave'
|
||||||
|
|
||||||
export interface DayAttendanceInfo {
|
export interface DayAttendanceInfo {
|
||||||
status: DayStatus
|
status: DayStatus
|
||||||
|
|||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
basedir_win="$basedir"
|
||||||
|
exe=""
|
||||||
|
msys=""
|
||||||
|
|
||||||
|
case `uname -a` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir_win=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
exe=".exe"
|
||||||
|
msys="true"
|
||||||
|
;;
|
||||||
|
*WSL2*)
|
||||||
|
if command -v wslpath > /dev/null 2>&1; then
|
||||||
|
basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
|
||||||
|
if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
|
||||||
|
basedir_win="$basedir"
|
||||||
|
else
|
||||||
|
exe=".exe"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$NODE_PATH" ]; then
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
else
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules:$NODE_PATH"
|
||||||
|
fi
|
||||||
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
||||||
|
exec "$basedir/node.exe" "$basedir_win/../esbuild/bin/esbuild" "$@"
|
||||||
|
elif [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@"
|
||||||
|
elif command -v node >/dev/null 2>&1; then
|
||||||
|
exec node "$basedir/../esbuild/bin/esbuild" "$@"
|
||||||
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
||||||
|
exec node.exe "$basedir_win/../esbuild/bin/esbuild" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../esbuild/bin/esbuild" "$@"
|
||||||
|
fi
|
||||||
|
# cmd-shim-target=C:/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/esbuild/bin/esbuild
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@SETLOCAL
|
||||||
|
@IF NOT DEFINED NODE_PATH (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
) ELSE (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
||||||
|
)
|
||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\esbuild\bin\esbuild" %*
|
||||||
|
) ELSE (
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\esbuild\bin\esbuild" %*
|
||||||
|
)
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
$pathsep=":"
|
||||||
|
$env_node_path=$env:NODE_PATH
|
||||||
|
$new_node_path="C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
$pathsep=";"
|
||||||
|
} else {
|
||||||
|
$new_node_path="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
}
|
||||||
|
if ([string]::IsNullOrEmpty($env_node_path)) {
|
||||||
|
$env:NODE_PATH=$new_node_path
|
||||||
|
} else {
|
||||||
|
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../esbuild/bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
$env:NODE_PATH=$env_node_path
|
||||||
|
exit $ret
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"hoistedDependencies": {
|
||||||
|
"@esbuild/win32-x64@0.21.5": {
|
||||||
|
"@esbuild/win32-x64": "private"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"hoistPattern": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"included": {
|
||||||
|
"dependencies": true,
|
||||||
|
"devDependencies": true,
|
||||||
|
"optionalDependencies": true
|
||||||
|
},
|
||||||
|
"injectedDeps": {},
|
||||||
|
"ignoredBuilds": [
|
||||||
|
"esbuild@0.21.5"
|
||||||
|
],
|
||||||
|
"layoutVersion": 5,
|
||||||
|
"nodeLinker": "isolated",
|
||||||
|
"packageManager": "pnpm@11.18.0",
|
||||||
|
"pendingBuilds": [],
|
||||||
|
"publicHoistPattern": [],
|
||||||
|
"prunedAt": "Fri, 16 Oct 2026 12:59:09 GMT",
|
||||||
|
"registries": {
|
||||||
|
"default": "https://registry.npmjs.org/",
|
||||||
|
"@jsr": "https://npm.jsr.io/"
|
||||||
|
},
|
||||||
|
"skipped": [
|
||||||
|
"@esbuild/aix-ppc64@0.21.5",
|
||||||
|
"@esbuild/android-arm64@0.21.5",
|
||||||
|
"@esbuild/android-arm@0.21.5",
|
||||||
|
"@esbuild/android-x64@0.21.5",
|
||||||
|
"@esbuild/darwin-arm64@0.21.5",
|
||||||
|
"@esbuild/darwin-x64@0.21.5",
|
||||||
|
"@esbuild/freebsd-arm64@0.21.5",
|
||||||
|
"@esbuild/freebsd-x64@0.21.5",
|
||||||
|
"@esbuild/linux-arm64@0.21.5",
|
||||||
|
"@esbuild/linux-arm@0.21.5",
|
||||||
|
"@esbuild/linux-ia32@0.21.5",
|
||||||
|
"@esbuild/linux-loong64@0.21.5",
|
||||||
|
"@esbuild/linux-mips64el@0.21.5",
|
||||||
|
"@esbuild/linux-ppc64@0.21.5",
|
||||||
|
"@esbuild/linux-riscv64@0.21.5",
|
||||||
|
"@esbuild/linux-s390x@0.21.5",
|
||||||
|
"@esbuild/linux-x64@0.21.5",
|
||||||
|
"@esbuild/netbsd-x64@0.21.5",
|
||||||
|
"@esbuild/openbsd-x64@0.21.5",
|
||||||
|
"@esbuild/sunos-x64@0.21.5",
|
||||||
|
"@esbuild/win32-arm64@0.21.5",
|
||||||
|
"@esbuild/win32-ia32@0.21.5"
|
||||||
|
],
|
||||||
|
"storeDir": "C:\\Users\\Administrator\\AppData\\Local\\pnpm\\store\\v11",
|
||||||
|
"virtualStoreDir": "C:\\Users\\Administrator\\Documents\\deepseek-harness\\daywork\\node_modules\\.pnpm",
|
||||||
|
"virtualStoreDirMaxLength": 60,
|
||||||
|
"allowBuilds": {
|
||||||
|
"esbuild": "set this to true or false"
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
File diff suppressed because one or more lines are too long
+29
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"lastValidatedTimestamp": 1792155549585,
|
||||||
|
"projects": {},
|
||||||
|
"pnpmfiles": [],
|
||||||
|
"settings": {
|
||||||
|
"autoInstallPeers": true,
|
||||||
|
"dedupeDirectDeps": false,
|
||||||
|
"dedupeInjectedDeps": true,
|
||||||
|
"dedupePeerDependents": true,
|
||||||
|
"dedupePeers": false,
|
||||||
|
"dev": true,
|
||||||
|
"excludeLinksFromLockfile": false,
|
||||||
|
"hoistPattern": [
|
||||||
|
"*"
|
||||||
|
],
|
||||||
|
"hoistWorkspacePackages": true,
|
||||||
|
"injectWorkspacePackages": false,
|
||||||
|
"linkWorkspacePackages": false,
|
||||||
|
"minimumReleaseAge": 1440,
|
||||||
|
"minimumReleaseAgeIgnoreMissingTime": true,
|
||||||
|
"nodeLinker": "isolated",
|
||||||
|
"optional": true,
|
||||||
|
"peersSuffixMaxLength": 1000,
|
||||||
|
"preferWorkspacePackages": false,
|
||||||
|
"production": true,
|
||||||
|
"publicHoistPattern": []
|
||||||
|
},
|
||||||
|
"filteredInstall": false
|
||||||
|
}
|
||||||
Generated
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
Generated
Vendored
BIN
Binary file not shown.
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@esbuild/win32-x64",
|
||||||
|
"version": "0.21.5",
|
||||||
|
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
BIN
Binary file not shown.
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@esbuild/win32-x64",
|
||||||
|
"version": "0.21.5",
|
||||||
|
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Evan Wallace
|
||||||
|
|
||||||
|
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.
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||||
+220
@@ -0,0 +1,220 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||||
|
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
||||||
|
var packageDarwin_x64 = "@esbuild/darwin-x64";
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||||
|
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||||
|
"win32 x64 LE": "@esbuild/win32-x64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||||
|
"android arm64 LE": "@esbuild/android-arm64",
|
||||||
|
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||||
|
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||||
|
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||||
|
"linux arm LE": "@esbuild/linux-arm",
|
||||||
|
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||||
|
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||||
|
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||||
|
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||||
|
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||||
|
"linux s390x BE": "@esbuild/linux-s390x",
|
||||||
|
"linux x64 LE": "@esbuild/linux-x64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||||
|
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||||
|
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "@esbuild/android-x64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM2 = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM2 = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
function pkgForSomeOtherPlatform() {
|
||||||
|
const libMainJS = require.resolve("esbuild");
|
||||||
|
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
||||||
|
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
||||||
|
for (const unixKey in knownUnixlikePackages) {
|
||||||
|
try {
|
||||||
|
const pkg = knownUnixlikePackages[unixKey];
|
||||||
|
if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const windowsKey in knownWindowsPackages) {
|
||||||
|
try {
|
||||||
|
const pkg = knownWindowsPackages[windowsKey];
|
||||||
|
if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
function generateBinPath() {
|
||||||
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||||
|
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
|
||||||
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||||
|
} else {
|
||||||
|
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath2;
|
||||||
|
try {
|
||||||
|
binPath2 = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
binPath2 = downloadedBinPath(pkg, subpath);
|
||||||
|
if (!fs.existsSync(binPath2)) {
|
||||||
|
try {
|
||||||
|
require.resolve(pkg);
|
||||||
|
} catch {
|
||||||
|
const otherPkg = pkgForSomeOtherPlatform();
|
||||||
|
if (otherPkg) {
|
||||||
|
let suggestions = `
|
||||||
|
Specifically the "${otherPkg}" package is present but this platform
|
||||||
|
needs the "${pkg}" package instead. People often get into this
|
||||||
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
||||||
|
into a Docker image that runs Linux, or by copying "node_modules" between
|
||||||
|
Windows and WSL environments.
|
||||||
|
|
||||||
|
If you are installing with npm, you can try not copying the "node_modules"
|
||||||
|
directory when you copy the files over, and running "npm ci" or "npm install"
|
||||||
|
on the destination platform after the copy. Or you could consider using yarn
|
||||||
|
instead of npm which has built-in support for installing a package on multiple
|
||||||
|
platforms simultaneously.
|
||||||
|
|
||||||
|
If you are installing with yarn, you can try listing both this platform and the
|
||||||
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
||||||
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||||
|
Keep in mind that this means multiple copies of esbuild will be present.
|
||||||
|
`;
|
||||||
|
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
||||||
|
suggestions = `
|
||||||
|
Specifically the "${otherPkg}" package is present but this platform
|
||||||
|
needs the "${pkg}" package instead. People often get into this
|
||||||
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
||||||
|
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
||||||
|
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
||||||
|
|
||||||
|
If you are installing with npm, you can try ensuring that both npm and node are
|
||||||
|
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
||||||
|
changing how you installed npm and/or node. For example, installing node with
|
||||||
|
the universal installer here should work: https://nodejs.org/en/download/. Or
|
||||||
|
you could consider using yarn instead of npm which has built-in support for
|
||||||
|
installing a package on multiple platforms simultaneously.
|
||||||
|
|
||||||
|
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
||||||
|
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
||||||
|
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||||
|
Keep in mind that this means multiple copies of esbuild will be present.
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
throw new Error(`
|
||||||
|
You installed esbuild for another platform than the one you're currently using.
|
||||||
|
This won't work because esbuild is written with native code and needs to
|
||||||
|
install a platform-specific binary executable.
|
||||||
|
${suggestions}
|
||||||
|
Another alternative is to use the "esbuild-wasm" package instead, which works
|
||||||
|
the same way on all platforms. But it comes with a heavy performance cost and
|
||||||
|
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
||||||
|
want to do that.
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
||||||
|
|
||||||
|
If you are installing esbuild with npm, make sure that you don't specify the
|
||||||
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
||||||
|
of "package.json" is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform.`);
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (/\.zip\//.test(binPath2)) {
|
||||||
|
let pnpapi;
|
||||||
|
try {
|
||||||
|
pnpapi = require("pnpapi");
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
if (pnpapi) {
|
||||||
|
const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
||||||
|
const binTargetPath = path.join(
|
||||||
|
root,
|
||||||
|
"node_modules",
|
||||||
|
".cache",
|
||||||
|
"esbuild",
|
||||||
|
`pnpapi-${pkg.replace("/", "-")}-${"0.21.5"}-${path.basename(subpath)}`
|
||||||
|
);
|
||||||
|
if (!fs.existsSync(binTargetPath)) {
|
||||||
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
||||||
|
fs.copyFileSync(binPath2, binTargetPath);
|
||||||
|
fs.chmodSync(binTargetPath, 493);
|
||||||
|
}
|
||||||
|
return { binPath: binTargetPath, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { binPath: binPath2, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-shim.ts
|
||||||
|
var { binPath, isWASM } = generateBinPath();
|
||||||
|
if (isWASM) {
|
||||||
|
require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
|
||||||
|
} else {
|
||||||
|
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
||||||
|
}
|
||||||
+285
@@ -0,0 +1,285 @@
|
|||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||||
|
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||||
|
"win32 x64 LE": "@esbuild/win32-x64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||||
|
"android arm64 LE": "@esbuild/android-arm64",
|
||||||
|
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||||
|
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||||
|
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||||
|
"linux arm LE": "@esbuild/linux-arm",
|
||||||
|
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||||
|
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||||
|
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||||
|
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||||
|
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||||
|
"linux s390x BE": "@esbuild/linux-s390x",
|
||||||
|
"linux x64 LE": "@esbuild/linux-x64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||||
|
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||||
|
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "@esbuild/android-x64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM };
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-install.ts
|
||||||
|
var fs2 = require("fs");
|
||||||
|
var os2 = require("os");
|
||||||
|
var path2 = require("path");
|
||||||
|
var zlib = require("zlib");
|
||||||
|
var https = require("https");
|
||||||
|
var child_process = require("child_process");
|
||||||
|
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
||||||
|
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||||
|
var isToPathJS = true;
|
||||||
|
function validateBinaryVersion(...command) {
|
||||||
|
command.push("--version");
|
||||||
|
let stdout;
|
||||||
|
try {
|
||||||
|
stdout = child_process.execFileSync(command.shift(), command, {
|
||||||
|
// Without this, this install script strangely crashes with the error
|
||||||
|
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
||||||
|
// installed from the Snap Store. This is not a problem when you download
|
||||||
|
// the official version of node. The problem appears to be that stderr
|
||||||
|
// (i.e. file descriptor 2) isn't writable?
|
||||||
|
//
|
||||||
|
// More info:
|
||||||
|
// - https://snapcraft.io/ (what the Snap Store is)
|
||||||
|
// - https://nodejs.org/dist/ (download the official version of node)
|
||||||
|
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
||||||
|
//
|
||||||
|
stdio: "pipe"
|
||||||
|
}).toString().trim();
|
||||||
|
} catch (err) {
|
||||||
|
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
||||||
|
let os3 = "this version of macOS";
|
||||||
|
try {
|
||||||
|
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
||||||
|
|
||||||
|
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
||||||
|
which means the "esbuild" binary executable can't be run. You can either:
|
||||||
|
|
||||||
|
* Update your version of macOS to one that the Go compiler supports
|
||||||
|
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
||||||
|
* Build esbuild yourself using an older version of the Go compiler
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (stdout !== versionFromPackageJSON) {
|
||||||
|
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isYarn() {
|
||||||
|
const { npm_config_user_agent } = process.env;
|
||||||
|
if (npm_config_user_agent) {
|
||||||
|
return /\byarn\//.test(npm_config_user_agent);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function fetch(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||||
|
return fetch(res.headers.location).then(resolve, reject);
|
||||||
|
if (res.statusCode !== 200)
|
||||||
|
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||||
|
let chunks = [];
|
||||||
|
res.on("data", (chunk) => chunks.push(chunk));
|
||||||
|
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||||
|
}).on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractFileFromTarGzip(buffer, subpath) {
|
||||||
|
try {
|
||||||
|
buffer = zlib.unzipSync(buffer);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||||
|
}
|
||||||
|
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||||
|
let offset = 0;
|
||||||
|
subpath = `package/${subpath}`;
|
||||||
|
while (offset < buffer.length) {
|
||||||
|
let name = str(offset, 100);
|
||||||
|
let size = parseInt(str(offset + 124, 12), 8);
|
||||||
|
offset += 512;
|
||||||
|
if (!isNaN(size)) {
|
||||||
|
if (name === subpath) return buffer.subarray(offset, offset + size);
|
||||||
|
offset += size + 511 & ~511;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||||
|
}
|
||||||
|
function installUsingNPM(pkg, subpath, binPath) {
|
||||||
|
const env = { ...process.env, npm_config_global: void 0 };
|
||||||
|
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||||
|
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||||
|
fs2.mkdirSync(installDir);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||||
|
child_process.execSync(
|
||||||
|
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
|
||||||
|
{ cwd: installDir, stdio: "pipe", env }
|
||||||
|
);
|
||||||
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||||
|
fs2.renameSync(installedBinPath, binPath);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
removeRecursive(installDir);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function removeRecursive(dir) {
|
||||||
|
for (const entry of fs2.readdirSync(dir)) {
|
||||||
|
const entryPath = path2.join(dir, entry);
|
||||||
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = fs2.lstatSync(entryPath);
|
||||||
|
} catch {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stats.isDirectory()) removeRecursive(entryPath);
|
||||||
|
else fs2.unlinkSync(entryPath);
|
||||||
|
}
|
||||||
|
fs2.rmdirSync(dir);
|
||||||
|
}
|
||||||
|
function applyManualBinaryPathOverride(overridePath) {
|
||||||
|
const pathString = JSON.stringify(overridePath);
|
||||||
|
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||||
|
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||||
|
`);
|
||||||
|
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||||
|
const code = fs2.readFileSync(libMain, "utf8");
|
||||||
|
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||||
|
${code}`);
|
||||||
|
}
|
||||||
|
function maybeOptimizePackage(binPath) {
|
||||||
|
if (os2.platform() !== "win32" && !isYarn()) {
|
||||||
|
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||||
|
try {
|
||||||
|
fs2.linkSync(binPath, tempPath);
|
||||||
|
fs2.renameSync(tempPath, toPath);
|
||||||
|
isToPathJS = false;
|
||||||
|
fs2.unlinkSync(tempPath);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||||
|
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
|
||||||
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||||
|
fs2.chmodSync(binPath, 493);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function checkAndPreparePackage() {
|
||||||
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||||
|
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
||||||
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||||
|
} else {
|
||||||
|
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath;
|
||||||
|
try {
|
||||||
|
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||||
|
|
||||||
|
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||||
|
package.json feature is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform. This install script will now attempt to work around
|
||||||
|
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||||
|
`);
|
||||||
|
binPath = downloadedBinPath(pkg, subpath);
|
||||||
|
try {
|
||||||
|
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||||
|
installUsingNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e2) {
|
||||||
|
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||||
|
try {
|
||||||
|
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e3) {
|
||||||
|
throw new Error(`Failed to install package "${pkg}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybeOptimizePackage(binPath);
|
||||||
|
}
|
||||||
|
checkAndPreparePackage().then(() => {
|
||||||
|
if (isToPathJS) {
|
||||||
|
validateBinaryVersion(process.execPath, toPath);
|
||||||
|
} else {
|
||||||
|
validateBinaryVersion(toPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
+705
@@ -0,0 +1,705 @@
|
|||||||
|
export type Platform = 'browser' | 'node' | 'neutral'
|
||||||
|
export type Format = 'iife' | 'cjs' | 'esm'
|
||||||
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||||
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
||||||
|
export type Charset = 'ascii' | 'utf8'
|
||||||
|
export type Drop = 'console' | 'debugger'
|
||||||
|
|
||||||
|
interface CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||||
|
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||||
|
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||||
|
sourceRoot?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||||
|
sourcesContent?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#format */
|
||||||
|
format?: Format
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||||
|
globalName?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#target */
|
||||||
|
target?: string | string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||||
|
supported?: Record<string, boolean>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||||
|
platform?: Platform
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
reserveProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleQuoted?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleCache?: Record<string, string | false>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||||
|
drop?: Drop[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
||||||
|
dropLabels?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minify?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyWhitespace?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyIdentifiers?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifySyntax?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
||||||
|
lineLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||||
|
charset?: Charset
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||||
|
treeShaking?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||||
|
ignoreAnnotations?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||||
|
jsx?: 'transform' | 'preserve' | 'automatic'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||||
|
jsxFactory?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||||
|
jsxFragment?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||||
|
jsxImportSource?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||||
|
jsxDev?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||||
|
jsxSideEffects?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#define */
|
||||||
|
define?: { [key: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||||
|
pure?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||||
|
keepNames?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#color */
|
||||||
|
color?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||||
|
logLevel?: LogLevel
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||||
|
logLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||||
|
logOverride?: Record<string, LogLevel>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||||
|
tsconfigRaw?: string | TsconfigRaw
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TsconfigRaw {
|
||||||
|
compilerOptions?: {
|
||||||
|
alwaysStrict?: boolean
|
||||||
|
baseUrl?: string
|
||||||
|
experimentalDecorators?: boolean
|
||||||
|
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||||
|
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||||
|
jsxFactory?: string
|
||||||
|
jsxFragmentFactory?: string
|
||||||
|
jsxImportSource?: string
|
||||||
|
paths?: Record<string, string[]>
|
||||||
|
preserveValueImports?: boolean
|
||||||
|
strict?: boolean
|
||||||
|
target?: string
|
||||||
|
useDefineForClassFields?: boolean
|
||||||
|
verbatimModuleSyntax?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||||
|
bundle?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||||
|
splitting?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||||
|
preserveSymlinks?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||||
|
outfile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
metafile?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||||
|
outdir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||||
|
outbase?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#external */
|
||||||
|
external?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#packages */
|
||||||
|
packages?: 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||||
|
alias?: Record<string, string>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: { [ext: string]: Loader }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||||
|
resolveExtensions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||||
|
mainFields?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||||
|
conditions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#write */
|
||||||
|
write?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||||
|
allowOverwrite?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||||
|
tsconfig?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||||
|
outExtension?: { [ext: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||||
|
publicPath?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||||
|
entryNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||||
|
chunkNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||||
|
assetNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||||
|
inject?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||||
|
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||||
|
stdin?: StdinOptions
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||||
|
plugins?: Plugin[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||||
|
absWorkingDir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||||
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StdinOptions {
|
||||||
|
contents: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
sourcefile?: string
|
||||||
|
loader?: Loader
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: string
|
||||||
|
pluginName: string
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
notes: Note[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional user-specified data that is passed through unmodified. You can
|
||||||
|
* use this to stash the original error, for example.
|
||||||
|
*/
|
||||||
|
detail: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Note {
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Location {
|
||||||
|
file: string
|
||||||
|
namespace: string
|
||||||
|
/** 1-based */
|
||||||
|
line: number
|
||||||
|
/** 0-based, in bytes */
|
||||||
|
column: number
|
||||||
|
/** in bytes */
|
||||||
|
length: number
|
||||||
|
lineText: string
|
||||||
|
suggestion: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OutputFile {
|
||||||
|
path: string
|
||||||
|
contents: Uint8Array
|
||||||
|
hash: string
|
||||||
|
/** "contents" as text (changes automatically with "contents") */
|
||||||
|
readonly text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "write: false" */
|
||||||
|
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||||
|
/** Only when "metafile: true" */
|
||||||
|
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||||
|
export interface ServeOptions {
|
||||||
|
port?: number
|
||||||
|
host?: string
|
||||||
|
servedir?: string
|
||||||
|
keyfile?: string
|
||||||
|
certfile?: string
|
||||||
|
fallback?: string
|
||||||
|
onRequest?: (args: ServeOnRequestArgs) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServeOnRequestArgs {
|
||||||
|
remoteAddress: string
|
||||||
|
method: string
|
||||||
|
path: string
|
||||||
|
status: number
|
||||||
|
/** The time to generate the response, not to send it */
|
||||||
|
timeInMS: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||||
|
export interface ServeResult {
|
||||||
|
port: number
|
||||||
|
host: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||||
|
sourcefile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: Loader
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||||
|
code: string
|
||||||
|
map: string
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
/** Only when "legalComments" is "external" */
|
||||||
|
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Plugin {
|
||||||
|
name: string
|
||||||
|
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginBuild {
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||||
|
initialOptions: BuildOptions
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||||
|
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||||
|
onStart(callback: () =>
|
||||||
|
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||||
|
onEnd(callback: (result: BuildResult) =>
|
||||||
|
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||||
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||||
|
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||||
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||||
|
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||||
|
onDispose(callback: () => void): void
|
||||||
|
|
||||||
|
// This is a full copy of the esbuild library in case you need it
|
||||||
|
esbuild: {
|
||||||
|
context: typeof context,
|
||||||
|
build: typeof build,
|
||||||
|
buildSync: typeof buildSync,
|
||||||
|
transform: typeof transform,
|
||||||
|
transformSync: typeof transformSync,
|
||||||
|
formatMessages: typeof formatMessages,
|
||||||
|
formatMessagesSync: typeof formatMessagesSync,
|
||||||
|
analyzeMetafile: typeof analyzeMetafile,
|
||||||
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||||
|
initialize: typeof initialize,
|
||||||
|
version: typeof version,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||||
|
export interface ResolveOptions {
|
||||||
|
pluginName?: string
|
||||||
|
importer?: string
|
||||||
|
namespace?: string
|
||||||
|
resolveDir?: string
|
||||||
|
kind?: ImportKind
|
||||||
|
pluginData?: any
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||||
|
export interface ResolveResult {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
|
||||||
|
path: string
|
||||||
|
external: boolean
|
||||||
|
sideEffects: boolean
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnStartResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnEndResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||||
|
export interface OnResolveOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||||
|
export interface OnResolveArgs {
|
||||||
|
path: string
|
||||||
|
importer: string
|
||||||
|
namespace: string
|
||||||
|
resolveDir: string
|
||||||
|
kind: ImportKind
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ImportKind =
|
||||||
|
| 'entry-point'
|
||||||
|
|
||||||
|
// JS
|
||||||
|
| 'import-statement'
|
||||||
|
| 'require-call'
|
||||||
|
| 'dynamic-import'
|
||||||
|
| 'require-resolve'
|
||||||
|
|
||||||
|
// CSS
|
||||||
|
| 'import-rule'
|
||||||
|
| 'composes-from'
|
||||||
|
| 'url-token'
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||||
|
export interface OnResolveResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
path?: string
|
||||||
|
external?: boolean
|
||||||
|
sideEffects?: boolean
|
||||||
|
namespace?: string
|
||||||
|
suffix?: string
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||||
|
export interface OnLoadOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||||
|
export interface OnLoadArgs {
|
||||||
|
path: string
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||||
|
export interface OnLoadResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
contents?: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
loader?: Loader
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialMessage {
|
||||||
|
id?: string
|
||||||
|
pluginName?: string
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
notes?: PartialNote[]
|
||||||
|
detail?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialNote {
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
export interface Metafile {
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind
|
||||||
|
external?: boolean
|
||||||
|
original?: string
|
||||||
|
with?: Record<string, string>
|
||||||
|
}[]
|
||||||
|
format?: 'cjs' | 'esm'
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytesInOutput: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind | 'file-loader'
|
||||||
|
external?: boolean
|
||||||
|
}[]
|
||||||
|
exports: string[]
|
||||||
|
entryPoint?: string
|
||||||
|
cssBundle?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormatMessagesOptions {
|
||||||
|
kind: 'error' | 'warning'
|
||||||
|
color?: boolean
|
||||||
|
terminalWidth?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnalyzeMetafileOptions {
|
||||||
|
color?: boolean
|
||||||
|
verbose?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||||
|
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||||
|
watch(options?: WatchOptions): Promise<void>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||||
|
serve(options?: ServeOptions): Promise<ServeResult>
|
||||||
|
|
||||||
|
cancel(): Promise<void>
|
||||||
|
dispose(): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||||
|
// that aren't in "Out" with "never". We use this to reject properties with
|
||||||
|
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||||
|
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||||
|
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||||
|
* "BuildFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the advanced long-running form of "build" that supports additional
|
||||||
|
* features such as watch mode and a local development server.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function transforms a single JavaScript file. It can be used to minify
|
||||||
|
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||||
|
* to older JavaScript. It returns a promise that is either resolved with a
|
||||||
|
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts log messages to formatted message strings suitable for printing in
|
||||||
|
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||||
|
* log message formatter. This is a batch-oriented API for efficiency.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*/
|
||||||
|
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||||
|
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||||
|
* to customize it, you can just inspect the data in the metafile yourself.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "build".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "transform".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "formatMessages".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*/
|
||||||
|
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "analyzeMetafile".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configures the browser-based version of esbuild. It is necessary to
|
||||||
|
* call this first and wait for the returned promise to be resolved before
|
||||||
|
* making other API calls when using esbuild in the browser.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes ("options" is required)
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#browser
|
||||||
|
*/
|
||||||
|
export declare function initialize(options: InitializeOptions): Promise<void>
|
||||||
|
|
||||||
|
export interface InitializeOptions {
|
||||||
|
/**
|
||||||
|
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||||
|
* esbuild in the browser.
|
||||||
|
*/
|
||||||
|
wasmURL?: string | URL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||||
|
* is a typed array or ArrayBuffer containing the binary code of the
|
||||||
|
* "esbuild.wasm" file.
|
||||||
|
*
|
||||||
|
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||||
|
* not possible to download the WebAssembly module.
|
||||||
|
*/
|
||||||
|
wasmModule?: WebAssembly.Module
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||||
|
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||||
|
* to false.
|
||||||
|
*/
|
||||||
|
worker?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export let version: string
|
||||||
|
|
||||||
|
// Call this function to terminate esbuild's child process. The child process
|
||||||
|
// is not terminated and re-created after each API call because it's more
|
||||||
|
// efficient to keep it around when there are multiple API calls.
|
||||||
|
//
|
||||||
|
// In node this happens automatically before the parent node process exits. So
|
||||||
|
// you only need to call this if you know you will not make any more esbuild
|
||||||
|
// API calls and you want to clean up resources.
|
||||||
|
//
|
||||||
|
// Unlike node, Deno lacks the necessary APIs to clean up child processes
|
||||||
|
// automatically. You must manually call stop() in Deno when you're done
|
||||||
|
// using esbuild or Deno will continue running forever.
|
||||||
|
//
|
||||||
|
// Another reason you might want to call this is if you are using esbuild from
|
||||||
|
// within a Deno test. Deno fails tests that create a child process without
|
||||||
|
// killing it before the test ends, so you have to call this function (and
|
||||||
|
// await the returned promise) in every Deno test that uses esbuild.
|
||||||
|
export declare function stop(): Promise<void>
|
||||||
|
|
||||||
|
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
||||||
|
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
||||||
|
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
||||||
|
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
||||||
|
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
||||||
|
// these scenarios.
|
||||||
|
//
|
||||||
|
// There's an open issue about getting this problem corrected (although these
|
||||||
|
// declarations will need to remain even if this is fixed for backward
|
||||||
|
// compatibility with older TypeScript versions):
|
||||||
|
//
|
||||||
|
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
||||||
|
//
|
||||||
|
declare global {
|
||||||
|
namespace WebAssembly {
|
||||||
|
interface Module {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interface URL {
|
||||||
|
}
|
||||||
|
}
|
||||||
+2239
File diff suppressed because it is too large
Load Diff
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
basedir_win="$basedir"
|
||||||
|
exe=""
|
||||||
|
msys=""
|
||||||
|
|
||||||
|
case `uname -a` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir_win=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
exe=".exe"
|
||||||
|
msys="true"
|
||||||
|
;;
|
||||||
|
*WSL2*)
|
||||||
|
if command -v wslpath > /dev/null 2>&1; then
|
||||||
|
basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
|
||||||
|
if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
|
||||||
|
basedir_win="$basedir"
|
||||||
|
else
|
||||||
|
exe=".exe"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$NODE_PATH" ]; then
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
else
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules:$NODE_PATH"
|
||||||
|
fi
|
||||||
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
||||||
|
exec "$basedir/node.exe" "$basedir_win/../../bin/esbuild" "$@"
|
||||||
|
elif [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../../bin/esbuild" "$@"
|
||||||
|
elif command -v node >/dev/null 2>&1; then
|
||||||
|
exec node "$basedir/../../bin/esbuild" "$@"
|
||||||
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
||||||
|
exec node.exe "$basedir_win/../../bin/esbuild" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../../bin/esbuild" "$@"
|
||||||
|
fi
|
||||||
|
# cmd-shim-target=C:/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/bin/esbuild
|
||||||
Generated
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@SETLOCAL
|
||||||
|
@IF NOT DEFINED NODE_PATH (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
) ELSE (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
||||||
|
)
|
||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\..\bin\esbuild" %*
|
||||||
|
) ELSE (
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\..\bin\esbuild" %*
|
||||||
|
)
|
||||||
Generated
Vendored
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
$pathsep=":"
|
||||||
|
$env_node_path=$env:NODE_PATH
|
||||||
|
$new_node_path="C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
$pathsep=";"
|
||||||
|
} else {
|
||||||
|
$new_node_path="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
}
|
||||||
|
if ([string]::IsNullOrEmpty($env_node_path)) {
|
||||||
|
$env:NODE_PATH=$new_node_path
|
||||||
|
} else {
|
||||||
|
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
$env:NODE_PATH=$env_node_path
|
||||||
|
exit $ret
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild",
|
||||||
|
"version": "0.21.5",
|
||||||
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "node install.js"
|
||||||
|
},
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"types": "lib/main.d.ts",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/aix-ppc64": "0.21.5",
|
||||||
|
"@esbuild/android-arm": "0.21.5",
|
||||||
|
"@esbuild/android-arm64": "0.21.5",
|
||||||
|
"@esbuild/android-x64": "0.21.5",
|
||||||
|
"@esbuild/darwin-arm64": "0.21.5",
|
||||||
|
"@esbuild/darwin-x64": "0.21.5",
|
||||||
|
"@esbuild/freebsd-arm64": "0.21.5",
|
||||||
|
"@esbuild/freebsd-x64": "0.21.5",
|
||||||
|
"@esbuild/linux-arm": "0.21.5",
|
||||||
|
"@esbuild/linux-arm64": "0.21.5",
|
||||||
|
"@esbuild/linux-ia32": "0.21.5",
|
||||||
|
"@esbuild/linux-loong64": "0.21.5",
|
||||||
|
"@esbuild/linux-mips64el": "0.21.5",
|
||||||
|
"@esbuild/linux-ppc64": "0.21.5",
|
||||||
|
"@esbuild/linux-riscv64": "0.21.5",
|
||||||
|
"@esbuild/linux-s390x": "0.21.5",
|
||||||
|
"@esbuild/linux-x64": "0.21.5",
|
||||||
|
"@esbuild/netbsd-x64": "0.21.5",
|
||||||
|
"@esbuild/openbsd-x64": "0.21.5",
|
||||||
|
"@esbuild/sunos-x64": "0.21.5",
|
||||||
|
"@esbuild/win32-arm64": "0.21.5",
|
||||||
|
"@esbuild/win32-ia32": "0.21.5",
|
||||||
|
"@esbuild/win32-x64": "0.21.5"
|
||||||
|
},
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
+255
@@ -0,0 +1,255 @@
|
|||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
devDependencies:
|
||||||
|
esbuild:
|
||||||
|
specifier: 0.21.5
|
||||||
|
version: 0.21.5
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [aix]
|
||||||
|
|
||||||
|
'@esbuild/android-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/android-arm@0.21.5':
|
||||||
|
resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/android-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/darwin-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@esbuild/darwin-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@esbuild/freebsd-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@esbuild/freebsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@esbuild/linux-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-arm@0.21.5':
|
||||||
|
resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-ia32@0.21.5':
|
||||||
|
resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-loong64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [loong64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-mips64el@0.21.5':
|
||||||
|
resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [mips64el]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-ppc64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-riscv64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-s390x@0.21.5':
|
||||||
|
resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/netbsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [netbsd]
|
||||||
|
|
||||||
|
'@esbuild/openbsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [openbsd]
|
||||||
|
|
||||||
|
'@esbuild/sunos-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [sunos]
|
||||||
|
|
||||||
|
'@esbuild/win32-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@esbuild/win32-ia32@0.21.5':
|
||||||
|
resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@esbuild/win32-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
esbuild@0.21.5:
|
||||||
|
resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-arm@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/darwin-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/darwin-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/freebsd-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/freebsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-arm@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-ia32@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-loong64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-mips64el@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-ppc64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-riscv64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-s390x@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/netbsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/openbsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/sunos-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-ia32@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
esbuild@0.21.5:
|
||||||
|
optionalDependencies:
|
||||||
|
'@esbuild/aix-ppc64': 0.21.5
|
||||||
|
'@esbuild/android-arm': 0.21.5
|
||||||
|
'@esbuild/android-arm64': 0.21.5
|
||||||
|
'@esbuild/android-x64': 0.21.5
|
||||||
|
'@esbuild/darwin-arm64': 0.21.5
|
||||||
|
'@esbuild/darwin-x64': 0.21.5
|
||||||
|
'@esbuild/freebsd-arm64': 0.21.5
|
||||||
|
'@esbuild/freebsd-x64': 0.21.5
|
||||||
|
'@esbuild/linux-arm': 0.21.5
|
||||||
|
'@esbuild/linux-arm64': 0.21.5
|
||||||
|
'@esbuild/linux-ia32': 0.21.5
|
||||||
|
'@esbuild/linux-loong64': 0.21.5
|
||||||
|
'@esbuild/linux-mips64el': 0.21.5
|
||||||
|
'@esbuild/linux-ppc64': 0.21.5
|
||||||
|
'@esbuild/linux-riscv64': 0.21.5
|
||||||
|
'@esbuild/linux-s390x': 0.21.5
|
||||||
|
'@esbuild/linux-x64': 0.21.5
|
||||||
|
'@esbuild/netbsd-x64': 0.21.5
|
||||||
|
'@esbuild/openbsd-x64': 0.21.5
|
||||||
|
'@esbuild/sunos-x64': 0.21.5
|
||||||
|
'@esbuild/win32-arm64': 0.21.5
|
||||||
|
'@esbuild/win32-ia32': 0.21.5
|
||||||
|
'@esbuild/win32-x64': 0.21.5
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||||
BIN
Binary file not shown.
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "@esbuild/win32-x64",
|
||||||
|
"version": "0.21.5",
|
||||||
|
"description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"preferUnplugged": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Evan Wallace
|
||||||
|
|
||||||
|
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.
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
# esbuild
|
||||||
|
|
||||||
|
This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details.
|
||||||
+220
@@ -0,0 +1,220 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||||
|
var packageDarwin_arm64 = "@esbuild/darwin-arm64";
|
||||||
|
var packageDarwin_x64 = "@esbuild/darwin-x64";
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||||
|
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||||
|
"win32 x64 LE": "@esbuild/win32-x64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||||
|
"android arm64 LE": "@esbuild/android-arm64",
|
||||||
|
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||||
|
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||||
|
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||||
|
"linux arm LE": "@esbuild/linux-arm",
|
||||||
|
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||||
|
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||||
|
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||||
|
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||||
|
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||||
|
"linux s390x BE": "@esbuild/linux-s390x",
|
||||||
|
"linux x64 LE": "@esbuild/linux-x64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||||
|
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||||
|
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "@esbuild/android-x64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM2 = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM2 = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
function pkgForSomeOtherPlatform() {
|
||||||
|
const libMainJS = require.resolve("esbuild");
|
||||||
|
const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
|
||||||
|
if (path.basename(nodeModulesDirectory) === "node_modules") {
|
||||||
|
for (const unixKey in knownUnixlikePackages) {
|
||||||
|
try {
|
||||||
|
const pkg = knownUnixlikePackages[unixKey];
|
||||||
|
if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const windowsKey in knownWindowsPackages) {
|
||||||
|
try {
|
||||||
|
const pkg = knownWindowsPackages[windowsKey];
|
||||||
|
if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
function generateBinPath() {
|
||||||
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||||
|
if (!fs.existsSync(ESBUILD_BINARY_PATH)) {
|
||||||
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||||
|
} else {
|
||||||
|
return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath2;
|
||||||
|
try {
|
||||||
|
binPath2 = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
binPath2 = downloadedBinPath(pkg, subpath);
|
||||||
|
if (!fs.existsSync(binPath2)) {
|
||||||
|
try {
|
||||||
|
require.resolve(pkg);
|
||||||
|
} catch {
|
||||||
|
const otherPkg = pkgForSomeOtherPlatform();
|
||||||
|
if (otherPkg) {
|
||||||
|
let suggestions = `
|
||||||
|
Specifically the "${otherPkg}" package is present but this platform
|
||||||
|
needs the "${pkg}" package instead. People often get into this
|
||||||
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
||||||
|
into a Docker image that runs Linux, or by copying "node_modules" between
|
||||||
|
Windows and WSL environments.
|
||||||
|
|
||||||
|
If you are installing with npm, you can try not copying the "node_modules"
|
||||||
|
directory when you copy the files over, and running "npm ci" or "npm install"
|
||||||
|
on the destination platform after the copy. Or you could consider using yarn
|
||||||
|
instead of npm which has built-in support for installing a package on multiple
|
||||||
|
platforms simultaneously.
|
||||||
|
|
||||||
|
If you are installing with yarn, you can try listing both this platform and the
|
||||||
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
||||||
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||||
|
Keep in mind that this means multiple copies of esbuild will be present.
|
||||||
|
`;
|
||||||
|
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
||||||
|
suggestions = `
|
||||||
|
Specifically the "${otherPkg}" package is present but this platform
|
||||||
|
needs the "${pkg}" package instead. People often get into this
|
||||||
|
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
||||||
|
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
||||||
|
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
||||||
|
|
||||||
|
If you are installing with npm, you can try ensuring that both npm and node are
|
||||||
|
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
||||||
|
changing how you installed npm and/or node. For example, installing node with
|
||||||
|
the universal installer here should work: https://nodejs.org/en/download/. Or
|
||||||
|
you could consider using yarn instead of npm which has built-in support for
|
||||||
|
installing a package on multiple platforms simultaneously.
|
||||||
|
|
||||||
|
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
||||||
|
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
||||||
|
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
||||||
|
Keep in mind that this means multiple copies of esbuild will be present.
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
throw new Error(`
|
||||||
|
You installed esbuild for another platform than the one you're currently using.
|
||||||
|
This won't work because esbuild is written with native code and needs to
|
||||||
|
install a platform-specific binary executable.
|
||||||
|
${suggestions}
|
||||||
|
Another alternative is to use the "esbuild-wasm" package instead, which works
|
||||||
|
the same way on all platforms. But it comes with a heavy performance cost and
|
||||||
|
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
||||||
|
want to do that.
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
||||||
|
|
||||||
|
If you are installing esbuild with npm, make sure that you don't specify the
|
||||||
|
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
||||||
|
of "package.json" is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform.`);
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (/\.zip\//.test(binPath2)) {
|
||||||
|
let pnpapi;
|
||||||
|
try {
|
||||||
|
pnpapi = require("pnpapi");
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
if (pnpapi) {
|
||||||
|
const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation;
|
||||||
|
const binTargetPath = path.join(
|
||||||
|
root,
|
||||||
|
"node_modules",
|
||||||
|
".cache",
|
||||||
|
"esbuild",
|
||||||
|
`pnpapi-${pkg.replace("/", "-")}-${"0.21.5"}-${path.basename(subpath)}`
|
||||||
|
);
|
||||||
|
if (!fs.existsSync(binTargetPath)) {
|
||||||
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
||||||
|
fs.copyFileSync(binPath2, binTargetPath);
|
||||||
|
fs.chmodSync(binTargetPath, 493);
|
||||||
|
}
|
||||||
|
return { binPath: binTargetPath, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { binPath: binPath2, isWASM: isWASM2 };
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-shim.ts
|
||||||
|
var { binPath, isWASM } = generateBinPath();
|
||||||
|
if (isWASM) {
|
||||||
|
require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
|
||||||
|
} else {
|
||||||
|
require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
||||||
|
}
|
||||||
+285
@@ -0,0 +1,285 @@
|
|||||||
|
"use strict";
|
||||||
|
var __create = Object.create;
|
||||||
|
var __defProp = Object.defineProperty;
|
||||||
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __getProtoOf = Object.getPrototypeOf;
|
||||||
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||||
|
var __copyProps = (to, from, except, desc) => {
|
||||||
|
if (from && typeof from === "object" || typeof from === "function") {
|
||||||
|
for (let key of __getOwnPropNames(from))
|
||||||
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||||
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||||
|
}
|
||||||
|
return to;
|
||||||
|
};
|
||||||
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||||
|
// If the importer is in node compatibility mode or this is not an ESM
|
||||||
|
// file that has been converted to a CommonJS file using a Babel-
|
||||||
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||||
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||||
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||||
|
mod
|
||||||
|
));
|
||||||
|
|
||||||
|
// lib/npm/node-platform.ts
|
||||||
|
var fs = require("fs");
|
||||||
|
var os = require("os");
|
||||||
|
var path = require("path");
|
||||||
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
||||||
|
var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild";
|
||||||
|
var knownWindowsPackages = {
|
||||||
|
"win32 arm64 LE": "@esbuild/win32-arm64",
|
||||||
|
"win32 ia32 LE": "@esbuild/win32-ia32",
|
||||||
|
"win32 x64 LE": "@esbuild/win32-x64"
|
||||||
|
};
|
||||||
|
var knownUnixlikePackages = {
|
||||||
|
"aix ppc64 BE": "@esbuild/aix-ppc64",
|
||||||
|
"android arm64 LE": "@esbuild/android-arm64",
|
||||||
|
"darwin arm64 LE": "@esbuild/darwin-arm64",
|
||||||
|
"darwin x64 LE": "@esbuild/darwin-x64",
|
||||||
|
"freebsd arm64 LE": "@esbuild/freebsd-arm64",
|
||||||
|
"freebsd x64 LE": "@esbuild/freebsd-x64",
|
||||||
|
"linux arm LE": "@esbuild/linux-arm",
|
||||||
|
"linux arm64 LE": "@esbuild/linux-arm64",
|
||||||
|
"linux ia32 LE": "@esbuild/linux-ia32",
|
||||||
|
"linux mips64el LE": "@esbuild/linux-mips64el",
|
||||||
|
"linux ppc64 LE": "@esbuild/linux-ppc64",
|
||||||
|
"linux riscv64 LE": "@esbuild/linux-riscv64",
|
||||||
|
"linux s390x BE": "@esbuild/linux-s390x",
|
||||||
|
"linux x64 LE": "@esbuild/linux-x64",
|
||||||
|
"linux loong64 LE": "@esbuild/linux-loong64",
|
||||||
|
"netbsd x64 LE": "@esbuild/netbsd-x64",
|
||||||
|
"openbsd x64 LE": "@esbuild/openbsd-x64",
|
||||||
|
"sunos x64 LE": "@esbuild/sunos-x64"
|
||||||
|
};
|
||||||
|
var knownWebAssemblyFallbackPackages = {
|
||||||
|
"android arm LE": "@esbuild/android-arm",
|
||||||
|
"android x64 LE": "@esbuild/android-x64"
|
||||||
|
};
|
||||||
|
function pkgAndSubpathForCurrentPlatform() {
|
||||||
|
let pkg;
|
||||||
|
let subpath;
|
||||||
|
let isWASM = false;
|
||||||
|
let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
|
||||||
|
if (platformKey in knownWindowsPackages) {
|
||||||
|
pkg = knownWindowsPackages[platformKey];
|
||||||
|
subpath = "esbuild.exe";
|
||||||
|
} else if (platformKey in knownUnixlikePackages) {
|
||||||
|
pkg = knownUnixlikePackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
} else if (platformKey in knownWebAssemblyFallbackPackages) {
|
||||||
|
pkg = knownWebAssemblyFallbackPackages[platformKey];
|
||||||
|
subpath = "bin/esbuild";
|
||||||
|
isWASM = true;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported platform: ${platformKey}`);
|
||||||
|
}
|
||||||
|
return { pkg, subpath, isWASM };
|
||||||
|
}
|
||||||
|
function downloadedBinPath(pkg, subpath) {
|
||||||
|
const esbuildLibDir = path.dirname(require.resolve("esbuild"));
|
||||||
|
return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// lib/npm/node-install.ts
|
||||||
|
var fs2 = require("fs");
|
||||||
|
var os2 = require("os");
|
||||||
|
var path2 = require("path");
|
||||||
|
var zlib = require("zlib");
|
||||||
|
var https = require("https");
|
||||||
|
var child_process = require("child_process");
|
||||||
|
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
|
||||||
|
var toPath = path2.join(__dirname, "bin", "esbuild");
|
||||||
|
var isToPathJS = true;
|
||||||
|
function validateBinaryVersion(...command) {
|
||||||
|
command.push("--version");
|
||||||
|
let stdout;
|
||||||
|
try {
|
||||||
|
stdout = child_process.execFileSync(command.shift(), command, {
|
||||||
|
// Without this, this install script strangely crashes with the error
|
||||||
|
// "EACCES: permission denied, write" but only on Ubuntu Linux when node is
|
||||||
|
// installed from the Snap Store. This is not a problem when you download
|
||||||
|
// the official version of node. The problem appears to be that stderr
|
||||||
|
// (i.e. file descriptor 2) isn't writable?
|
||||||
|
//
|
||||||
|
// More info:
|
||||||
|
// - https://snapcraft.io/ (what the Snap Store is)
|
||||||
|
// - https://nodejs.org/dist/ (download the official version of node)
|
||||||
|
// - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
|
||||||
|
//
|
||||||
|
stdio: "pipe"
|
||||||
|
}).toString().trim();
|
||||||
|
} catch (err) {
|
||||||
|
if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
|
||||||
|
let os3 = "this version of macOS";
|
||||||
|
try {
|
||||||
|
os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
|
||||||
|
|
||||||
|
The Go compiler (which esbuild relies on) no longer supports ${os3},
|
||||||
|
which means the "esbuild" binary executable can't be run. You can either:
|
||||||
|
|
||||||
|
* Update your version of macOS to one that the Go compiler supports
|
||||||
|
* Use the "esbuild-wasm" package instead of the "esbuild" package
|
||||||
|
* Build esbuild yourself using an older version of the Go compiler
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (stdout !== versionFromPackageJSON) {
|
||||||
|
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function isYarn() {
|
||||||
|
const { npm_config_user_agent } = process.env;
|
||||||
|
if (npm_config_user_agent) {
|
||||||
|
return /\byarn\//.test(npm_config_user_agent);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
function fetch(url) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
https.get(url, (res) => {
|
||||||
|
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location)
|
||||||
|
return fetch(res.headers.location).then(resolve, reject);
|
||||||
|
if (res.statusCode !== 200)
|
||||||
|
return reject(new Error(`Server responded with ${res.statusCode}`));
|
||||||
|
let chunks = [];
|
||||||
|
res.on("data", (chunk) => chunks.push(chunk));
|
||||||
|
res.on("end", () => resolve(Buffer.concat(chunks)));
|
||||||
|
}).on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractFileFromTarGzip(buffer, subpath) {
|
||||||
|
try {
|
||||||
|
buffer = zlib.unzipSync(buffer);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`);
|
||||||
|
}
|
||||||
|
let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, "");
|
||||||
|
let offset = 0;
|
||||||
|
subpath = `package/${subpath}`;
|
||||||
|
while (offset < buffer.length) {
|
||||||
|
let name = str(offset, 100);
|
||||||
|
let size = parseInt(str(offset + 124, 12), 8);
|
||||||
|
offset += 512;
|
||||||
|
if (!isNaN(size)) {
|
||||||
|
if (name === subpath) return buffer.subarray(offset, offset + size);
|
||||||
|
offset += size + 511 & ~511;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
|
||||||
|
}
|
||||||
|
function installUsingNPM(pkg, subpath, binPath) {
|
||||||
|
const env = { ...process.env, npm_config_global: void 0 };
|
||||||
|
const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
|
||||||
|
const installDir = path2.join(esbuildLibDir, "npm-install");
|
||||||
|
fs2.mkdirSync(installDir);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
||||||
|
child_process.execSync(
|
||||||
|
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
|
||||||
|
{ cwd: installDir, stdio: "pipe", env }
|
||||||
|
);
|
||||||
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
||||||
|
fs2.renameSync(installedBinPath, binPath);
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
removeRecursive(installDir);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function removeRecursive(dir) {
|
||||||
|
for (const entry of fs2.readdirSync(dir)) {
|
||||||
|
const entryPath = path2.join(dir, entry);
|
||||||
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = fs2.lstatSync(entryPath);
|
||||||
|
} catch {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (stats.isDirectory()) removeRecursive(entryPath);
|
||||||
|
else fs2.unlinkSync(entryPath);
|
||||||
|
}
|
||||||
|
fs2.rmdirSync(dir);
|
||||||
|
}
|
||||||
|
function applyManualBinaryPathOverride(overridePath) {
|
||||||
|
const pathString = JSON.stringify(overridePath);
|
||||||
|
fs2.writeFileSync(toPath, `#!/usr/bin/env node
|
||||||
|
require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' });
|
||||||
|
`);
|
||||||
|
const libMain = path2.join(__dirname, "lib", "main.js");
|
||||||
|
const code = fs2.readFileSync(libMain, "utf8");
|
||||||
|
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
||||||
|
${code}`);
|
||||||
|
}
|
||||||
|
function maybeOptimizePackage(binPath) {
|
||||||
|
if (os2.platform() !== "win32" && !isYarn()) {
|
||||||
|
const tempPath = path2.join(__dirname, "bin-esbuild");
|
||||||
|
try {
|
||||||
|
fs2.linkSync(binPath, tempPath);
|
||||||
|
fs2.renameSync(tempPath, toPath);
|
||||||
|
isToPathJS = false;
|
||||||
|
fs2.unlinkSync(tempPath);
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
||||||
|
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
|
||||||
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
||||||
|
try {
|
||||||
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
||||||
|
fs2.chmodSync(binPath, 493);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async function checkAndPreparePackage() {
|
||||||
|
if (isValidBinaryPath(ESBUILD_BINARY_PATH)) {
|
||||||
|
if (!fs2.existsSync(ESBUILD_BINARY_PATH)) {
|
||||||
|
console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`);
|
||||||
|
} else {
|
||||||
|
applyManualBinaryPathOverride(ESBUILD_BINARY_PATH);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
||||||
|
let binPath;
|
||||||
|
try {
|
||||||
|
binPath = require.resolve(`${pkg}/${subpath}`);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`[esbuild] Failed to find package "${pkg}" on the file system
|
||||||
|
|
||||||
|
This can happen if you use the "--no-optional" flag. The "optionalDependencies"
|
||||||
|
package.json feature is used by esbuild to install the correct binary executable
|
||||||
|
for your current platform. This install script will now attempt to work around
|
||||||
|
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
||||||
|
`);
|
||||||
|
binPath = downloadedBinPath(pkg, subpath);
|
||||||
|
try {
|
||||||
|
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
||||||
|
installUsingNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e2) {
|
||||||
|
console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`);
|
||||||
|
try {
|
||||||
|
await downloadDirectlyFromNPM(pkg, subpath, binPath);
|
||||||
|
} catch (e3) {
|
||||||
|
throw new Error(`Failed to install package "${pkg}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maybeOptimizePackage(binPath);
|
||||||
|
}
|
||||||
|
checkAndPreparePackage().then(() => {
|
||||||
|
if (isToPathJS) {
|
||||||
|
validateBinaryVersion(process.execPath, toPath);
|
||||||
|
} else {
|
||||||
|
validateBinaryVersion(toPath);
|
||||||
|
}
|
||||||
|
});
|
||||||
+705
@@ -0,0 +1,705 @@
|
|||||||
|
export type Platform = 'browser' | 'node' | 'neutral'
|
||||||
|
export type Format = 'iife' | 'cjs' | 'esm'
|
||||||
|
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
||||||
|
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
||||||
|
export type Charset = 'ascii' | 'utf8'
|
||||||
|
export type Drop = 'console' | 'debugger'
|
||||||
|
|
||||||
|
interface CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
||||||
|
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
||||||
|
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
||||||
|
sourceRoot?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
||||||
|
sourcesContent?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#format */
|
||||||
|
format?: Format
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
||||||
|
globalName?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#target */
|
||||||
|
target?: string | string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
||||||
|
supported?: Record<string, boolean>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
||||||
|
platform?: Platform
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
reserveProps?: RegExp
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleQuoted?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
||||||
|
mangleCache?: Record<string, string | false>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
||||||
|
drop?: Drop[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
||||||
|
dropLabels?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minify?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyWhitespace?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifyIdentifiers?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
||||||
|
minifySyntax?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
||||||
|
lineLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
||||||
|
charset?: Charset
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
||||||
|
treeShaking?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
||||||
|
ignoreAnnotations?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
||||||
|
jsx?: 'transform' | 'preserve' | 'automatic'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
||||||
|
jsxFactory?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
||||||
|
jsxFragment?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
||||||
|
jsxImportSource?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
||||||
|
jsxDev?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
||||||
|
jsxSideEffects?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#define */
|
||||||
|
define?: { [key: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
||||||
|
pure?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
||||||
|
keepNames?: boolean
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#color */
|
||||||
|
color?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
||||||
|
logLevel?: LogLevel
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
||||||
|
logLimit?: number
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
||||||
|
logOverride?: Record<string, LogLevel>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
||||||
|
tsconfigRaw?: string | TsconfigRaw
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TsconfigRaw {
|
||||||
|
compilerOptions?: {
|
||||||
|
alwaysStrict?: boolean
|
||||||
|
baseUrl?: string
|
||||||
|
experimentalDecorators?: boolean
|
||||||
|
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
||||||
|
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
||||||
|
jsxFactory?: string
|
||||||
|
jsxFragmentFactory?: string
|
||||||
|
jsxImportSource?: string
|
||||||
|
paths?: Record<string, string[]>
|
||||||
|
preserveValueImports?: boolean
|
||||||
|
strict?: boolean
|
||||||
|
target?: string
|
||||||
|
useDefineForClassFields?: boolean
|
||||||
|
verbatimModuleSyntax?: boolean
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
||||||
|
bundle?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
||||||
|
splitting?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
||||||
|
preserveSymlinks?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
||||||
|
outfile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
metafile?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
||||||
|
outdir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
||||||
|
outbase?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#external */
|
||||||
|
external?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#packages */
|
||||||
|
packages?: 'external'
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
||||||
|
alias?: Record<string, string>
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: { [ext: string]: Loader }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
||||||
|
resolveExtensions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
||||||
|
mainFields?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
||||||
|
conditions?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#write */
|
||||||
|
write?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
||||||
|
allowOverwrite?: boolean
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
||||||
|
tsconfig?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
||||||
|
outExtension?: { [ext: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
||||||
|
publicPath?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
||||||
|
entryNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
||||||
|
chunkNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
||||||
|
assetNames?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
||||||
|
inject?: string[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: { [type: string]: string }
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
||||||
|
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
||||||
|
stdin?: StdinOptions
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
||||||
|
plugins?: Plugin[]
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
||||||
|
absWorkingDir?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
||||||
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StdinOptions {
|
||||||
|
contents: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
sourcefile?: string
|
||||||
|
loader?: Loader
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Message {
|
||||||
|
id: string
|
||||||
|
pluginName: string
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
notes: Note[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Optional user-specified data that is passed through unmodified. You can
|
||||||
|
* use this to stash the original error, for example.
|
||||||
|
*/
|
||||||
|
detail: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Note {
|
||||||
|
text: string
|
||||||
|
location: Location | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Location {
|
||||||
|
file: string
|
||||||
|
namespace: string
|
||||||
|
/** 1-based */
|
||||||
|
line: number
|
||||||
|
/** 0-based, in bytes */
|
||||||
|
column: number
|
||||||
|
/** in bytes */
|
||||||
|
length: number
|
||||||
|
lineText: string
|
||||||
|
suggestion: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OutputFile {
|
||||||
|
path: string
|
||||||
|
contents: Uint8Array
|
||||||
|
hash: string
|
||||||
|
/** "contents" as text (changes automatically with "contents") */
|
||||||
|
readonly text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "write: false" */
|
||||||
|
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
||||||
|
/** Only when "metafile: true" */
|
||||||
|
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
||||||
|
export interface ServeOptions {
|
||||||
|
port?: number
|
||||||
|
host?: string
|
||||||
|
servedir?: string
|
||||||
|
keyfile?: string
|
||||||
|
certfile?: string
|
||||||
|
fallback?: string
|
||||||
|
onRequest?: (args: ServeOnRequestArgs) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ServeOnRequestArgs {
|
||||||
|
remoteAddress: string
|
||||||
|
method: string
|
||||||
|
path: string
|
||||||
|
status: number
|
||||||
|
/** The time to generate the response, not to send it */
|
||||||
|
timeInMS: number
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
||||||
|
export interface ServeResult {
|
||||||
|
port: number
|
||||||
|
host: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformOptions extends CommonOptions {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
||||||
|
sourcefile?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
||||||
|
loader?: Loader
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
||||||
|
banner?: string
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
||||||
|
footer?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
||||||
|
code: string
|
||||||
|
map: string
|
||||||
|
warnings: Message[]
|
||||||
|
/** Only when "mangleCache" is present */
|
||||||
|
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
||||||
|
/** Only when "legalComments" is "external" */
|
||||||
|
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TransformFailure extends Error {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Plugin {
|
||||||
|
name: string
|
||||||
|
setup: (build: PluginBuild) => (void | Promise<void>)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginBuild {
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
||||||
|
initialOptions: BuildOptions
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
||||||
|
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
||||||
|
onStart(callback: () =>
|
||||||
|
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
||||||
|
onEnd(callback: (result: BuildResult) =>
|
||||||
|
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
||||||
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
||||||
|
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
||||||
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
||||||
|
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
||||||
|
onDispose(callback: () => void): void
|
||||||
|
|
||||||
|
// This is a full copy of the esbuild library in case you need it
|
||||||
|
esbuild: {
|
||||||
|
context: typeof context,
|
||||||
|
build: typeof build,
|
||||||
|
buildSync: typeof buildSync,
|
||||||
|
transform: typeof transform,
|
||||||
|
transformSync: typeof transformSync,
|
||||||
|
formatMessages: typeof formatMessages,
|
||||||
|
formatMessagesSync: typeof formatMessagesSync,
|
||||||
|
analyzeMetafile: typeof analyzeMetafile,
|
||||||
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
||||||
|
initialize: typeof initialize,
|
||||||
|
version: typeof version,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
||||||
|
export interface ResolveOptions {
|
||||||
|
pluginName?: string
|
||||||
|
importer?: string
|
||||||
|
namespace?: string
|
||||||
|
resolveDir?: string
|
||||||
|
kind?: ImportKind
|
||||||
|
pluginData?: any
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
||||||
|
export interface ResolveResult {
|
||||||
|
errors: Message[]
|
||||||
|
warnings: Message[]
|
||||||
|
|
||||||
|
path: string
|
||||||
|
external: boolean
|
||||||
|
sideEffects: boolean
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnStartResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OnEndResult {
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
||||||
|
export interface OnResolveOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
||||||
|
export interface OnResolveArgs {
|
||||||
|
path: string
|
||||||
|
importer: string
|
||||||
|
namespace: string
|
||||||
|
resolveDir: string
|
||||||
|
kind: ImportKind
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ImportKind =
|
||||||
|
| 'entry-point'
|
||||||
|
|
||||||
|
// JS
|
||||||
|
| 'import-statement'
|
||||||
|
| 'require-call'
|
||||||
|
| 'dynamic-import'
|
||||||
|
| 'require-resolve'
|
||||||
|
|
||||||
|
// CSS
|
||||||
|
| 'import-rule'
|
||||||
|
| 'composes-from'
|
||||||
|
| 'url-token'
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
||||||
|
export interface OnResolveResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
path?: string
|
||||||
|
external?: boolean
|
||||||
|
sideEffects?: boolean
|
||||||
|
namespace?: string
|
||||||
|
suffix?: string
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
||||||
|
export interface OnLoadOptions {
|
||||||
|
filter: RegExp
|
||||||
|
namespace?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
||||||
|
export interface OnLoadArgs {
|
||||||
|
path: string
|
||||||
|
namespace: string
|
||||||
|
suffix: string
|
||||||
|
pluginData: any
|
||||||
|
with: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
||||||
|
export interface OnLoadResult {
|
||||||
|
pluginName?: string
|
||||||
|
|
||||||
|
errors?: PartialMessage[]
|
||||||
|
warnings?: PartialMessage[]
|
||||||
|
|
||||||
|
contents?: string | Uint8Array
|
||||||
|
resolveDir?: string
|
||||||
|
loader?: Loader
|
||||||
|
pluginData?: any
|
||||||
|
|
||||||
|
watchFiles?: string[]
|
||||||
|
watchDirs?: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialMessage {
|
||||||
|
id?: string
|
||||||
|
pluginName?: string
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
notes?: PartialNote[]
|
||||||
|
detail?: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PartialNote {
|
||||||
|
text?: string
|
||||||
|
location?: Partial<Location> | null
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
||||||
|
export interface Metafile {
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind
|
||||||
|
external?: boolean
|
||||||
|
original?: string
|
||||||
|
with?: Record<string, string>
|
||||||
|
}[]
|
||||||
|
format?: 'cjs' | 'esm'
|
||||||
|
with?: Record<string, string>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytes: number
|
||||||
|
inputs: {
|
||||||
|
[path: string]: {
|
||||||
|
bytesInOutput: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
imports: {
|
||||||
|
path: string
|
||||||
|
kind: ImportKind | 'file-loader'
|
||||||
|
external?: boolean
|
||||||
|
}[]
|
||||||
|
exports: string[]
|
||||||
|
entryPoint?: string
|
||||||
|
cssBundle?: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FormatMessagesOptions {
|
||||||
|
kind: 'error' | 'warning'
|
||||||
|
color?: boolean
|
||||||
|
terminalWidth?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnalyzeMetafileOptions {
|
||||||
|
color?: boolean
|
||||||
|
verbose?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WatchOptions {
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
||||||
|
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#watch */
|
||||||
|
watch(options?: WatchOptions): Promise<void>
|
||||||
|
|
||||||
|
/** Documentation: https://esbuild.github.io/api/#serve */
|
||||||
|
serve(options?: ServeOptions): Promise<ServeResult>
|
||||||
|
|
||||||
|
cancel(): Promise<void>
|
||||||
|
dispose(): Promise<void>
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a TypeScript type-level function which replaces any keys in "In"
|
||||||
|
// that aren't in "Out" with "never". We use this to reject properties with
|
||||||
|
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
||||||
|
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function invokes the "esbuild" command-line tool for you. It returns a
|
||||||
|
* promise that either resolves with a "BuildResult" object or rejects with a
|
||||||
|
* "BuildFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the advanced long-running form of "build" that supports additional
|
||||||
|
* features such as watch mode and a local development server.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function transforms a single JavaScript file. It can be used to minify
|
||||||
|
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
||||||
|
* to older JavaScript. It returns a promise that is either resolved with a
|
||||||
|
* "TransformResult" object or rejected with a "TransformFailure" object.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts log messages to formatted message strings suitable for printing in
|
||||||
|
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
||||||
|
* log message formatter. This is a batch-oriented API for efficiency.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*/
|
||||||
|
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
||||||
|
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
||||||
|
* to customize it, you can just inspect the data in the metafile yourself.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "build".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#build
|
||||||
|
*/
|
||||||
|
export declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "transform".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#transform
|
||||||
|
*/
|
||||||
|
export declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "formatMessages".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*/
|
||||||
|
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A synchronous version of "analyzeMetafile".
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: no
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#analyze
|
||||||
|
*/
|
||||||
|
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This configures the browser-based version of esbuild. It is necessary to
|
||||||
|
* call this first and wait for the returned promise to be resolved before
|
||||||
|
* making other API calls when using esbuild in the browser.
|
||||||
|
*
|
||||||
|
* - Works in node: yes
|
||||||
|
* - Works in browser: yes ("options" is required)
|
||||||
|
*
|
||||||
|
* Documentation: https://esbuild.github.io/api/#browser
|
||||||
|
*/
|
||||||
|
export declare function initialize(options: InitializeOptions): Promise<void>
|
||||||
|
|
||||||
|
export interface InitializeOptions {
|
||||||
|
/**
|
||||||
|
* The URL of the "esbuild.wasm" file. This must be provided when running
|
||||||
|
* esbuild in the browser.
|
||||||
|
*/
|
||||||
|
wasmURL?: string | URL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
||||||
|
* is a typed array or ArrayBuffer containing the binary code of the
|
||||||
|
* "esbuild.wasm" file.
|
||||||
|
*
|
||||||
|
* You can use this as an alternative to "wasmURL" for environments where it's
|
||||||
|
* not possible to download the WebAssembly module.
|
||||||
|
*/
|
||||||
|
wasmModule?: WebAssembly.Module
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
||||||
|
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
||||||
|
* to false.
|
||||||
|
*/
|
||||||
|
worker?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export let version: string
|
||||||
|
|
||||||
|
// Call this function to terminate esbuild's child process. The child process
|
||||||
|
// is not terminated and re-created after each API call because it's more
|
||||||
|
// efficient to keep it around when there are multiple API calls.
|
||||||
|
//
|
||||||
|
// In node this happens automatically before the parent node process exits. So
|
||||||
|
// you only need to call this if you know you will not make any more esbuild
|
||||||
|
// API calls and you want to clean up resources.
|
||||||
|
//
|
||||||
|
// Unlike node, Deno lacks the necessary APIs to clean up child processes
|
||||||
|
// automatically. You must manually call stop() in Deno when you're done
|
||||||
|
// using esbuild or Deno will continue running forever.
|
||||||
|
//
|
||||||
|
// Another reason you might want to call this is if you are using esbuild from
|
||||||
|
// within a Deno test. Deno fails tests that create a child process without
|
||||||
|
// killing it before the test ends, so you have to call this function (and
|
||||||
|
// await the returned promise) in every Deno test that uses esbuild.
|
||||||
|
export declare function stop(): Promise<void>
|
||||||
|
|
||||||
|
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
||||||
|
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
||||||
|
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
||||||
|
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
||||||
|
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
||||||
|
// these scenarios.
|
||||||
|
//
|
||||||
|
// There's an open issue about getting this problem corrected (although these
|
||||||
|
// declarations will need to remain even if this is fixed for backward
|
||||||
|
// compatibility with older TypeScript versions):
|
||||||
|
//
|
||||||
|
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
||||||
|
//
|
||||||
|
declare global {
|
||||||
|
namespace WebAssembly {
|
||||||
|
interface Module {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interface URL {
|
||||||
|
}
|
||||||
|
}
|
||||||
+2239
File diff suppressed because it is too large
Load Diff
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||||
|
basedir_win="$basedir"
|
||||||
|
exe=""
|
||||||
|
msys=""
|
||||||
|
|
||||||
|
case `uname -a` in
|
||||||
|
*CYGWIN*|*MINGW*|*MSYS*)
|
||||||
|
if command -v cygpath > /dev/null 2>&1; then
|
||||||
|
basedir_win=`cygpath -w "$basedir"`
|
||||||
|
fi
|
||||||
|
exe=".exe"
|
||||||
|
msys="true"
|
||||||
|
;;
|
||||||
|
*WSL2*)
|
||||||
|
if command -v wslpath > /dev/null 2>&1; then
|
||||||
|
basedir_win="$(wslpath -w "$basedir" 2> /dev/null)"
|
||||||
|
if [ $? -ne 0 ] || [ -z "$basedir_win" ]; then
|
||||||
|
basedir_win="$basedir"
|
||||||
|
else
|
||||||
|
exe=".exe"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$NODE_PATH" ]; then
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
else
|
||||||
|
export NODE_PATH="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules:$NODE_PATH"
|
||||||
|
fi
|
||||||
|
if [ -n "$exe" ] && [ -x "$basedir/node.exe" ]; then
|
||||||
|
exec "$basedir/node.exe" "$basedir_win/../../bin/esbuild" "$@"
|
||||||
|
elif [ -x "$basedir/node" ]; then
|
||||||
|
exec "$basedir/node" "$basedir/../../bin/esbuild" "$@"
|
||||||
|
elif command -v node >/dev/null 2>&1; then
|
||||||
|
exec node "$basedir/../../bin/esbuild" "$@"
|
||||||
|
elif [ -n "$exe" ] && command -v node.exe >/dev/null 2>&1; then
|
||||||
|
exec node.exe "$basedir_win/../../bin/esbuild" "$@"
|
||||||
|
else
|
||||||
|
exec node "$basedir/../../bin/esbuild" "$@"
|
||||||
|
fi
|
||||||
|
# cmd-shim-target=C:/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/bin/esbuild
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
@SETLOCAL
|
||||||
|
@IF NOT DEFINED NODE_PATH (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
) ELSE (
|
||||||
|
@SET "NODE_PATH=C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules;%NODE_PATH%"
|
||||||
|
)
|
||||||
|
@IF EXIST "%~dp0\node.exe" (
|
||||||
|
"%~dp0\node.exe" "%~dp0\..\..\bin\esbuild" %*
|
||||||
|
) ELSE (
|
||||||
|
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||||
|
node "%~dp0\..\..\bin\esbuild" %*
|
||||||
|
)
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env pwsh
|
||||||
|
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||||
|
|
||||||
|
$exe=""
|
||||||
|
$pathsep=":"
|
||||||
|
$env_node_path=$env:NODE_PATH
|
||||||
|
$new_node_path="C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules\esbuild\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\esbuild@0.21.5\node_modules;C:\Users\Administrator\Documents\deepseek-harness\daywork\node_modules\.pnpm\node_modules"
|
||||||
|
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||||
|
# Fix case when both the Windows and Linux builds of Node
|
||||||
|
# are installed in the same directory
|
||||||
|
$exe=".exe"
|
||||||
|
$pathsep=";"
|
||||||
|
} else {
|
||||||
|
$new_node_path="/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules/esbuild/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/esbuild@0.21.5/node_modules:/mnt/c/Users/Administrator/Documents/deepseek-harness/daywork/node_modules/.pnpm/node_modules"
|
||||||
|
}
|
||||||
|
if ([string]::IsNullOrEmpty($env_node_path)) {
|
||||||
|
$env:NODE_PATH=$new_node_path
|
||||||
|
} else {
|
||||||
|
$env:NODE_PATH="$new_node_path$pathsep$env_node_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret=0
|
||||||
|
if (Test-Path "$basedir/node$exe") {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "$basedir/node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "$basedir/node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
} else {
|
||||||
|
# Support pipeline input
|
||||||
|
if ($MyInvocation.ExpectingInput) {
|
||||||
|
$input | & "node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
} else {
|
||||||
|
& "node$exe" "$basedir/../../bin/esbuild" $args
|
||||||
|
}
|
||||||
|
$ret=$LASTEXITCODE
|
||||||
|
}
|
||||||
|
$env:NODE_PATH=$env_node_path
|
||||||
|
exit $ret
|
||||||
+46
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"name": "esbuild",
|
||||||
|
"version": "0.21.5",
|
||||||
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/evanw/esbuild.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postinstall": "node install.js"
|
||||||
|
},
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"types": "lib/main.d.ts",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"esbuild": "bin/esbuild"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"@esbuild/aix-ppc64": "0.21.5",
|
||||||
|
"@esbuild/android-arm": "0.21.5",
|
||||||
|
"@esbuild/android-arm64": "0.21.5",
|
||||||
|
"@esbuild/android-x64": "0.21.5",
|
||||||
|
"@esbuild/darwin-arm64": "0.21.5",
|
||||||
|
"@esbuild/darwin-x64": "0.21.5",
|
||||||
|
"@esbuild/freebsd-arm64": "0.21.5",
|
||||||
|
"@esbuild/freebsd-x64": "0.21.5",
|
||||||
|
"@esbuild/linux-arm": "0.21.5",
|
||||||
|
"@esbuild/linux-arm64": "0.21.5",
|
||||||
|
"@esbuild/linux-ia32": "0.21.5",
|
||||||
|
"@esbuild/linux-loong64": "0.21.5",
|
||||||
|
"@esbuild/linux-mips64el": "0.21.5",
|
||||||
|
"@esbuild/linux-ppc64": "0.21.5",
|
||||||
|
"@esbuild/linux-riscv64": "0.21.5",
|
||||||
|
"@esbuild/linux-s390x": "0.21.5",
|
||||||
|
"@esbuild/linux-x64": "0.21.5",
|
||||||
|
"@esbuild/netbsd-x64": "0.21.5",
|
||||||
|
"@esbuild/openbsd-x64": "0.21.5",
|
||||||
|
"@esbuild/sunos-x64": "0.21.5",
|
||||||
|
"@esbuild/win32-arm64": "0.21.5",
|
||||||
|
"@esbuild/win32-ia32": "0.21.5",
|
||||||
|
"@esbuild/win32-x64": "0.21.5"
|
||||||
|
},
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"esbuild": "0.21.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
Generated
+255
@@ -0,0 +1,255 @@
|
|||||||
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
devDependencies:
|
||||||
|
esbuild:
|
||||||
|
specifier: 0.21.5
|
||||||
|
version: 0.21.5
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [aix]
|
||||||
|
|
||||||
|
'@esbuild/android-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/android-arm@0.21.5':
|
||||||
|
resolution: {integrity: sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/android-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@esbuild/darwin-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@esbuild/darwin-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@esbuild/freebsd-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@esbuild/freebsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@esbuild/linux-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-arm@0.21.5':
|
||||||
|
resolution: {integrity: sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-ia32@0.21.5':
|
||||||
|
resolution: {integrity: sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-loong64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [loong64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-mips64el@0.21.5':
|
||||||
|
resolution: {integrity: sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [mips64el]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-ppc64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-riscv64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-s390x@0.21.5':
|
||||||
|
resolution: {integrity: sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/linux-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@esbuild/netbsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [netbsd]
|
||||||
|
|
||||||
|
'@esbuild/openbsd-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [openbsd]
|
||||||
|
|
||||||
|
'@esbuild/sunos-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [sunos]
|
||||||
|
|
||||||
|
'@esbuild/win32-arm64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@esbuild/win32-ia32@0.21.5':
|
||||||
|
resolution: {integrity: sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@esbuild/win32-x64@0.21.5':
|
||||||
|
resolution: {integrity: sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
esbuild@0.21.5:
|
||||||
|
resolution: {integrity: sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==}
|
||||||
|
engines: {node: '>=12'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
'@esbuild/aix-ppc64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-arm@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/android-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/darwin-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/darwin-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/freebsd-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/freebsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-arm@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-ia32@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-loong64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-mips64el@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-ppc64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-riscv64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-s390x@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/linux-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/netbsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/openbsd-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/sunos-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-arm64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-ia32@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@esbuild/win32-x64@0.21.5':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
esbuild@0.21.5:
|
||||||
|
optionalDependencies:
|
||||||
|
'@esbuild/aix-ppc64': 0.21.5
|
||||||
|
'@esbuild/android-arm': 0.21.5
|
||||||
|
'@esbuild/android-arm64': 0.21.5
|
||||||
|
'@esbuild/android-x64': 0.21.5
|
||||||
|
'@esbuild/darwin-arm64': 0.21.5
|
||||||
|
'@esbuild/darwin-x64': 0.21.5
|
||||||
|
'@esbuild/freebsd-arm64': 0.21.5
|
||||||
|
'@esbuild/freebsd-x64': 0.21.5
|
||||||
|
'@esbuild/linux-arm': 0.21.5
|
||||||
|
'@esbuild/linux-arm64': 0.21.5
|
||||||
|
'@esbuild/linux-ia32': 0.21.5
|
||||||
|
'@esbuild/linux-loong64': 0.21.5
|
||||||
|
'@esbuild/linux-mips64el': 0.21.5
|
||||||
|
'@esbuild/linux-ppc64': 0.21.5
|
||||||
|
'@esbuild/linux-riscv64': 0.21.5
|
||||||
|
'@esbuild/linux-s390x': 0.21.5
|
||||||
|
'@esbuild/linux-x64': 0.21.5
|
||||||
|
'@esbuild/netbsd-x64': 0.21.5
|
||||||
|
'@esbuild/openbsd-x64': 0.21.5
|
||||||
|
'@esbuild/sunos-x64': 0.21.5
|
||||||
|
'@esbuild/win32-arm64': 0.21.5
|
||||||
|
'@esbuild/win32-ia32': 0.21.5
|
||||||
|
'@esbuild/win32-x64': 0.21.5
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
allowBuilds:
|
||||||
|
esbuild: set this to true or false
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
// 统一 CI 编排:本地与 Gitea Actions 共用同一入口
|
||||||
|
// 用法:node scripts/ci.mjs
|
||||||
|
// 步骤:起本地同步服务 → 协议审计 → 用户管理审计 → 单元测试 → 双设备回归 → 实时链路 → 网页构建 → 依赖审计(软性)
|
||||||
|
// 任何硬性步骤失败即整体失败(依赖审计默认软性,CI 里单独放开)
|
||||||
|
import { spawn, spawnSync } from 'node:child_process'
|
||||||
|
import fs from 'node:fs'
|
||||||
|
import os from 'node:os'
|
||||||
|
import path from 'node:path'
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
|
|
||||||
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
||||||
|
const PORT = process.env.SYNC_PORT || '3780'
|
||||||
|
const BASE = 'http://127.0.0.1:' + PORT
|
||||||
|
const results = []
|
||||||
|
let hardFailed = false
|
||||||
|
let softWarned = false
|
||||||
|
|
||||||
|
function log(tag, line) { console.log('[' + tag + '] ' + line) }
|
||||||
|
|
||||||
|
function runStep(name, cmd, args, opts = {}) {
|
||||||
|
log('RUN', name + ' (' + cmd + ' ' + args.join(' ') + ')')
|
||||||
|
const started = Date.now()
|
||||||
|
const r = spawnSync(cmd, args, { cwd: opts.cwd || ROOT, env: process.env, encoding: 'utf-8', shell: process.platform === 'win32' && cmd.endsWith('.cmd') })
|
||||||
|
const out = ((r.stdout || '') + (r.stderr || '')).trim()
|
||||||
|
const tail = out.split('\n').slice(-opts.tailLines || -40)
|
||||||
|
for (const l of (opts.tail || out.split('\n').slice(-25))) if (l.trim()) console.log(' ' + l)
|
||||||
|
const dur = ((Date.now() - started) / 1000).toFixed(1) + 's'
|
||||||
|
const ok = r.status === 0
|
||||||
|
results.push({ name, ok, dur })
|
||||||
|
if (ok) log('OK ', name + ' (' + dur + ')')
|
||||||
|
else {
|
||||||
|
log('FAIL', name + ' (exit ' + r.status + ', ' + dur + ')')
|
||||||
|
if (opts.soft) { softWarned = true; log('WARN', name + ' 为软性检查,不阻断 CI') }
|
||||||
|
else hardFailed = true
|
||||||
|
}
|
||||||
|
return { ok, out }
|
||||||
|
}
|
||||||
|
|
||||||
|
function findEsbuild() {
|
||||||
|
const candidates = [
|
||||||
|
path.join(ROOT, 'intern-log', 'node_modules', 'esbuild', 'bin', 'esbuild')
|
||||||
|
]
|
||||||
|
const pnpmDir = path.join(ROOT, 'intern-log', 'node_modules', '.pnpm')
|
||||||
|
try {
|
||||||
|
for (const d of fs.readdirSync(pnpmDir)) {
|
||||||
|
if (d.startsWith('esbuild@')) candidates.push(path.join(pnpmDir, d, 'node_modules', 'esbuild', 'bin', 'esbuild'))
|
||||||
|
}
|
||||||
|
} catch { /* 无 .pnpm 目录 */ }
|
||||||
|
for (const c of candidates) if (fs.existsSync(c)) return c
|
||||||
|
throw new Error('找不到 esbuild,请先在 intern-log 下执行 pnpm install')
|
||||||
|
}
|
||||||
|
|
||||||
|
function runBundled(name, tsPath) {
|
||||||
|
const outfile = path.join(os.tmpdir(), 'daywork-' + name + '-' + Date.now() + '.cjs')
|
||||||
|
const esbuildBin = findEsbuild()
|
||||||
|
const b = runStep('bundle:' + name, process.execPath, [esbuildBin, tsPath, '--bundle', '--platform=node', '--format=cjs', '--outfile=' + outfile], { tail: [] })
|
||||||
|
if (!b.ok) return
|
||||||
|
runStep('test:' + name, process.execPath, [outfile], {})
|
||||||
|
try { fs.rmSync(outfile, { force: true }) } catch { /* 忽略 */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function waitForServer(deadlineMs) {
|
||||||
|
const started = Date.now()
|
||||||
|
while (Date.now() - started < deadlineMs) {
|
||||||
|
try {
|
||||||
|
const r = await fetch(BASE + '/api/health')
|
||||||
|
if (r.ok) return true
|
||||||
|
} catch { /* 未就绪 */ }
|
||||||
|
await new Promise(r => globalThis.setTimeout(r, 300))
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 0) 清理历史测试数据,保证套件幂等 ----------
|
||||||
|
fs.rmSync(path.join(ROOT, 'server', 'data'), { recursive: true, force: true })
|
||||||
|
|
||||||
|
// ---------- 1) 启动本地同步服务 ----------
|
||||||
|
const serverProc = spawn(process.execPath, [path.join(ROOT, 'server', 'index.js')], {
|
||||||
|
cwd: ROOT,
|
||||||
|
env: { ...process.env, PORT },
|
||||||
|
stdio: ['ignore', 'pipe', 'pipe']
|
||||||
|
})
|
||||||
|
let serverLog = ''
|
||||||
|
serverProc.stdout.on('data', d => { serverLog += d })
|
||||||
|
serverProc.stderr.on('data', d => { serverLog += d })
|
||||||
|
|
||||||
|
const up = await waitForServer(15000)
|
||||||
|
if (!up) {
|
||||||
|
console.error('[FATAL] 本地同步服务 15 秒内未就绪')
|
||||||
|
console.error(serverLog.slice(-1500))
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
log('OK', '同步服务已就绪 ' + BASE)
|
||||||
|
|
||||||
|
try {
|
||||||
|
// ---------- 2) 服务端协议审计 ----------
|
||||||
|
runStep('protocol-audit', process.execPath, [path.join(ROOT, 'tests', 'server', 'protocol.mjs')], {})
|
||||||
|
// ---------- 3) 用户管理审计 ----------
|
||||||
|
runStep('admin-audit', process.execPath, [path.join(ROOT, 'tests', 'server', 'admin.mjs')], {})
|
||||||
|
// ---------- 4/5/6) 客户端引擎级测试 ----------
|
||||||
|
runBundled('unit', 'intern-log/repro/unit-tests.ts')
|
||||||
|
runBundled('two-device', 'intern-log/repro/two-device.ts')
|
||||||
|
runBundled('realtime', 'intern-log/repro/engine-realtime.ts')
|
||||||
|
|
||||||
|
// ---------- 7) 网页构建(编译即检查) ----------
|
||||||
|
const isWin = process.platform === 'win32'
|
||||||
|
const pnpmCmd = isWin ? 'pnpm.cmd' : 'pnpm'
|
||||||
|
runStep('build:web', pnpmCmd, ['run', 'build'], { cwd: path.join(ROOT, 'intern-log') })
|
||||||
|
} finally {
|
||||||
|
serverProc.kill()
|
||||||
|
try { fs.rmSync(path.join(ROOT, 'server', 'data'), { recursive: true, force: true }) } catch { /* 忽略 */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- 8) 依赖漏洞审计(软性:高危及以上才告警,CI 可单独放开为硬性) ----------
|
||||||
|
const isWin = process.platform === 'win32'
|
||||||
|
runStep('audit:deps', isWin ? 'pnpm.cmd' : 'pnpm', ['audit', '--prod', '--audit-level=high'], {
|
||||||
|
cwd: path.join(ROOT, 'intern-log'),
|
||||||
|
soft: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// ---------- 汇总 ----------
|
||||||
|
console.log('')
|
||||||
|
console.log('==================== CI 汇总 ====================')
|
||||||
|
for (const r of results) console.log((r.ok ? ' PASS ' : ' FAIL ') + r.name.padEnd(18) + r.dur)
|
||||||
|
console.log('================================================')
|
||||||
|
if (hardFailed) {
|
||||||
|
console.error('结果:存在失败步骤,CI 不通过')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
if (softWarned) console.log('结果:全部硬性步骤通过(存在软性告警,见上方 WARN)')
|
||||||
|
else console.log('结果:全部通过')
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// 用户管理审计:角色 / 列表 / 新建 / 重置密码 / 删除 / 越权防护
|
||||||
|
const BASE = process.env.SYNC_BASE || 'http://127.0.0.1:3780'
|
||||||
|
let pass = 0, fail = 0
|
||||||
|
function check(name, ok, detail) {
|
||||||
|
if (ok) { pass++; console.log(' PASS ' + name) }
|
||||||
|
else { fail++; console.log(' FAIL ' + name + (detail ? ' -> ' + String(JSON.stringify(detail)).slice(0, 160) : '')) }
|
||||||
|
}
|
||||||
|
async function req(path, method, body, token) {
|
||||||
|
const r = await fetch(BASE + path, {
|
||||||
|
method,
|
||||||
|
headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: 'Bearer ' + token } : {}) },
|
||||||
|
body: body ? JSON.stringify(body) : undefined
|
||||||
|
})
|
||||||
|
return { status: r.status, data: await r.json().catch(() => ({})) }
|
||||||
|
}
|
||||||
|
async function main() {
|
||||||
|
const ax = await req('/api/auth/register', 'POST', { username: 'xionglin', password: 'admin123' })
|
||||||
|
check('xionglin 注册成功', ax.status === 200, ax.data)
|
||||||
|
const nu = await req('/api/auth/register', 'POST', { username: 'normal_u', password: 'normal123' })
|
||||||
|
check('普通用户注册成功', nu.status === 200, nu.data)
|
||||||
|
const listNoAuth = await req('/api/admin/users', 'GET', null, nu.data.token)
|
||||||
|
check('非管理员访问用户列表 403', listNoAuth.status === 403, listNoAuth.status)
|
||||||
|
const badList = await req('/api/admin/users', 'GET', null)
|
||||||
|
check('无 token 访问用户列表 403', badList.status === 403, badList.status)
|
||||||
|
const list = await req('/api/admin/users', 'GET', null, ax.data.token)
|
||||||
|
check('管理员可见用户列表', list.status === 200 && ((list.data.users || []).some(u => u.username === 'normal_u') && (list.data.users.some(u => u.username === 'xionglin' && u.role === 'admin'))), list.data)
|
||||||
|
check('列表返回 me 字段', !!list.data.me)
|
||||||
|
const create = await req('/api/admin/users/create', 'POST', { username: 'target_u', password: 'pass111' }, ax.data.token)
|
||||||
|
check('管理员新建用户', create.status === 200 && !!create.data.userId, create.data)
|
||||||
|
const dupCreate = await req('/api/admin/users/create', 'POST', { username: 'target_u', password: 'pass222' }, ax.data.token)
|
||||||
|
check('重复用户名 409', dupCreate.status === 409, dupCreate.status)
|
||||||
|
const loginTarget = await req('/api/auth/login', 'POST', { username: 'target_u', password: 'pass111' })
|
||||||
|
check('新用户可用初始密码登录', loginTarget.status === 200, loginTarget.status)
|
||||||
|
const reset = await req('/api/admin/users/password', 'POST', { userId: create.data.userId, newPassword: 'pass999' }, ax.data.token)
|
||||||
|
check('管理员重置密码 200', reset.status === 200, reset.data)
|
||||||
|
const oldLogin = await req('/api/auth/login', 'POST', { username: 'target_u', password: 'pass111' })
|
||||||
|
check('旧密码失效 401', oldLogin.status === 401, oldLogin.status)
|
||||||
|
const newLogin = await req('/api/auth/login', 'POST', { username: 'target_u', password: 'pass999' })
|
||||||
|
check('重置后新密码可登录', newLogin.status === 200, newLogin.status)
|
||||||
|
const selfDel = await req('/api/admin/users/delete', 'POST', { userId: ax.data.userId }, ax.data.token)
|
||||||
|
check('不能删除自己 400', selfDel.status === 400, selfDel.status)
|
||||||
|
const del = await req('/api/admin/users/delete', 'POST', { userId: create.data.userId }, ax.data.token)
|
||||||
|
check('删除用户 200', del.status === 200, del.data)
|
||||||
|
const goneLogin = await req('/api/auth/login', 'POST', { username: 'target_u', password: 'pass999' })
|
||||||
|
check('删除后登录被拒 401', goneLogin.status === 401, goneLogin.status)
|
||||||
|
const list2 = await req('/api/admin/users', 'GET', null, ax.data.token)
|
||||||
|
check('列表不再含已删用户', !((list2.data.users || []).some(u => u.username === 'target_u')))
|
||||||
|
|
||||||
|
console.log('==== 用户管理审计: PASS ' + pass + ' / FAIL ' + fail + ' ====')
|
||||||
|
process.exit(fail > 0 ? 1 : 0)
|
||||||
|
}
|
||||||
|
main().catch(e => { console.error('FAILED:', e && (e.stack || e.message)); process.exit(1) })
|
||||||
@@ -0,0 +1,138 @@
|
|||||||
|
// 服务端协议审计:认证 / 九张表收发持久化 / 多用户隔离 / LWW / 墓碑 / SSE / 备份
|
||||||
|
const BASE = process.env.SYNC_BASE || 'http://127.0.0.1:3780'
|
||||||
|
let pass = 0, fail = 0
|
||||||
|
function check(name, ok, detail) {
|
||||||
|
if (ok) { pass++; console.log(' PASS ' + name) }
|
||||||
|
else { fail++; console.log(' FAIL ' + name + (detail ? ' -> ' + String(JSON.stringify(detail)).slice(0, 180) : '')) }
|
||||||
|
}
|
||||||
|
async function post(path, body, token) {
|
||||||
|
const r = await fetch(BASE + path, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: 'Bearer ' + token } : {}) },
|
||||||
|
body: JSON.stringify(body || {})
|
||||||
|
})
|
||||||
|
return { status: r.status, body: await r.json().catch(() => ({})) }
|
||||||
|
}
|
||||||
|
const rowsOf = (resp) => resp.body.tables || {}
|
||||||
|
const tombsOf = (resp) => resp.body.tombstones || []
|
||||||
|
const row = (_, o) => Object.assign({ uuid: o.uuid, updated_at: o.updated_at || '2026-01-01T00:00:00' }, o)
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const reg = await post('/api/auth/register', { username: 'audit_a', password: 'aapass123' })
|
||||||
|
check('注册成功返回 token', reg.status === 200 && !!reg.body.token, reg.body)
|
||||||
|
const dup = await post('/api/auth/register', { username: 'audit_a', password: 'other123' })
|
||||||
|
check('重复用户名被拒 409', dup.status === 409, dup.status)
|
||||||
|
const bad = await post('/api/auth/login', { username: 'audit_a', password: 'wrong!!' })
|
||||||
|
check('错误密码登录 401', bad.status === 401, bad.status)
|
||||||
|
const ok = await post('/api/auth/login', { username: 'audit_a', password: 'aapass123' })
|
||||||
|
check('正确密码登录 200', ok.status === 200 && !!ok.body.token, ok.status)
|
||||||
|
const tokA = reg.body.token, tokA2 = ok.body.token
|
||||||
|
const noAuth = await post('/api/sync', { tables: {} })
|
||||||
|
check('无 token 同步被拒 401', noAuth.status === 401, noAuth.status)
|
||||||
|
const regB = await post('/api/auth/register', { username: 'audit_b', password: 'bbpass123' })
|
||||||
|
check('第二用户注册成功', regB.status === 200, regB.body)
|
||||||
|
|
||||||
|
const all9 = {
|
||||||
|
project: [row('project', { uuid: 'pu1', name: '项目X', archived: 0 })],
|
||||||
|
work_log: [row('work_log', { uuid: 'wu1', date: '2026-02-10' })],
|
||||||
|
log_item: [row('log_item', { uuid: 'iu1', wuuid: 'wu1', puuid: 'pu1', content: '条目1', category: 'dev', minutes: 45, is_milestone: 0, needs_followup: 0, sort_order: 0 })],
|
||||||
|
attendance: [row('attendance', { uuid: 'au1', date: '2026-02-10', kind: 'normal', clock_in_at: '2026-02-10T09:00:00', clock_out_at: '2026-02-10T18:00:00' })],
|
||||||
|
weekly_note: [row('weekly_note', { uuid: 'vu1', week_start: '2026-02-09', content: '周记' })],
|
||||||
|
setting: [row('setting', { uuid: 'su1', key: 'work_start', value: '09:00' })],
|
||||||
|
memo: [row('memo', { uuid: 'mu1', title: '备忘', content: '内容' })],
|
||||||
|
credential: [row('credential', { uuid: 'cu1', title: '站点', account: 'user1' })],
|
||||||
|
transaction: [row('transaction', { uuid: 'tu1', kind: 'expense', amount_cents: 12500, category: 'traffic', happened_on: '2026-02-10' })]
|
||||||
|
}
|
||||||
|
const push1 = await post('/api/sync', { tables: all9 }, tokA)
|
||||||
|
check('九张表推送 200', push1.status === 200, push1.status)
|
||||||
|
let allEcho = true
|
||||||
|
for (const t of Object.keys(all9)) {
|
||||||
|
const got = rowsOf(push1)[t] || []
|
||||||
|
if (!got.some(x => x.uuid === all9[t][0].uuid)) { allEcho = false; console.log(' 缺表:', t) }
|
||||||
|
}
|
||||||
|
check('九张表数据全部回读', allEcho)
|
||||||
|
const pushEmpty = await post('/api/sync', { tables: {} }, tokA)
|
||||||
|
let persisted = true
|
||||||
|
for (const t of Object.keys(all9)) persisted = persisted && (rowsOf(pushEmpty)[t] || []).some(x => x.uuid === all9[t][0].uuid)
|
||||||
|
check('数据持久化(二次同步仍在)', persisted)
|
||||||
|
check('回传 serverTime 字段', typeof push1.body.serverTime === 'string')
|
||||||
|
|
||||||
|
const bPush = await post('/api/sync', { tables: { project: [row('project', { uuid: 'pb1', name: 'B的私有项目', archived: 0 })] } }, regB.body.token)
|
||||||
|
check('用户B 可推送自己的数据', bPush.status === 200 && (rowsOf(bPush).project || []).some(x => x.uuid === 'pb1'))
|
||||||
|
const againA = await post('/api/sync', { tables: {} }, tokA)
|
||||||
|
check('用户A 看不到 B 的数据', !((rowsOf(againA).project || []).some(x => x.uuid === 'pb1')))
|
||||||
|
const againB = await post('/api/sync', { tables: {} }, regB.body.token)
|
||||||
|
check('用户B 空库干净', Object.keys(all9).every(t => !((rowsOf(againB)[t] || []).some(x => x.uuid === all9[t][0].uuid))))
|
||||||
|
|
||||||
|
await post('/api/sync', { tables: { setting: [row('setting', { uuid: 'lww-new', key: 'work_end', value: '18:30', updated_at: '2026-03-01T10:00:00' })] } }, tokA)
|
||||||
|
await post('/api/sync', { tables: { setting: [row('setting', { uuid: 'lww-old', key: 'work_end', value: '17:30', updated_at: '2026-03-01T09:00:00' })] } }, tokA2)
|
||||||
|
const lwwR = await post('/api/sync', { tables: {} }, tokA)
|
||||||
|
check('LWW: 保留较新值', (rowsOf(lwwR).setting || []).some(x => x.uuid === 'lww-new' && x.value === '18:30'))
|
||||||
|
check('LWW: 旧副本被墓碑', tombsOf(lwwR).some(t => t.table === 'setting' && t.uuid === 'lww-old'))
|
||||||
|
await post('/api/sync', { tables: { setting: [row('setting', { uuid: 'rev-new', key: 'work_start', value: '08:50', updated_at: '2026-03-02T11:00:00' })] } }, tokA2)
|
||||||
|
const lwwR2 = await post('/api/sync', { tables: {} }, tokA)
|
||||||
|
check('LWW 反向: 旧 work_start 被墓碑', tombsOf(lwwR2).some(t => t.table === 'setting' && t.uuid === 'su1'))
|
||||||
|
|
||||||
|
await post('/api/sync', { tables: { memo: [row('memo', { uuid: 'mt1', title: '待删', content: 'x', updated_at: '2026-04-01T00:00:00' }), row('memo', { uuid: 'ms2', title: '更迟', content: 'y', updated_at: '2030-01-01T00:00:00' })] } }, tokA)
|
||||||
|
const delPush = await post('/api/sync', { tombstones: [{ table: 'memo', uuid: 'mt1', deleted_at: '2026-04-02T00:00:00' }] }, tokA)
|
||||||
|
check('墓碑同步后行被清除', !((rowsOf(delPush).memo || []).some(x => x.uuid === 'mt1')))
|
||||||
|
check('新于删除时间的行保留(防误删)', (rowsOf(delPush).memo || []).some(x => x.uuid === 'ms2'))
|
||||||
|
check('墓碑记录回传', tombsOf(delPush).some(t => t.table === 'memo' && t.uuid === 'mt1'))
|
||||||
|
|
||||||
|
const chg = await post('/api/auth/password', { oldPassword: 'aapass123', newPassword: 'aapass456' }, tokA)
|
||||||
|
check('修改登录密码 200', chg.status === 200, chg.body)
|
||||||
|
const oldLogin = await post('/api/auth/login', { username: 'audit_a', password: 'aapass123' })
|
||||||
|
check('旧密码立即失效 401', oldLogin.status === 401, oldLogin.status)
|
||||||
|
const newLogin = await post('/api/auth/login', { username: 'audit_a', password: 'aapass456' })
|
||||||
|
check('新密码登录 200', newLogin.status === 200, newLogin.status)
|
||||||
|
const chgWrong = await post('/api/auth/password', { oldPassword: 'zzz', newPassword: 'whatever1' }, tokA)
|
||||||
|
check('错误旧密码改密被拒 400', chgWrong.status === 400, chgWrong.status)
|
||||||
|
|
||||||
|
const ac = new AbortController()
|
||||||
|
const sse = await fetch(BASE + '/api/events?token=' + encodeURIComponent(tokA), { signal: ac.signal })
|
||||||
|
const reader = sse.body.getReader()
|
||||||
|
check('SSE 连接 200 + text/event-stream', sse.status === 200 && String(sse.headers.get('content-type')).includes('text/event-stream'))
|
||||||
|
let changeCount = 0
|
||||||
|
const readerPromise = (async () => {
|
||||||
|
const dec = new TextDecoder()
|
||||||
|
let buf = ''
|
||||||
|
while (true) {
|
||||||
|
const { done, value } = await reader.read()
|
||||||
|
if (done) break
|
||||||
|
buf += dec.decode(value)
|
||||||
|
while (buf.includes('event: change')) { buf = buf.slice(buf.indexOf('event: change') + 13); changeCount++ }
|
||||||
|
if (changeCount >= 1) return changeCount
|
||||||
|
}
|
||||||
|
return changeCount
|
||||||
|
})()
|
||||||
|
await new Promise(r => globalThis.setTimeout(r, 300))
|
||||||
|
await post('/api/sync', { tables: {} }, tokA)
|
||||||
|
await new Promise(r => globalThis.setTimeout(r, 400))
|
||||||
|
check('空同步不误广播', changeCount === 0, changeCount)
|
||||||
|
const trigger = await post('/api/sync', { tables: { memo: [row('memo', { uuid: 'sse-trigger', title: '实时', content: 'sse' })] } }, newLogin.body.token)
|
||||||
|
check('触发推送 200', trigger.status === 200)
|
||||||
|
const withEvent = await Promise.race([readerPromise, (async () => { await new Promise(r => globalThis.setTimeout(r, 5000)); return 0 })()])
|
||||||
|
check('SSE 收到 change 实时事件', withEvent >= 1, withEvent)
|
||||||
|
ac.abort()
|
||||||
|
const badSse = await fetch(BASE + '/api/events?token=garbage')
|
||||||
|
check('伪造 token 的 SSE 被拒 401', badSse.status === 401, badSse.status)
|
||||||
|
|
||||||
|
const fsMod = await import('node:fs')
|
||||||
|
const regJson = JSON.parse(fsMod.readFileSync('server/data/registry.json', 'utf-8'))
|
||||||
|
const aRec = regJson.users.find(u => u.username === 'audit_a')
|
||||||
|
check('注册表仅存哈希不存明文密码', !!aRec && !JSON.stringify(aRec).includes('aapass'))
|
||||||
|
await new Promise(r => globalThis.setTimeout(r, 400))
|
||||||
|
check('启动自动备份已生成', fsMod.existsSync('server/data/backups/' + new Date().toISOString().slice(0, 10) + '/registry.json'))
|
||||||
|
|
||||||
|
const d1 = await post('/api/auth/delete', {}, tokA)
|
||||||
|
check('删除账号 200', d1.status === 200, d1.body)
|
||||||
|
const afterDel = await post('/api/auth/login', { username: 'audit_a', password: 'aapass456' })
|
||||||
|
check('删除后登录被拒 401', afterDel.status === 401, afterDel.status)
|
||||||
|
check('删除后用户数据文件移除', !fsMod.existsSync('server/data/users/' + reg.body.userId + '.json'))
|
||||||
|
const b2 = await post('/api/sync', { tables: {} }, regB.body.token)
|
||||||
|
check('其他用户不受删除影响', b2.status === 200 && (rowsOf(b2).project || []).some(x => x.uuid === 'pb1'))
|
||||||
|
|
||||||
|
console.log('==== 服务端协议审计: PASS ' + pass + ' / FAIL ' + fail + ' ====')
|
||||||
|
process.exit(fail > 0 ? 1 : 0)
|
||||||
|
}
|
||||||
|
main().catch(e => { console.error('AUDIT FAILED:', (e && (e.stack || e.message)) || e); process.exit(1) })
|
||||||
Reference in New Issue
Block a user