@jsenv/terminal-recorder 1.5.53 → 1.5.56

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.
Files changed (35) hide show
  1. package/dist/jsenv_terminal_recorder_node_modules.js +3 -2
  2. package/package.json +5 -5
  3. package/src/.jsenv/chrome@149.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/packages/internal/plugin-supervisor/src/client/supervisor.js +24 -3
  4. package/src/.jsenv/chrome@149.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/dependency_status/client/dependency_status.js +233 -2
  5. package/src/.jsenv/chrome@149.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/page_switcher/client/page_switcher.js +136 -13
  6. package/src/.jsenv/chrome@149.0.0/xterm.html +5 -1
  7. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-fit/lib/addon-fit.mjs +18 -0
  8. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-fit/lib/addon-fit.mjs.map +28 -0
  9. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs +19 -0
  10. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-serialize/lib/addon-serialize.mjs.map +176 -0
  11. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-webgl/lib/addon-webgl.mjs +101 -0
  12. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/addon-webgl/lib/addon-webgl.mjs.map +1623 -0
  13. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/xterm/css/xterm.css +267 -0
  14. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/xterm/lib/xterm.mjs +53 -0
  15. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/node_modules/@xterm/xterm/lib/xterm.mjs.map +7 -0
  16. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/packages/backend/server/src/plugins/autoreload_on_server_restart/client/autoreload_on_server_restart.js +133 -0
  17. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/packages/frontend/custom-elements-redefine/src/main.js +217 -0
  18. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/packages/internal/plugin-supervisor/src/client/supervisor.js +1607 -0
  19. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/client_monitoring/client/client_reporter.js +578 -0
  20. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/dependency_status/client/dependency_status.js +290 -0
  21. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/drop_to_open/client/drop_to_open.js +49 -0
  22. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/page_switcher/client/page_switcher.js +854 -0
  23. package/src/.jsenv/chrome@151.0.0/@fs/Users/dmail/Documents/dev/jsenv/core/src/plugins/server_events/client/server_events_client.js +461 -0
  24. package/src/.jsenv/chrome@151.0.0/gif_encoder.js +400 -0
  25. package/src/.jsenv/chrome@151.0.0/gif_encoder.js.map +11 -0
  26. package/src/.jsenv/chrome@151.0.0/lzw_encoder.js +253 -0
  27. package/src/.jsenv/chrome@151.0.0/neuquant.js +498 -0
  28. package/src/.jsenv/chrome@151.0.0/terminal_recorder.js +384 -0
  29. package/src/.jsenv/chrome@151.0.0/terminal_recorder.js.map +11 -0
  30. package/src/.jsenv/chrome@151.0.0/xterm.html +88 -0
  31. package/src/.jsenv/chrome@151.0.0/xterm.html@L11C7-L15C16.js +5 -0
  32. package/src/.jsenv/chrome@151.0.0/xterm.html@L14C5-L18C14.js +5 -0
  33. package/src/.jsenv/chrome@151.0.0/xterm.html@L17C7-L21C16.js +5 -0
  34. package/src/.jsenv/chrome@151.0.0/xterm.html@L19C5-L24C14.js +7 -0
  35. package/src/.jsenv/chrome@151.0.0/xterm.html@L19C5-L24C14.js.map +11 -0
