framer-code-link 0.2.9 → 0.2.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/dist/index.mjs +17 -16
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -118,7 +118,7 @@ let LogLevel = /* @__PURE__ */ function(LogLevel$1) {
|
|
|
118
118
|
let currentLevel = LogLevel.INFO;
|
|
119
119
|
let lastMessage = "";
|
|
120
120
|
let lastMessageCount = 0;
|
|
121
|
-
let
|
|
121
|
+
let lastCategory = "other";
|
|
122
122
|
const CLEAR_LINE = "\x1B[2K";
|
|
123
123
|
const MOVE_CURSOR_UP = "\x1B[1A";
|
|
124
124
|
function rewriteLastLine(text) {
|
|
@@ -144,25 +144,23 @@ function flushDedupe() {
|
|
|
144
144
|
lastMessageCount = 0;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
|
-
*
|
|
147
|
+
* Handle category transition - adds newline when switching categories
|
|
148
148
|
*/
|
|
149
|
-
function
|
|
150
|
-
if (
|
|
149
|
+
function transitionCategory(newCategory) {
|
|
150
|
+
if (lastCategory !== newCategory) {
|
|
151
151
|
console.log();
|
|
152
|
-
|
|
152
|
+
lastCategory = newCategory;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
/**
|
|
156
156
|
* Log with deduplication - repeated messages within window get counted
|
|
157
157
|
*/
|
|
158
|
-
function logWithDedupe(message, writer
|
|
158
|
+
function logWithDedupe(message, writer) {
|
|
159
159
|
if (message === lastMessage) {
|
|
160
160
|
lastMessageCount++;
|
|
161
161
|
dedupeMessage(message, lastMessageCount);
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
|
-
if (isFileSync && !lastWasFileSync) console.log();
|
|
165
|
-
lastWasFileSync = isFileSync;
|
|
166
164
|
lastMessage = message;
|
|
167
165
|
lastMessageCount = 1;
|
|
168
166
|
writer();
|
|
@@ -188,7 +186,7 @@ function debug(message, ...args) {
|
|
|
188
186
|
*/
|
|
189
187
|
function info(message, ...args) {
|
|
190
188
|
if (currentLevel <= LogLevel.INFO) {
|
|
191
|
-
|
|
189
|
+
transitionCategory("other");
|
|
192
190
|
const formatted = args.length > 0 ? `${message} ${args.join(" ")}` : message;
|
|
193
191
|
logWithDedupe(formatted, () => console.log(formatted));
|
|
194
192
|
}
|
|
@@ -199,7 +197,7 @@ function info(message, ...args) {
|
|
|
199
197
|
function warn(message, ...args) {
|
|
200
198
|
if (currentLevel <= LogLevel.WARN) {
|
|
201
199
|
if (message === lastMessage) return;
|
|
202
|
-
|
|
200
|
+
transitionCategory("other");
|
|
203
201
|
flushDedupe();
|
|
204
202
|
lastMessage = message;
|
|
205
203
|
lastMessageCount = 1;
|
|
@@ -211,7 +209,7 @@ function warn(message, ...args) {
|
|
|
211
209
|
*/
|
|
212
210
|
function error(message, ...args) {
|
|
213
211
|
if (currentLevel <= LogLevel.ERROR) {
|
|
214
|
-
|
|
212
|
+
transitionCategory("other");
|
|
215
213
|
flushDedupe();
|
|
216
214
|
console.error(import_picocolors.default.red(`✗ ${message}`), ...args);
|
|
217
215
|
}
|
|
@@ -221,7 +219,7 @@ function error(message, ...args) {
|
|
|
221
219
|
*/
|
|
222
220
|
function success(message, ...args) {
|
|
223
221
|
if (currentLevel <= LogLevel.INFO) {
|
|
224
|
-
|
|
222
|
+
transitionCategory("other");
|
|
225
223
|
flushDedupe();
|
|
226
224
|
console.log(import_picocolors.default.green(`✓ ${message}`), ...args);
|
|
227
225
|
}
|
|
@@ -231,20 +229,23 @@ function success(message, ...args) {
|
|
|
231
229
|
*/
|
|
232
230
|
function fileDown(fileName) {
|
|
233
231
|
if (currentLevel <= LogLevel.INFO) {
|
|
232
|
+
transitionCategory("file-sync");
|
|
234
233
|
const msg = ` ${import_picocolors.default.blue("↓")} ${fileName}`;
|
|
235
|
-
logWithDedupe(msg, () => console.log(msg)
|
|
234
|
+
logWithDedupe(msg, () => console.log(msg));
|
|
236
235
|
}
|
|
237
236
|
}
|
|
238
237
|
function fileUp(fileName) {
|
|
239
238
|
if (currentLevel <= LogLevel.INFO) {
|
|
239
|
+
transitionCategory("file-sync");
|
|
240
240
|
const msg = ` ${import_picocolors.default.green("↑")} ${fileName}`;
|
|
241
|
-
logWithDedupe(msg, () => console.log(msg)
|
|
241
|
+
logWithDedupe(msg, () => console.log(msg));
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
function fileDelete(fileName) {
|
|
245
245
|
if (currentLevel <= LogLevel.INFO) {
|
|
246
|
+
transitionCategory("file-sync");
|
|
246
247
|
const msg = ` ${import_picocolors.default.red("×")} ${fileName}`;
|
|
247
|
-
logWithDedupe(msg, () => console.log(msg)
|
|
248
|
+
logWithDedupe(msg, () => console.log(msg));
|
|
248
249
|
}
|
|
249
250
|
}
|
|
250
251
|
/**
|
|
@@ -252,7 +253,7 @@ function fileDelete(fileName) {
|
|
|
252
253
|
*/
|
|
253
254
|
function status(message) {
|
|
254
255
|
if (currentLevel <= LogLevel.INFO) {
|
|
255
|
-
|
|
256
|
+
transitionCategory("other");
|
|
256
257
|
flushDedupe();
|
|
257
258
|
console.log(import_picocolors.default.dim(` ${message}`));
|
|
258
259
|
}
|