@walkhi/code-relax 0.1.0-beta.10 → 0.1.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -54
- package/dist/bin/codex-remote.mjs +22 -58
- package/dist/shared/app-server-events.cjs +15 -3
- package/dist/shared/file-mentions.cjs +35 -0
- package/dist/skills/code-relax/SKILL.md +1 -1
- package/dist/src/desktop-launcher.mjs +6 -11
- package/dist/src/file-upload-session.mjs +124 -0
- package/dist/src/lan-socket-server.mjs +51 -8
- package/dist/src/managed-app-server.mjs +9 -7
- package/dist/src/onboarding.mjs +3 -3
- package/dist/src/platform/windows/desktop-host.mjs +1 -2
- package/dist/src/platform/windows/desktop-shortcuts.ps1 +6 -13
- package/dist/src/platform/windows/service-host.mjs +0 -9
- package/dist/src/self-relay/admin-page.mjs +1 -1
- package/dist/src/self-relay/connector.mjs +84 -12
- package/dist/src/self-relay/lifecycle.mjs +8 -24
- package/dist/src/self-relay/p2p-probe.mjs +1 -1
- package/dist/src/self-relay/server.mjs +67 -12
- package/dist/src/server.mjs +141 -34
- package/dist/src/service-doctor.mjs +1 -1
- package/dist/src/service-install.mjs +1 -4
- package/dist/src/shared-app-server.mjs +30 -28
- package/dist/src/shared-catalog.mjs +1 -11
- package/dist/src/shared-recovery.mjs +5 -5
- package/dist/src/skill-install.mjs +0 -13
- package/package.json +1 -1
- package/dist/src/debug-ui.mjs +0 -131
- package/dist/src/platform/windows/desktop-shortcut-run.ps1 +0 -5
- package/dist/web/activity-view.js +0 -283
- package/dist/web/approval-ui.js +0 -188
- package/dist/web/capabilities.js +0 -50
- package/dist/web/chat-transport.js +0 -196
- package/dist/web/chat.css +0 -778
- package/dist/web/chat.js +0 -3815
- package/dist/web/client-platform.js +0 -11
- package/dist/web/community.css +0 -82
- package/dist/web/community.html +0 -36
- package/dist/web/composer-controller.js +0 -97
- package/dist/web/conversation-controller.js +0 -99
- package/dist/web/disclosure-state-controller.js +0 -95
- package/dist/web/draft-controller.js +0 -103
- package/dist/web/harmony-platform.js +0 -52
- package/dist/web/highlight-powershell.min.js +0 -39
- package/dist/web/highlight.min.js +0 -1262
- package/dist/web/history-cache.js +0 -240
- package/dist/web/history-controller.js +0 -167
- package/dist/web/index.html +0 -288
- package/dist/web/lan-session.js +0 -122
- package/dist/web/link-action-controller.js +0 -212
- package/dist/web/message-send-controller.js +0 -177
- package/dist/web/message-view.js +0 -98
- package/dist/web/p2p-data-channel.js +0 -50
- package/dist/web/p2p-diagnostics.js +0 -28
- package/dist/web/p2p-probe.js +0 -123
- package/dist/web/page-resume.js +0 -28
- package/dist/web/pending-message-store.js +0 -108
- package/dist/web/queue-controller.js +0 -82
- package/dist/web/resources.json +0 -1
- package/dist/web/self-relay-session.js +0 -129
- package/dist/web/server-requests.js +0 -67
- package/dist/web/station-connection-controller.js +0 -75
- package/dist/web/task-list-view.js +0 -289
- package/dist/web/thread-attention-controller.js +0 -124
- package/dist/web/thread-context-controller.js +0 -30
- package/dist/web/thread-list-controller.js +0 -61
- package/dist/web/thread-list-sync.js +0 -86
- package/dist/web/thread-title-controller.js +0 -57
- package/dist/web/timeline-formatters.js +0 -249
- package/dist/web/timeline-reducer.js +0 -77
- package/dist/web/timeline-renderer.js +0 -161
- package/dist/web/timeline-scroll-controller.js +0 -50
- package/dist/web/timeline-sync.js +0 -67
- package/dist/web/usage-controller.js +0 -258
- package/dist/web/vendor/README.md +0 -14
- package/dist/web/vendor/highlight-powershell.min.js +0 -39
- package/dist/web/vendor/highlight.LICENSE.txt +0 -29
- package/dist/web/vendor/highlight.min.js +0 -1262
- package/dist/web/vendor/lucide.LICENSE.txt +0 -17
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
(function (root, factory) {
|
|
2
|
-
const create = factory();
|
|
3
|
-
if (typeof module === 'object' && module.exports) module.exports = create;
|
|
4
|
-
else root.createUsageController = create;
|
|
5
|
-
})(globalThis, function () {
|
|
6
|
-
function createUsageController(options) {
|
|
7
|
-
const { document, el, transport, api } = options;
|
|
8
|
-
let stream = null, latest = null, clock;
|
|
9
|
-
|
|
10
|
-
function windowLabel(window, now = Date.now()) {
|
|
11
|
-
if (!window) return '';
|
|
12
|
-
const duration = Number(window.windowDurationMins);
|
|
13
|
-
const label = duration === 300 ? '5 小时' : duration === 10080 ? '周' : duration > 0 ? `${duration} 分钟` : '额度';
|
|
14
|
-
const used = typeof window.usedPercent === 'number' && Number.isFinite(window.usedPercent)
|
|
15
|
-
? Math.max(0, Math.min(100, window.usedPercent)) : null;
|
|
16
|
-
const remaining = used === null ? null : 100 - used;
|
|
17
|
-
const resetAt = Number(window.resetsAt) * 1000;
|
|
18
|
-
const validReset = Number.isFinite(resetAt) && resetAt > 0;
|
|
19
|
-
const reset = validReset ? new Date(resetAt).toLocaleString('zh-CN', {
|
|
20
|
-
month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', hour12: false }) : '';
|
|
21
|
-
let countdown = '', ratio = null, timeElapsed = null;
|
|
22
|
-
if (validReset) {
|
|
23
|
-
const left = resetAt - now;
|
|
24
|
-
if (duration > 0 && Number.isFinite(duration) && left <= duration * 60000) {
|
|
25
|
-
timeElapsed = Math.max(0, Math.min(100, 100 - left / (duration * 60000) * 100));
|
|
26
|
-
}
|
|
27
|
-
if (left <= 0) countdown = '已到重置时间,等待额度更新';
|
|
28
|
-
else {
|
|
29
|
-
const minutes = Math.ceil(left / 60000);
|
|
30
|
-
const days = Math.floor(minutes / 1440), hours = Math.floor(minutes % 1440 / 60), mins = minutes % 60;
|
|
31
|
-
countdown = `剩余 ${[days && `${days}天`, hours && `${hours}小时`, mins && `${mins}分钟`].filter(Boolean).join('')}`;
|
|
32
|
-
if (timeElapsed > 0 && used !== null) ratio = used / timeElapsed;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const segments = duration === 300 ? 5 : duration === 10080 ? 7 : 0;
|
|
36
|
-
const scaleLabels = [];
|
|
37
|
-
if (duration === 300 && validReset) {
|
|
38
|
-
for (let index = 0; index <= segments; index++) {
|
|
39
|
-
const time = new Date(resetAt - index * 60 * 60000).toLocaleTimeString('zh-CN', {
|
|
40
|
-
hour: '2-digit', minute: '2-digit', hour12: false });
|
|
41
|
-
scaleLabels.push({ position: index / segments * 100, text: time });
|
|
42
|
-
}
|
|
43
|
-
} else if (duration === 10080) {
|
|
44
|
-
for (let day = 0; day <= segments; day++) {
|
|
45
|
-
scaleLabels.push({ position: day / segments * 100, text: String(day) });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return { label, used, remaining, timeElapsed, timeRemaining: timeElapsed === null ? null : 100 - timeElapsed,
|
|
49
|
-
reset, countdown, ratio, segments, scaleLabels };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function appendRemainingLabel(container, label, value, colorize = false) {
|
|
53
|
-
container.append(document.createTextNode(`${label} `));
|
|
54
|
-
const percentage = document.createElement('span');
|
|
55
|
-
percentage.className = 'usage-percentage';
|
|
56
|
-
percentage.textContent = value === null ? '—%' : `${Math.round(value)}%`;
|
|
57
|
-
if (colorize && value !== null) percentage.style.color = `hsl(${Math.round(value * 1.2)}, 68%, 52%)`;
|
|
58
|
-
container.append(percentage);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function mainLimit(data) {
|
|
62
|
-
return data?.rateLimitsByLimitId?.codex
|
|
63
|
-
|| ((!data?.rateLimits?.limitId || data.rateLimits.limitId === 'codex') ? data?.rateLimits : null);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function visibleWindows(data) {
|
|
67
|
-
const limit = mainLimit(data);
|
|
68
|
-
const pro = ['pro', 'prolite'].includes(String(limit?.planType || data?.rateLimits?.planType || '').toLowerCase());
|
|
69
|
-
return [limit?.primary, limit?.secondary]
|
|
70
|
-
.filter(window => window && (Number(window.windowDurationMins) === 10080
|
|
71
|
-
|| (!pro && Number(window.windowDurationMins) === 300)))
|
|
72
|
-
.sort((left, right) => Number(right.windowDurationMins) - Number(left.windowDurationMins));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function summary(data, now = Date.now()) {
|
|
76
|
-
const windows = visibleWindows(data)
|
|
77
|
-
.filter(window => typeof window?.usedPercent === 'number' && Number.isFinite(window.usedPercent));
|
|
78
|
-
if (!windows.length) return { label: '剩余', remaining: null, pace: '', paceClass: '', title: '暂无 Codex 主额度数据,点击查看详情' };
|
|
79
|
-
const window = windows.reduce((lowest, item) => item.usedPercent > lowest.usedPercent ? item : lowest);
|
|
80
|
-
const remaining = Math.round(Math.max(0, Math.min(100, 100 - window.usedPercent)));
|
|
81
|
-
const name = window.windowDurationMins === 300 ? '5 小时' : window.windowDurationMins === 10080 ? '周' : '限制窗口';
|
|
82
|
-
const ratio = windowLabel(window, now).ratio;
|
|
83
|
-
const pace = Number.isFinite(ratio) ? `${ratio.toFixed(2)}×` : '';
|
|
84
|
-
const paceClass = pace ? ratio <= 1 ? 'usage-ratio-good' : 'usage-ratio-low' : '';
|
|
85
|
-
return { label: `${name}剩余`, remaining, pace, paceClass,
|
|
86
|
-
title: `${name}额度剩余 ${remaining}%;${pace ? `已用额度 ÷ 已过时间 ${pace};` : ''}显示主额度中剩余较少的窗口,点击查看详情` };
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function renderSummary(data = latest) {
|
|
90
|
-
const value = summary(data);
|
|
91
|
-
const remaining = document.createElement('span');
|
|
92
|
-
appendRemainingLabel(remaining, value.label, value.remaining, true);
|
|
93
|
-
const content = [remaining];
|
|
94
|
-
if (value.pace) {
|
|
95
|
-
const ratio = document.createElement('span');
|
|
96
|
-
ratio.className = `usage-summary-ratio ${value.paceClass}`;
|
|
97
|
-
ratio.textContent = value.pace;
|
|
98
|
-
content.push(ratio);
|
|
99
|
-
}
|
|
100
|
-
el('usageSummary').replaceChildren(...content);
|
|
101
|
-
el('usageButton').title = value.title;
|
|
102
|
-
el('usageButton').setAttribute('aria-label', value.title);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function renderDetails(data) {
|
|
106
|
-
const rows = [];
|
|
107
|
-
const windows = visibleWindows(data).map(window => windowLabel(window));
|
|
108
|
-
if (windows.length) {
|
|
109
|
-
const group = document.createElement('div');
|
|
110
|
-
group.className = 'usage-group';
|
|
111
|
-
for (const window of windows) {
|
|
112
|
-
const section = document.createElement('div');
|
|
113
|
-
section.className = 'usage-window';
|
|
114
|
-
const heading = document.createElement('strong');
|
|
115
|
-
heading.textContent = window.label;
|
|
116
|
-
const header = document.createElement('div');
|
|
117
|
-
header.className = 'usage-heading';
|
|
118
|
-
header.append(heading);
|
|
119
|
-
const ratio = document.createElement('span');
|
|
120
|
-
ratio.className = `usage-ratio ${window.ratio === null ? '' : window.ratio <= 1 ? 'usage-ratio-good' : 'usage-ratio-low'}`;
|
|
121
|
-
ratio.textContent = window.ratio === null ? '—×' : `${window.ratio.toFixed(2)}×`;
|
|
122
|
-
ratio.title = '已用额度 ÷ 已过时间;1× 为均匀使用基准';
|
|
123
|
-
ratio.setAttribute('aria-label', `${ratio.title},当前 ${ratio.textContent}`);
|
|
124
|
-
header.append(ratio);
|
|
125
|
-
section.append(header);
|
|
126
|
-
|
|
127
|
-
const timeline = document.createElement('div');
|
|
128
|
-
timeline.className = `usage-timeline ${window.ratio !== null && window.ratio > 1 ? 'usage-timeline-ahead' : ''}`;
|
|
129
|
-
const value = document.createElement('div');
|
|
130
|
-
value.className = 'usage-timeline-summary';
|
|
131
|
-
const used = document.createElement('span');
|
|
132
|
-
used.className = 'usage-timeline-used';
|
|
133
|
-
appendRemainingLabel(used, '额度剩余', window.remaining, true);
|
|
134
|
-
const elapsed = document.createElement('span');
|
|
135
|
-
elapsed.className = 'usage-timeline-elapsed';
|
|
136
|
-
appendRemainingLabel(elapsed, '时间剩余', window.timeRemaining);
|
|
137
|
-
value.append(used);
|
|
138
|
-
|
|
139
|
-
const track = document.createElement('div');
|
|
140
|
-
track.className = 'usage-timeline-track';
|
|
141
|
-
track.setAttribute('role', 'img');
|
|
142
|
-
track.setAttribute('aria-label', `${window.label}额度:${used.textContent},${elapsed.textContent}`);
|
|
143
|
-
if (window.used !== null) {
|
|
144
|
-
const fill = document.createElement('span');
|
|
145
|
-
fill.className = 'usage-timeline-fill';
|
|
146
|
-
fill.style.width = `${window.remaining}%`;
|
|
147
|
-
track.append(fill);
|
|
148
|
-
}
|
|
149
|
-
if (window.segments > 0) {
|
|
150
|
-
for (let index = 1; index < window.segments; index++) {
|
|
151
|
-
const tick = document.createElement('span');
|
|
152
|
-
tick.className = 'usage-timeline-tick';
|
|
153
|
-
tick.style.left = `${index / window.segments * 100}%`;
|
|
154
|
-
track.append(tick);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (window.timeElapsed !== null) {
|
|
158
|
-
const marker = document.createElement('span');
|
|
159
|
-
marker.className = 'usage-timeline-now';
|
|
160
|
-
marker.style.left = `${window.timeRemaining}%`;
|
|
161
|
-
marker.title = `当前时间 · 时间剩余 ${Math.round(window.timeRemaining)}%`;
|
|
162
|
-
track.append(marker);
|
|
163
|
-
}
|
|
164
|
-
timeline.append(value, track);
|
|
165
|
-
|
|
166
|
-
if (window.scaleLabels.length) {
|
|
167
|
-
const scale = document.createElement('div');
|
|
168
|
-
scale.className = 'usage-timeline-scale';
|
|
169
|
-
for (const label of window.scaleLabels) {
|
|
170
|
-
const tickLabel = document.createElement('span');
|
|
171
|
-
tickLabel.className = `usage-timeline-scale-label${label.position === 0 ? ' is-first' : label.position === 100 ? ' is-last' : ''}`;
|
|
172
|
-
tickLabel.style.left = `${label.position}%`;
|
|
173
|
-
tickLabel.textContent = label.text;
|
|
174
|
-
scale.append(tickLabel);
|
|
175
|
-
}
|
|
176
|
-
timeline.append(scale);
|
|
177
|
-
}
|
|
178
|
-
const timeSummary = document.createElement('div');
|
|
179
|
-
timeSummary.className = 'usage-timeline-time-summary';
|
|
180
|
-
timeSummary.append(elapsed);
|
|
181
|
-
timeline.append(timeSummary);
|
|
182
|
-
section.append(timeline);
|
|
183
|
-
const detail = document.createElement('div');
|
|
184
|
-
detail.className = 'usage-window-detail';
|
|
185
|
-
detail.textContent = window.reset ? `${window.reset} 重置 · ${window.countdown}` : '重置时间暂不可用';
|
|
186
|
-
section.append(detail);
|
|
187
|
-
group.append(section);
|
|
188
|
-
}
|
|
189
|
-
rows.push(group);
|
|
190
|
-
}
|
|
191
|
-
const plan = (mainLimit(data)?.planType || data?.rateLimits?.planType || '未知').toLowerCase();
|
|
192
|
-
el('usagePlan').textContent = plan === 'pro' || plan === 'prolite' ? 'Pro' : plan.toUpperCase();
|
|
193
|
-
if (plan === 'pro' || plan === 'prolite') {
|
|
194
|
-
const tier = document.createElement('span');
|
|
195
|
-
tier.className = 'usage-plan-tier';
|
|
196
|
-
tier.textContent = plan === 'pro' ? '×20' : '×5';
|
|
197
|
-
el('usagePlan').append(tier);
|
|
198
|
-
}
|
|
199
|
-
el('usageRows').replaceChildren(...rows);
|
|
200
|
-
if (!rows.length) el('usageRows').textContent = '暂无额度数据';
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
async function load() {
|
|
204
|
-
el('usageRows').textContent = '正在查询…';
|
|
205
|
-
el('usageRows').removeAttribute('title');
|
|
206
|
-
try {
|
|
207
|
-
const data = (stream && latest) || await api('/api/usage-limits');
|
|
208
|
-
latest = data;
|
|
209
|
-
renderSummary();
|
|
210
|
-
renderDetails(data);
|
|
211
|
-
} catch (error) {
|
|
212
|
-
el('usageRows').textContent = '额度查询失败';
|
|
213
|
-
el('usageRows').title = error.message;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function start() {
|
|
218
|
-
if (stream) return;
|
|
219
|
-
const source = transport.usageEvents();
|
|
220
|
-
if (!source) { void load(); return; }
|
|
221
|
-
stream = source;
|
|
222
|
-
source.addEventListener('usage', event => {
|
|
223
|
-
latest = JSON.parse(event.data);
|
|
224
|
-
renderSummary();
|
|
225
|
-
if (el('usageDialog').open) {
|
|
226
|
-
if (latest) void load();
|
|
227
|
-
else { el('usageRows').textContent = '等待连接恢复…'; el('usagePlan').textContent = ''; }
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
source.addEventListener('usage-error', event => {
|
|
231
|
-
if (!latest) { el('usageRows').textContent = '额度读取失败'; el('usageRows').title = JSON.parse(event.data).error; }
|
|
232
|
-
});
|
|
233
|
-
source.onerror = () => {
|
|
234
|
-
latest = null;
|
|
235
|
-
renderSummary();
|
|
236
|
-
if (el('usageDialog').open) el('usageRows').textContent = '等待连接恢复…';
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function open() {
|
|
241
|
-
el('usageDialog').showModal();
|
|
242
|
-
void load();
|
|
243
|
-
clearInterval(clock);
|
|
244
|
-
clock = setInterval(() => { if (latest) renderDetails(latest); }, 30000);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function close() {
|
|
248
|
-
clearInterval(clock);
|
|
249
|
-
stream?.close();
|
|
250
|
-
stream = null;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
el('usageDialog').addEventListener('close', () => { clearInterval(clock); });
|
|
254
|
-
return Object.freeze({ start, load, open, close, refreshSummary: () => renderSummary() });
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
return createUsageController;
|
|
258
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Vendored browser dependency
|
|
2
|
-
|
|
3
|
-
- `markdown-it.umd.min.js`: markdown-it 15.0.2 browser UMD build
|
|
4
|
-
- Source: https://github.com/markdown-it/markdown-it
|
|
5
|
-
- License: MIT; see `markdown-it.LICENSE.txt`
|
|
6
|
-
- SHA-256: `635972b985228e8af9f0143647c68616b7a3bb09f6946e7e4a52e43dcf5e7be5`
|
|
7
|
-
- `highlight.min.js`: highlight.js 11.12.0 common browser build
|
|
8
|
-
- `highlight-powershell.min.js`: highlight.js 11.12.0 PowerShell language module
|
|
9
|
-
- Source: https://github.com/highlightjs/highlight.js
|
|
10
|
-
- License: BSD-3-Clause; see `highlight.LICENSE.txt`
|
|
11
|
-
- SHA-256 (`highlight.min.js`): `8ab71eb09c51f501e5e25157d9cff100e46cc29bcbfc744d0b746d451fca7f53`
|
|
12
|
-
- SHA-256 (`highlight-powershell.min.js`): `fc298b3e0db362e531e6d58988b7a78f83da19df6b5d74db75bc961b2bfbfd3d`
|
|
13
|
-
|
|
14
|
-
These files are served locally by the Bridge. They are not fetched from a CDN at runtime.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*! `powershell` grammar compiled for Highlight.js 11.12.0 */
|
|
2
|
-
(()=>{var e=(()=>{"use strict";return e=>{const n={$pattern:/-?[A-z\.\-]+\b/,
|
|
3
|
-
keyword:"if else foreach return do while until elseif begin for trap data dynamicparam end break throw param continue finally in switch exit filter try process catch hidden static parameter",
|
|
4
|
-
built_in:"ac asnp cat cd CFS chdir clc clear clhy cli clp cls clv cnsn compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo|0 epal epcsv epsn erase etsn exsn fc fhx fl ft fw gal gbp gc gcb gci gcm gcs gdr gerr ghy gi gin gjb gl gm gmo gp gps gpv group gsn gsnp gsv gtz gu gv gwmi h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc scb select set shcm si sl sleep sls sort sp spjb spps spsv start stz sujb sv swmi tee trcm type wget where wjb write"
|
|
5
|
-
},s={begin:"`[\\s\\S]",relevance:0},i={className:"variable",variants:[{
|
|
6
|
-
begin:/\$\B/},{className:"keyword",begin:/\$this/},{begin:/\$[\w\d][\w\d_:]*/}]
|
|
7
|
-
},a={className:"string",variants:[{begin:/"/,end:/"/},{begin:/@"/,end:/^"@/}],
|
|
8
|
-
contains:[s,i,{className:"variable",begin:/\$[A-z]/,end:/[^A-z]/}]},t={
|
|
9
|
-
className:"string",variants:[{begin:/'/,end:/'/},{begin:/@'/,end:/^'@/}]
|
|
10
|
-
},r=e.inherit(e.COMMENT(null,null),{variants:[{begin:/#/,end:/$/},{begin:/<#/,
|
|
11
|
-
end:/#>/}],contains:[{className:"doctag",variants:[{
|
|
12
|
-
begin:/\.(synopsis|description|example|inputs|outputs|notes|link|component|role|functionality)/
|
|
13
|
-
},{
|
|
14
|
-
begin:/\.(parameter|forwardhelptargetname|forwardhelpcategory|remotehelprunspace|externalhelp)\s+\S+/
|
|
15
|
-
}]}]}),c={className:"class",beginKeywords:"class enum",end:/\s*[{]/,
|
|
16
|
-
excludeEnd:!0,relevance:0,contains:[e.TITLE_MODE]},l={className:"function",
|
|
17
|
-
begin:/function\s+/,end:/\s*\{|$/,excludeEnd:!0,returnBegin:!0,relevance:0,
|
|
18
|
-
contains:[{begin:"function",relevance:0,className:"keyword"},{className:"title",
|
|
19
|
-
begin:/\w[\w\d]*((-)[\w\d]+)*/,relevance:0},{begin:/\(/,end:/\)/,
|
|
20
|
-
className:"params",relevance:0,contains:[i]}]},o={begin:/using\s/,end:/$/,
|
|
21
|
-
returnBegin:!0,contains:[a,t,{className:"keyword",
|
|
22
|
-
begin:/(using|assembly|command|module|namespace|type)/}]},p={
|
|
23
|
-
className:"function",begin:/\[.*\]\s*[\w]+[ ]??\(/,end:/$/,returnBegin:!0,
|
|
24
|
-
relevance:0,contains:[{className:"keyword",
|
|
25
|
-
begin:"(".concat(n.keyword.toString().replace(/\s/g,"|"),")\\b"),endsParent:!0,
|
|
26
|
-
relevance:0},e.inherit(e.TITLE_MODE,{endsParent:!0})]
|
|
27
|
-
},g=[p,r,s,e.NUMBER_MODE,a,t,{className:"built_in",variants:[{
|
|
28
|
-
begin:"(Add|Clear|Close|Copy|Enter|Exit|Find|Format|Get|Hide|Join|Lock|Move|New|Open|Optimize|Pop|Push|Redo|Remove|Rename|Reset|Resize|Search|Select|Set|Show|Skip|Split|Step|Switch|Undo|Unlock|Watch|Backup|Checkpoint|Compare|Compress|Convert|ConvertFrom|ConvertTo|Dismount|Edit|Expand|Export|Group|Import|Initialize|Limit|Merge|Mount|Out|Publish|Restore|Save|Sync|Unpublish|Update|Approve|Assert|Build|Complete|Confirm|Deny|Deploy|Disable|Enable|Install|Invoke|Register|Request|Restart|Resume|Start|Stop|Submit|Suspend|Uninstall|Unregister|Wait|Debug|Measure|Ping|Repair|Resolve|Test|Trace|Connect|Disconnect|Read|Receive|Send|Write|Block|Grant|Protect|Revoke|Unblock|Unprotect|Use|ForEach|Sort|Tee|Where)+(-)[\\w\\d]+"
|
|
29
|
-
}]},i,{className:"literal",begin:/\$(null|true|false)\b/},{
|
|
30
|
-
className:"selector-tag",begin:/@\B/,relevance:0}],m={begin:/\[/,end:/\]/,
|
|
31
|
-
excludeBegin:!0,excludeEnd:!0,relevance:0,contains:[].concat("self",g,{
|
|
32
|
-
begin:"(string|char|byte|int|long|bool|decimal|single|double|DateTime|xml|array|hashtable|void)",
|
|
33
|
-
className:"built_in",relevance:0},{className:"type",begin:/[\.\w\d]+/,
|
|
34
|
-
relevance:0})};return p.contains.unshift(m),{name:"PowerShell",
|
|
35
|
-
aliases:["pwsh","ps","ps1"],case_insensitive:!0,keywords:n,
|
|
36
|
-
contains:g.concat(c,l,o,{variants:[{className:"operator",
|
|
37
|
-
begin:"(-and|-as|-band|-bnot|-bor|-bxor|-casesensitive|-ccontains|-ceq|-cge|-cgt|-cle|-clike|-clt|-cmatch|-cne|-cnotcontains|-cnotlike|-cnotmatch|-contains|-creplace|-csplit|-eq|-exact|-f|-file|-ge|-gt|-icontains|-ieq|-ige|-igt|-ile|-ilike|-ilt|-imatch|-in|-ine|-inotcontains|-inotlike|-inotmatch|-ireplace|-is|-isnot|-isplit|-join|-le|-like|-lt|-match|-ne|-not|-notcontains|-notin|-notlike|-notmatch|-or|-regex|-replace|-shl|-shr|-split|-wildcard|-xor)\\b"
|
|
38
|
-
},{className:"literal",begin:/(-){1,2}[\w\d-]+/,relevance:0}]},m)}}})()
|
|
39
|
-
;hljs.registerLanguage("powershell",e)})();
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2006, Ivan Sagalaev.
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without
|
|
7
|
-
modification, are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
-
this list of conditions and the following disclaimer in the documentation
|
|
14
|
-
and/or other materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
* Neither the name of the copyright holder nor the names of its
|
|
17
|
-
contributors may be used to endorse or promote products derived from
|
|
18
|
-
this software without specific prior written permission.
|
|
19
|
-
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|