@@ -0,0 +1,290 @@
1
+ /*
2
+ * Displays the "some dependencies are outdated" warning overlay.
3
+ *
4
+ * A missing dependency is not handled here: it makes the import fail, so the
5
+ * error overlay already says it, with more precision (which import, where).
6
+ *
7
+ * The overlay does not only describe the problem, it shows the dev server
8
+ * watching for the fix: the paths being looked at are named and kept alive on
9
+ * screen, so waiting for "npm install" feels like waiting for something that is
10
+ * actually going to happen.
11
+ */
12
+
13
+ let removeOverlay = () => {};
14
+ let watchInfoFromServer = {};
15
+ // packages listed as outdated at some point, and the path watched for each;
16
+ // what leaves this map has been installed while the overlay was open, which is
17
+ // worth showing as such
18
+ const outdatedPathMap = new Map();
19
+
20
+ export const initDependencyStatus = ({ problems, watchInfo }) => {
21
+ watchInfoFromServer = watchInfo || {};
22
+ render(problems);
23
+ // without the server events channel the page only knows the state it was
24
+ // served with, which is still better than nothing
25
+ if (window.__server_events__) {
26
+ window.__server_events__.listenEvents({
27
+ dependency_status: (event) => {
28
+ render(event.data.problems);
29
+ },
30
+ });
31
+ }
32
+ };
33
+
34
+ const render = (problems) => {
35
+ const outdatedList = problems.filter(({ state }) => state === "outdated");
36
+ removeOverlay();
37
+ removeOverlay = () => {};
38
+ const installedList = [];
39
+ for (const [packageName, watchedPath] of outdatedPathMap) {
40
+ if (!outdatedList.some((problem) => problem.packageName === packageName)) {
41
+ installedList.push({ packageName, watchedPath });
42
+ }
43
+ }
44
+ if (outdatedList.length === 0) {
45
+ outdatedPathMap.clear();
46
+ return;
47
+ }
48
+ for (const { packageName, watchedPath } of outdatedList) {
49
+ outdatedPathMap.set(packageName, watchedPath);
50
+ }
51
+ const supervisor = window.__supervisor__;
52
+ if (!supervisor || !supervisor.reportWarning) {
53
+ console.warn(summarize(outdatedList));
54
+ return;
55
+ }
56
+ removeOverlay = supervisor.reportWarning({
57
+ title:
58
+ outdatedList.length === 1
59
+ ? "A dependency is outdated"
60
+ : `${outdatedList.length} dependencies are outdated`,
61
+ text: outdatedList.map(describe).join("\n\n"),
62
+ details: [
63
+ "The page is running with what is installed in node_modules, which is not what package.json asks for. It may work, but it is not the code the project expects.",
64
+ "Run npm install to fix it. If an install is already running, there is nothing to do but wait.",
65
+ ],
66
+ node: createWatchNode(outdatedList, installedList),
67
+ });
68
+ };
69
+
70
+ const describe = ({ packageName, declaredVersion, installedVersion }) => {
71
+ return `${packageName}
72
+ package.json declares ${declaredVersion}
73
+ node_modules holds ${installedVersion || "an unknown version"}`;
74
+ };
75
+
76
+ const summarize = (outdatedList) => {
77
+ return `[jsenv] outdated dependencies, run npm install: ${outdatedList
78
+ .map(({ packageName }) => packageName)
79
+ .join(", ")}`;
80
+ };
81
+
82
+ const createWatchNode = (outdatedList, installedList) => {
83
+ const { packageJsonPath = "package.json", pollInterval } =
84
+ watchInfoFromServer;
85
+ const node = document.createElement("div");
86
+ node.className = "dependency_watch";
87
+ const rows = [];
88
+ rows.push(
89
+ createRow({
90
+ state: "watching",
91
+ path: packageJsonPath,
92
+ // a file watcher, not a poll: an edit here is what puts a dependency out
93
+ // of date in the first place
94
+ note: "on every change",
95
+ pollInterval,
96
+ }),
97
+ );
98
+ for (const { packageName, declaredVersion, watchedPath } of outdatedList) {
99
+ rows.push(
100
+ createRow({
101
+ state: "watching",
102
+ path: watchedPath || `node_modules/${packageName}/package.json`,
103
+ note: pollInterval
104
+ ? `waiting for ${declaredVersion}, read every ${pollInterval}ms`
105
+ : `waiting for ${declaredVersion}`,
106
+ pollInterval,
107
+ }),
108
+ );
109
+ }
110
+ for (const { packageName, watchedPath } of installedList) {
111
+ rows.push(
112
+ createRow({
113
+ state: "done",
114
+ path: watchedPath || `node_modules/${packageName}/package.json`,
115
+ note: "installed",
116
+ }),
117
+ );
118
+ }
119
+ node.innerHTML = `
120
+ <style>
121
+ ${watchCSS}
122
+ </style>
123
+ <div class="dependency_watch_head">
124
+ <span class="dependency_watch_live">
125
+ <span class="dependency_watch_live_dot"></span>watching
126
+ </span>
127
+ <span class="dependency_watch_head_text">
128
+ the files that will tell the install is over
129
+ </span>
130
+ </div>
131
+ <div class="dependency_watch_rows">
132
+ ${rows.join("\n ")}
133
+ </div>
134
+ <div class="dependency_watch_effect" data-copy-line>
135
+ As soon as node_modules matches package.json, this page reloads by itself.
136
+ </div>`;
137
+ return node;
138
+ };
139
+
140
+ const createRow = ({ state, path, note, pollInterval }) => {
141
+ const sweepStyle = pollInterval
142
+ ? ` style="animation-duration: ${pollInterval}ms"`
143
+ : "";
144
+ return `<div class="dependency_watch_row" data-state="${state}">
145
+ <span class="dependency_watch_row_icon"></span>
146
+ <code class="dependency_watch_row_path">${escapeHtml(path)}</code>
147
+ <span class="dependency_watch_row_note">${escapeHtml(note)}</span>
148
+ ${
149
+ state === "watching"
150
+ ? `<span class="dependency_watch_row_sweep"${sweepStyle}></span>`
151
+ : ""
152
+ }
153
+ </div>`;
154
+ };
155
+
156
+ const escapeHtml = (string) => {
157
+ return String(string)
158
+ .replace(/&/g, "&amp;")
159
+ .replace(/</g, "&lt;")
160
+ .replace(/>/g, "&gt;")
161
+ .replace(/"/g, "&quot;")
162
+ .replace(/'/g, "&#039;");
163
+ };
164
+
165
+ const watchCSS = /* css */ `
166
+ .dependency_watch_head {
167
+ display: flex;
168
+ margin-bottom: 8px;
169
+ align-items: center;
170
+ gap: 8px;
171
+ }
172
+ .dependency_watch_live {
173
+ display: flex;
174
+ padding: 2px 8px;
175
+ align-items: center;
176
+ gap: 6px;
177
+ color: #ffab40;
178
+ font-size: 12px;
179
+ text-transform: uppercase;
180
+ letter-spacing: 0.08em;
181
+ border: 1px solid currentColor;
182
+ border-radius: 999px;
183
+ }
184
+ .dependency_watch_live_dot {
185
+ width: 7px;
186
+ height: 7px;
187
+ background: currentColor;
188
+ border-radius: 50%;
189
+ animation: dependency_watch_pulse 1.4s ease-in-out infinite;
190
+ }
191
+ @keyframes dependency_watch_pulse {
192
+ 0%,
193
+ 100% {
194
+ opacity: 0.25;
195
+ transform: scale(0.8);
196
+ }
197
+ 50% {
198
+ opacity: 1;
199
+ transform: scale(1.15);
200
+ }
201
+ }
202
+ .dependency_watch_head_text {
203
+ font-size: 13px;
204
+ }
205
+
206
+ .dependency_watch_rows {
207
+ display: flex;
208
+ flex-direction: column;
209
+ gap: 4px;
210
+ }
211
+ .dependency_watch_row {
212
+ position: relative;
213
+ display: flex;
214
+ padding: 6px 10px;
215
+ align-items: center;
216
+ gap: 8px;
217
+ font-size: 13px;
218
+ background: rgba(255, 255, 255, 0.04);
219
+ border: 1px solid #333;
220
+ border-radius: 4px;
221
+ overflow: hidden;
222
+ }
223
+ .dependency_watch_row_icon {
224
+ width: 8px;
225
+ height: 8px;
226
+ flex: none;
227
+ border: 1px solid #ffab40;
228
+ border-radius: 50%;
229
+ }
230
+ .dependency_watch_row[data-state="done"] .dependency_watch_row_icon {
231
+ background: #7fd67f;
232
+ border-color: #7fd67f;
233
+ }
234
+ .dependency_watch_row_path {
235
+ color: #eee;
236
+ text-overflow: ellipsis;
237
+ white-space: nowrap;
238
+ overflow: hidden;
239
+ }
240
+ .dependency_watch_row_note {
241
+ margin-left: auto;
242
+ padding-left: 8px;
243
+ font-size: 12px;
244
+ white-space: nowrap;
245
+ opacity: 0.8;
246
+ }
247
+ .dependency_watch_row[data-state="done"] .dependency_watch_row_note {
248
+ color: #7fd67f;
249
+ opacity: 1;
250
+ }
251
+ /* the sweep is the watching made visible: one pass per read */
252
+ .dependency_watch_row_sweep {
253
+ position: absolute;
254
+ top: 0;
255
+ left: 0;
256
+ width: 35%;
257
+ height: 100%;
258
+ background: linear-gradient(
259
+ 90deg,
260
+ transparent,
261
+ rgba(255, 171, 64, 0.16),
262
+ transparent
263
+ );
264
+ animation: dependency_watch_sweep 2s linear infinite;
265
+ pointer-events: none;
266
+ }
267
+ @keyframes dependency_watch_sweep {
268
+ from {
269
+ transform: translateX(-100%);
270
+ }
271
+ to {
272
+ transform: translateX(340%);
273
+ }
274
+ }
275
+
276
+ .dependency_watch_effect {
277
+ margin-top: 8px;
278
+ color: #ffab40;
279
+ font-size: 13px;
280
+ }
281
+
282
+ @media (prefers-reduced-motion: reduce) {
283
+ .dependency_watch_live_dot {
284
+ animation: none;
285
+ }
286
+ .dependency_watch_row_sweep {
287
+ display: none;
288
+ }
289
+ }
290
+ `;
@@ -0,0 +1,49 @@
1
+ export const initDropToOpen = ({ rootDirectoryUrl }) => {
2
+ const dataTransferCandidates = [
3
+ (dataTransfer) => {
4
+ if (!dataTransfer.types.includes("resourceurls")) {
5
+ return null;
6
+ }
7
+ return () => {
8
+ const data = dataTransfer.getData("resourceurls");
9
+ const urls = JSON.parse(data);
10
+ if (!Array.isArray(urls) || urls.length === 0) {
11
+ return;
12
+ }
13
+ const [url] = urls;
14
+ const fileUrl = new URL(url).href;
15
+ let serverUrl;
16
+
17
+ if (fileUrl.startsWith(rootDirectoryUrl)) {
18
+ const serverRelativeUrl = fileUrl.slice(rootDirectoryUrl.length);
19
+ serverUrl = `/${serverRelativeUrl}`;
20
+ } else {
21
+ serverUrl = `/@fs/${fileUrl}`;
22
+ }
23
+ window.location.href = serverUrl;
24
+ };
25
+ },
26
+ ];
27
+
28
+ document.addEventListener("dragover", (event) => {
29
+ for (const candidate of dataTransferCandidates) {
30
+ const dataTransferHandler = candidate(event.dataTransfer);
31
+ if (dataTransferHandler) {
32
+ event.preventDefault();
33
+ return;
34
+ }
35
+ }
36
+ });
37
+ document.addEventListener("drop", (event) => {
38
+ let handler;
39
+ for (const candidate of dataTransferCandidates) {
40
+ const dataTransferHandler = candidate(event.dataTransfer);
41
+ if (dataTransferHandler) {
42
+ handler = dataTransferHandler;
43
+ break;
44
+ }
45
+ }
46
+ event.preventDefault();
47
+ handler();
48
+ });
49
+ };