@leftium/gg 0.0.17 → 0.0.19

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 CHANGED
@@ -44,14 +44,18 @@ The patched `debug` library is bundled directly into the distribution, so consum
44
44
 
45
45
  When a new version of `debug` is released:
46
46
 
47
- 1. Update debug in devDependencies: `pnpm add -D debug@x.x.x`
48
- 2. Run the update script: `./scripts/update-debug.sh`
49
- 3. Verify patches still apply: `git diff src/lib/debug/`
50
- 4. Test: `pnpm dev && pnpm prepack`
51
- 5. Commit: `git commit -am "Update bundled debug to x.x.x"`
47
+ 1. Update debug: `pnpm add debug@x.x.x`
48
+ 2. Update patch: `pnpm patch debug@x.x.x` (apply changes, then `pnpm patch-commit`)
49
+ 3. Run the update script: `./scripts/update-debug.sh`
50
+ 4. Verify patches are present: `git diff src/lib/debug/src/`
51
+ 5. Test dev mode: `pnpm dev`
52
+ 6. Test production build: `pnpm prepack`
53
+ 7. Commit changes: `git commit -am "Update bundled debug to x.x.x"`
52
54
 
53
55
  The patch is maintained in `patches/debug@4.4.3.patch` for reference.
54
56
 
57
+ **Note:** `debug` is kept in dependencies (not devDependencies) to support both dev and production modes.
58
+
55
59
  ## Inspirations
56
60
 
57
61
  ### debug
@@ -1 +1,272 @@
1
- function useColors(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(e){if(e[0]=(this.useColors?"%c":"")+`${("+"+module.exports.humanize(this.diff)).padStart(6)} ${this.namespace}`+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" "),!this.useColors)return;const o="color: "+this.color;e.splice(1,0,o,"color: inherit");let t=0,C=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e&&(C=t))}),e.splice(C,0,o)}function save(e){try{e?exports.storage.setItem("debug",e):exports.storage.removeItem("debug")}catch(e){}}function load(){let e;try{e=exports.storage.getItem("debug")||exports.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}function localstorage(){try{return localStorage}catch(e){}}exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],exports.log=console.debug||console.log||(()=>{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}};
1
+ /* eslint-env browser */
2
+
3
+ /**
4
+ * This is the web browser implementation of `debug()`.
5
+ */
6
+
7
+ exports.formatArgs = formatArgs;
8
+ exports.save = save;
9
+ exports.load = load;
10
+ exports.useColors = useColors;
11
+ exports.storage = localstorage();
12
+ exports.destroy = (() => {
13
+ let warned = false;
14
+
15
+ return () => {
16
+ if (!warned) {
17
+ warned = true;
18
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
19
+ }
20
+ };
21
+ })();
22
+
23
+ /**
24
+ * Colors.
25
+ */
26
+
27
+ exports.colors = [
28
+ '#0000CC',
29
+ '#0000FF',
30
+ '#0033CC',
31
+ '#0033FF',
32
+ '#0066CC',
33
+ '#0066FF',
34
+ '#0099CC',
35
+ '#0099FF',
36
+ '#00CC00',
37
+ '#00CC33',
38
+ '#00CC66',
39
+ '#00CC99',
40
+ '#00CCCC',
41
+ '#00CCFF',
42
+ '#3300CC',
43
+ '#3300FF',
44
+ '#3333CC',
45
+ '#3333FF',
46
+ '#3366CC',
47
+ '#3366FF',
48
+ '#3399CC',
49
+ '#3399FF',
50
+ '#33CC00',
51
+ '#33CC33',
52
+ '#33CC66',
53
+ '#33CC99',
54
+ '#33CCCC',
55
+ '#33CCFF',
56
+ '#6600CC',
57
+ '#6600FF',
58
+ '#6633CC',
59
+ '#6633FF',
60
+ '#66CC00',
61
+ '#66CC33',
62
+ '#9900CC',
63
+ '#9900FF',
64
+ '#9933CC',
65
+ '#9933FF',
66
+ '#99CC00',
67
+ '#99CC33',
68
+ '#CC0000',
69
+ '#CC0033',
70
+ '#CC0066',
71
+ '#CC0099',
72
+ '#CC00CC',
73
+ '#CC00FF',
74
+ '#CC3300',
75
+ '#CC3333',
76
+ '#CC3366',
77
+ '#CC3399',
78
+ '#CC33CC',
79
+ '#CC33FF',
80
+ '#CC6600',
81
+ '#CC6633',
82
+ '#CC9900',
83
+ '#CC9933',
84
+ '#CCCC00',
85
+ '#CCCC33',
86
+ '#FF0000',
87
+ '#FF0033',
88
+ '#FF0066',
89
+ '#FF0099',
90
+ '#FF00CC',
91
+ '#FF00FF',
92
+ '#FF3300',
93
+ '#FF3333',
94
+ '#FF3366',
95
+ '#FF3399',
96
+ '#FF33CC',
97
+ '#FF33FF',
98
+ '#FF6600',
99
+ '#FF6633',
100
+ '#FF9900',
101
+ '#FF9933',
102
+ '#FFCC00',
103
+ '#FFCC33'
104
+ ];
105
+
106
+ /**
107
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
108
+ * and the Firebug extension (any Firefox version) are known
109
+ * to support "%c" CSS customizations.
110
+ *
111
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
112
+ */
113
+
114
+ // eslint-disable-next-line complexity
115
+ function useColors() {
116
+ // NB: In an Electron preload script, document will be defined but not fully
117
+ // initialized. Since we know we're in Chrome, we'll just detect this case
118
+ // explicitly
119
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
120
+ return true;
121
+ }
122
+
123
+ // Internet Explorer and Edge do not support colors.
124
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
125
+ return false;
126
+ }
127
+
128
+ let m;
129
+
130
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
131
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
132
+ // eslint-disable-next-line no-return-assign
133
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
134
+ // Is firebug? http://stackoverflow.com/a/398120/376773
135
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
136
+ // Is firefox >= v31?
137
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
138
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
139
+ // Double check webkit in userAgent just in case we are in a worker
140
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
141
+ }
142
+
143
+ /**
144
+ * Colorize log arguments if enabled.
145
+ *
146
+ * @api public
147
+ */
148
+
149
+ function formatArgs(args) {
150
+ args[0] = (this.useColors ? '%c' : '') +
151
+ `${('+' + module.exports.humanize(this.diff)).padStart(6)} ${this.namespace}` +
152
+ (this.useColors ? ' %c' : ' ') +
153
+ args[0] +
154
+ (this.useColors ? '%c ' : ' ') +
155
+ '';
156
+
157
+ if (!this.useColors) {
158
+ return;
159
+ }
160
+
161
+ const c = 'color: ' + this.color;
162
+ args.splice(1, 0, c, 'color: inherit');
163
+
164
+ // The final "%c" is somewhat tricky, because there could be other
165
+ // arguments passed either before or after the %c, so we need to
166
+ // figure out the correct index to insert the CSS into
167
+ let index = 0;
168
+ let lastC = 0;
169
+ args[0].replace(/%[a-zA-Z%]/g, match => {
170
+ if (match === '%%') {
171
+ return;
172
+ }
173
+ index++;
174
+ if (match === '%c') {
175
+ // We only are interested in the *last* %c
176
+ // (the user may have provided their own)
177
+ lastC = index;
178
+ }
179
+ });
180
+
181
+ args.splice(lastC, 0, c);
182
+ }
183
+
184
+ /**
185
+ * Invokes `console.debug()` when available.
186
+ * No-op when `console.debug` is not a "function".
187
+ * If `console.debug` is not available, falls back
188
+ * to `console.log`.
189
+ *
190
+ * @api public
191
+ */
192
+ exports.log = console.debug || console.log || (() => {});
193
+
194
+ /**
195
+ * Save `namespaces`.
196
+ *
197
+ * @param {String} namespaces
198
+ * @api private
199
+ */
200
+ function save(namespaces) {
201
+ try {
202
+ if (namespaces) {
203
+ exports.storage.setItem('debug', namespaces);
204
+ } else {
205
+ exports.storage.removeItem('debug');
206
+ }
207
+ } catch (error) {
208
+ // Swallow
209
+ // XXX (@Qix-) should we be logging these?
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Load `namespaces`.
215
+ *
216
+ * @return {String} returns the previously persisted debug modes
217
+ * @api private
218
+ */
219
+ function load() {
220
+ let r;
221
+ try {
222
+ r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
223
+ } catch (error) {
224
+ // Swallow
225
+ // XXX (@Qix-) should we be logging these?
226
+ }
227
+
228
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
229
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
230
+ r = process.env.DEBUG;
231
+ }
232
+
233
+ return r;
234
+ }
235
+
236
+ /**
237
+ * Localstorage attempts to return the localstorage.
238
+ *
239
+ * This is necessary because safari throws
240
+ * when a user disables cookies/localstorage
241
+ * and you attempt to access it.
242
+ *
243
+ * @return {LocalStorage}
244
+ * @api private
245
+ */
246
+
247
+ function localstorage() {
248
+ try {
249
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
250
+ // The Browser also has localStorage in the global context.
251
+ return localStorage;
252
+ } catch (error) {
253
+ // Swallow
254
+ // XXX (@Qix-) should we be logging these?
255
+ }
256
+ }
257
+
258
+ module.exports = require('./common')(exports);
259
+
260
+ const {formatters} = module.exports;
261
+
262
+ /**
263
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
264
+ */
265
+
266
+ formatters.j = function (v) {
267
+ try {
268
+ return JSON.stringify(v);
269
+ } catch (error) {
270
+ return '[UnexpectedJSONParseError]: ' + error.message;
271
+ }
272
+ };
@@ -1 +1,292 @@
1
- function setup(e){function n(e){let o,r,s,l=null;function a(...e){if(!a.enabled)return;const t=a,r=Number(new Date),s=r-(o||r);t.diff=s,t.prev=o,t.curr=r,o=r,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let l=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(o,r)=>{if("%%"===o)return"%";l++;const s=n.formatters[r];if("function"==typeof s){const n=e[l];o=s.call(t,n),e.splice(l,1),l--}return o}),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=t,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==l?l:(r!==n.namespaces&&(r=n.namespaces,s=n.enabled(e)),s),set:e=>{l=e}}),"function"==typeof n.init&&n.init(a),a}function t(e,t){const o=n(this.namespace+(void 0===t?":":t)+e);return o.log=this.log,o}function o(e,n){let t=0,o=0,r=-1,s=0;for(;t<e.length;)if(o<n.length&&(n[o]===e[t]||"*"===n[o]))"*"===n[o]?(r=o,s=t,o++):(t++,o++);else{if(-1===r)return!1;o=r+1,s++,t=s}for(;o<n.length&&"*"===n[o];)o++;return o===n.length}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names,...n.skips.map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];const t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of t)"-"===e[0]?n.skips.push(e.slice(1)):n.names.push(e)},n.enabled=function(e){for(const t of n.skips)if(o(e,t))return!1;for(const t of n.names)if(o(e,t))return!0;return!1},n.humanize=require("../ms"),n.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]},n.enable(n.load()),n}module.exports=setup;
1
+
2
+ /**
3
+ * This is the common logic for both the Node.js and web browser
4
+ * implementations of `debug()`.
5
+ */
6
+
7
+ function setup(env) {
8
+ createDebug.debug = createDebug;
9
+ createDebug.default = createDebug;
10
+ createDebug.coerce = coerce;
11
+ createDebug.disable = disable;
12
+ createDebug.enable = enable;
13
+ createDebug.enabled = enabled;
14
+ createDebug.humanize = require('../ms');
15
+ createDebug.destroy = destroy;
16
+
17
+ Object.keys(env).forEach(key => {
18
+ createDebug[key] = env[key];
19
+ });
20
+
21
+ /**
22
+ * The currently active debug mode names, and names to skip.
23
+ */
24
+
25
+ createDebug.names = [];
26
+ createDebug.skips = [];
27
+
28
+ /**
29
+ * Map of special "%n" handling functions, for the debug "format" argument.
30
+ *
31
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
32
+ */
33
+ createDebug.formatters = {};
34
+
35
+ /**
36
+ * Selects a color for a debug namespace
37
+ * @param {String} namespace The namespace string for the debug instance to be colored
38
+ * @return {Number|String} An ANSI color code for the given namespace
39
+ * @api private
40
+ */
41
+ function selectColor(namespace) {
42
+ let hash = 0;
43
+
44
+ for (let i = 0; i < namespace.length; i++) {
45
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
46
+ hash |= 0; // Convert to 32bit integer
47
+ }
48
+
49
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
50
+ }
51
+ createDebug.selectColor = selectColor;
52
+
53
+ /**
54
+ * Create a debugger with the given `namespace`.
55
+ *
56
+ * @param {String} namespace
57
+ * @return {Function}
58
+ * @api public
59
+ */
60
+ function createDebug(namespace) {
61
+ let prevTime;
62
+ let enableOverride = null;
63
+ let namespacesCache;
64
+ let enabledCache;
65
+
66
+ function debug(...args) {
67
+ // Disabled?
68
+ if (!debug.enabled) {
69
+ return;
70
+ }
71
+
72
+ const self = debug;
73
+
74
+ // Set `diff` timestamp
75
+ const curr = Number(new Date());
76
+ const ms = curr - (prevTime || curr);
77
+ self.diff = ms;
78
+ self.prev = prevTime;
79
+ self.curr = curr;
80
+ prevTime = curr;
81
+
82
+ args[0] = createDebug.coerce(args[0]);
83
+
84
+ if (typeof args[0] !== 'string') {
85
+ // Anything else let's inspect with %O
86
+ args.unshift('%O');
87
+ }
88
+
89
+ // Apply any `formatters` transformations
90
+ let index = 0;
91
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
92
+ // If we encounter an escaped % then don't increase the array index
93
+ if (match === '%%') {
94
+ return '%';
95
+ }
96
+ index++;
97
+ const formatter = createDebug.formatters[format];
98
+ if (typeof formatter === 'function') {
99
+ const val = args[index];
100
+ match = formatter.call(self, val);
101
+
102
+ // Now we need to remove `args[index]` since it's inlined in the `format`
103
+ args.splice(index, 1);
104
+ index--;
105
+ }
106
+ return match;
107
+ });
108
+
109
+ // Apply env-specific formatting (colors, etc.)
110
+ createDebug.formatArgs.call(self, args);
111
+
112
+ const logFn = self.log || createDebug.log;
113
+ logFn.apply(self, args);
114
+ }
115
+
116
+ debug.namespace = namespace;
117
+ debug.useColors = createDebug.useColors();
118
+ debug.color = createDebug.selectColor(namespace);
119
+ debug.extend = extend;
120
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
121
+
122
+ Object.defineProperty(debug, 'enabled', {
123
+ enumerable: true,
124
+ configurable: false,
125
+ get: () => {
126
+ if (enableOverride !== null) {
127
+ return enableOverride;
128
+ }
129
+ if (namespacesCache !== createDebug.namespaces) {
130
+ namespacesCache = createDebug.namespaces;
131
+ enabledCache = createDebug.enabled(namespace);
132
+ }
133
+
134
+ return enabledCache;
135
+ },
136
+ set: v => {
137
+ enableOverride = v;
138
+ }
139
+ });
140
+
141
+ // Env-specific initialization logic for debug instances
142
+ if (typeof createDebug.init === 'function') {
143
+ createDebug.init(debug);
144
+ }
145
+
146
+ return debug;
147
+ }
148
+
149
+ function extend(namespace, delimiter) {
150
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
151
+ newDebug.log = this.log;
152
+ return newDebug;
153
+ }
154
+
155
+ /**
156
+ * Enables a debug mode by namespaces. This can include modes
157
+ * separated by a colon and wildcards.
158
+ *
159
+ * @param {String} namespaces
160
+ * @api public
161
+ */
162
+ function enable(namespaces) {
163
+ createDebug.save(namespaces);
164
+ createDebug.namespaces = namespaces;
165
+
166
+ createDebug.names = [];
167
+ createDebug.skips = [];
168
+
169
+ const split = (typeof namespaces === 'string' ? namespaces : '')
170
+ .trim()
171
+ .replace(/\s+/g, ',')
172
+ .split(',')
173
+ .filter(Boolean);
174
+
175
+ for (const ns of split) {
176
+ if (ns[0] === '-') {
177
+ createDebug.skips.push(ns.slice(1));
178
+ } else {
179
+ createDebug.names.push(ns);
180
+ }
181
+ }
182
+ }
183
+
184
+ /**
185
+ * Checks if the given string matches a namespace template, honoring
186
+ * asterisks as wildcards.
187
+ *
188
+ * @param {String} search
189
+ * @param {String} template
190
+ * @return {Boolean}
191
+ */
192
+ function matchesTemplate(search, template) {
193
+ let searchIndex = 0;
194
+ let templateIndex = 0;
195
+ let starIndex = -1;
196
+ let matchIndex = 0;
197
+
198
+ while (searchIndex < search.length) {
199
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
200
+ // Match character or proceed with wildcard
201
+ if (template[templateIndex] === '*') {
202
+ starIndex = templateIndex;
203
+ matchIndex = searchIndex;
204
+ templateIndex++; // Skip the '*'
205
+ } else {
206
+ searchIndex++;
207
+ templateIndex++;
208
+ }
209
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
210
+ // Backtrack to the last '*' and try to match more characters
211
+ templateIndex = starIndex + 1;
212
+ matchIndex++;
213
+ searchIndex = matchIndex;
214
+ } else {
215
+ return false; // No match
216
+ }
217
+ }
218
+
219
+ // Handle trailing '*' in template
220
+ while (templateIndex < template.length && template[templateIndex] === '*') {
221
+ templateIndex++;
222
+ }
223
+
224
+ return templateIndex === template.length;
225
+ }
226
+
227
+ /**
228
+ * Disable debug output.
229
+ *
230
+ * @return {String} namespaces
231
+ * @api public
232
+ */
233
+ function disable() {
234
+ const namespaces = [
235
+ ...createDebug.names,
236
+ ...createDebug.skips.map(namespace => '-' + namespace)
237
+ ].join(',');
238
+ createDebug.enable('');
239
+ return namespaces;
240
+ }
241
+
242
+ /**
243
+ * Returns true if the given mode name is enabled, false otherwise.
244
+ *
245
+ * @param {String} name
246
+ * @return {Boolean}
247
+ * @api public
248
+ */
249
+ function enabled(name) {
250
+ for (const skip of createDebug.skips) {
251
+ if (matchesTemplate(name, skip)) {
252
+ return false;
253
+ }
254
+ }
255
+
256
+ for (const ns of createDebug.names) {
257
+ if (matchesTemplate(name, ns)) {
258
+ return true;
259
+ }
260
+ }
261
+
262
+ return false;
263
+ }
264
+
265
+ /**
266
+ * Coerce `val`.
267
+ *
268
+ * @param {Mixed} val
269
+ * @return {Mixed}
270
+ * @api private
271
+ */
272
+ function coerce(val) {
273
+ if (val instanceof Error) {
274
+ return val.stack || val.message;
275
+ }
276
+ return val;
277
+ }
278
+
279
+ /**
280
+ * XXX DO NOT USE. This is a temporary stub function.
281
+ * XXX It WILL be removed in the next major release.
282
+ */
283
+ function destroy() {
284
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
285
+ }
286
+
287
+ createDebug.enable(createDebug.load());
288
+
289
+ return createDebug;
290
+ }
291
+
292
+ module.exports = setup;
@@ -1 +1,263 @@
1
- const tty=require("tty"),util=require("util");exports.init=init,exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.destroy=util.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),exports.colors=[6,2,3,4,5,1];try{const t=require("supports-color");t&&(t.stderr||t).level>=2&&(exports.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(t){}function useColors(){return"colors"in exports.inspectOpts?Boolean(exports.inspectOpts.colors):tty.isatty(process.stderr.fd)}function formatArgs(t){const{namespace:e,useColors:s}=this;if(s){const s=this.color,o="[3"+(s<8?s:"8;5;"+s),r=`${o};1m${("+"+module.exports.humanize(this.diff)).padStart(6)} ${e} `;t[0]=r+t[0].split("\n").join("\n"+r),t.push(o+"")}else t[0]=getDate()+e+" "+t[0]}function getDate(){return exports.inspectOpts.hideDate?"":(new Date).toISOString()+" "}function log(...t){return process.stderr.write(util.formatWithOptions(exports.inspectOpts,...t)+"\n")}function save(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function load(){return process.env.DEBUG}function init(t){t.inspectOpts={};const e=Object.keys(exports.inspectOpts);for(let s=0;s<e.length;s++)t.inspectOpts[e[s]]=exports.inspectOpts[e[s]]}exports.inspectOpts=Object.keys(process.env).filter(t=>/^debug_/i.test(t)).reduce((t,e)=>{const s=e.substring(6).toLowerCase().replace(/_([a-z])/g,(t,e)=>e.toUpperCase());let o=process.env[e];return o=!!/^(yes|on|true|enabled)$/i.test(o)||!/^(no|off|false|disabled)$/i.test(o)&&("null"===o?null:Number(o)),t[s]=o,t},{}),module.exports=require("./common")(exports);const{formatters:formatters}=module.exports;formatters.o=function(t){return this.inspectOpts.colors=this.useColors,util.inspect(t,this.inspectOpts).split("\n").map(t=>t.trim()).join(" ")},formatters.O=function(t){return this.inspectOpts.colors=this.useColors,util.inspect(t,this.inspectOpts)};
1
+ /**
2
+ * Module dependencies.
3
+ */
4
+
5
+ const tty = require('tty');
6
+ const util = require('util');
7
+
8
+ /**
9
+ * This is the Node.js implementation of `debug()`.
10
+ */
11
+
12
+ exports.init = init;
13
+ exports.log = log;
14
+ exports.formatArgs = formatArgs;
15
+ exports.save = save;
16
+ exports.load = load;
17
+ exports.useColors = useColors;
18
+ exports.destroy = util.deprecate(
19
+ () => {},
20
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
21
+ );
22
+
23
+ /**
24
+ * Colors.
25
+ */
26
+
27
+ exports.colors = [6, 2, 3, 4, 5, 1];
28
+
29
+ try {
30
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
31
+ // eslint-disable-next-line import/no-extraneous-dependencies
32
+ const supportsColor = require('supports-color');
33
+
34
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
35
+ exports.colors = [
36
+ 20,
37
+ 21,
38
+ 26,
39
+ 27,
40
+ 32,
41
+ 33,
42
+ 38,
43
+ 39,
44
+ 40,
45
+ 41,
46
+ 42,
47
+ 43,
48
+ 44,
49
+ 45,
50
+ 56,
51
+ 57,
52
+ 62,
53
+ 63,
54
+ 68,
55
+ 69,
56
+ 74,
57
+ 75,
58
+ 76,
59
+ 77,
60
+ 78,
61
+ 79,
62
+ 80,
63
+ 81,
64
+ 92,
65
+ 93,
66
+ 98,
67
+ 99,
68
+ 112,
69
+ 113,
70
+ 128,
71
+ 129,
72
+ 134,
73
+ 135,
74
+ 148,
75
+ 149,
76
+ 160,
77
+ 161,
78
+ 162,
79
+ 163,
80
+ 164,
81
+ 165,
82
+ 166,
83
+ 167,
84
+ 168,
85
+ 169,
86
+ 170,
87
+ 171,
88
+ 172,
89
+ 173,
90
+ 178,
91
+ 179,
92
+ 184,
93
+ 185,
94
+ 196,
95
+ 197,
96
+ 198,
97
+ 199,
98
+ 200,
99
+ 201,
100
+ 202,
101
+ 203,
102
+ 204,
103
+ 205,
104
+ 206,
105
+ 207,
106
+ 208,
107
+ 209,
108
+ 214,
109
+ 215,
110
+ 220,
111
+ 221
112
+ ];
113
+ }
114
+ } catch (error) {
115
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
116
+ }
117
+
118
+ /**
119
+ * Build up the default `inspectOpts` object from the environment variables.
120
+ *
121
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
122
+ */
123
+
124
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
125
+ return /^debug_/i.test(key);
126
+ }).reduce((obj, key) => {
127
+ // Camel-case
128
+ const prop = key
129
+ .substring(6)
130
+ .toLowerCase()
131
+ .replace(/_([a-z])/g, (_, k) => {
132
+ return k.toUpperCase();
133
+ });
134
+
135
+ // Coerce string value into JS value
136
+ let val = process.env[key];
137
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
138
+ val = true;
139
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
140
+ val = false;
141
+ } else if (val === 'null') {
142
+ val = null;
143
+ } else {
144
+ val = Number(val);
145
+ }
146
+
147
+ obj[prop] = val;
148
+ return obj;
149
+ }, {});
150
+
151
+ /**
152
+ * Is stdout a TTY? Colored output is enabled when `true`.
153
+ */
154
+
155
+ function useColors() {
156
+ return 'colors' in exports.inspectOpts ?
157
+ Boolean(exports.inspectOpts.colors) :
158
+ tty.isatty(process.stderr.fd);
159
+ }
160
+
161
+ /**
162
+ * Adds ANSI color escape codes if enabled.
163
+ *
164
+ * @api public
165
+ */
166
+
167
+ function formatArgs(args) {
168
+ const {namespace: name, useColors} = this;
169
+
170
+ if (useColors) {
171
+ const c = this.color;
172
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
173
+ const prefix = `${colorCode};1m${('+' + module.exports.humanize(this.diff)).padStart(6)} ${name} \u001B[0m`;
174
+
175
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
176
+ args.push(colorCode + '' + '\u001B[0m');
177
+ } else {
178
+ args[0] = getDate() + name + ' ' + args[0];
179
+ }
180
+ }
181
+
182
+ function getDate() {
183
+ if (exports.inspectOpts.hideDate) {
184
+ return '';
185
+ }
186
+ return new Date().toISOString() + ' ';
187
+ }
188
+
189
+ /**
190
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
191
+ */
192
+
193
+ function log(...args) {
194
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
195
+ }
196
+
197
+ /**
198
+ * Save `namespaces`.
199
+ *
200
+ * @param {String} namespaces
201
+ * @api private
202
+ */
203
+ function save(namespaces) {
204
+ if (namespaces) {
205
+ process.env.DEBUG = namespaces;
206
+ } else {
207
+ // If you set a process.env field to null or undefined, it gets cast to the
208
+ // string 'null' or 'undefined'. Just delete instead.
209
+ delete process.env.DEBUG;
210
+ }
211
+ }
212
+
213
+ /**
214
+ * Load `namespaces`.
215
+ *
216
+ * @return {String} returns the previously persisted debug modes
217
+ * @api private
218
+ */
219
+
220
+ function load() {
221
+ return process.env.DEBUG;
222
+ }
223
+
224
+ /**
225
+ * Init logic for `debug` instances.
226
+ *
227
+ * Create a new `inspectOpts` object in case `useColors` is set
228
+ * differently for a particular `debug` instance.
229
+ */
230
+
231
+ function init(debug) {
232
+ debug.inspectOpts = {};
233
+
234
+ const keys = Object.keys(exports.inspectOpts);
235
+ for (let i = 0; i < keys.length; i++) {
236
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
237
+ }
238
+ }
239
+
240
+ module.exports = require('./common')(exports);
241
+
242
+ const {formatters} = module.exports;
243
+
244
+ /**
245
+ * Map %o to `util.inspect()`, all on a single line.
246
+ */
247
+
248
+ formatters.o = function (v) {
249
+ this.inspectOpts.colors = this.useColors;
250
+ return util.inspect(v, this.inspectOpts)
251
+ .split('\n')
252
+ .map(str => str.trim())
253
+ .join(' ');
254
+ };
255
+
256
+ /**
257
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
258
+ */
259
+
260
+ formatters.O = function (v) {
261
+ this.inspectOpts.colors = this.useColors;
262
+ return util.inspect(v, this.inspectOpts);
263
+ };
@@ -0,0 +1,2 @@
1
+ export { w as default };
2
+ declare var w: any;
@@ -0,0 +1 @@
1
+ import e from"tty";import t from"util";function r(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var r=function e(){var r=!1;try{r=this instanceof e}catch{}return r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var s,o,i,c,a,u={exports:{}},l={exports:{}};function f(){if(o)return s;o=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,c=365.25*n;function a(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}return s=function(s,o){o=o||{};var u=typeof s;if("string"===u&&s.length>0)return function(s){if((s=String(s)).length>100)return;var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!o)return;var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*c;case"weeks":case"week":case"w":return a*i;case"days":case"day":case"d":return a*n;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(s);if("number"===u&&isFinite(s))return o.long?function(s){var o=Math.abs(s);if(o>=n)return a(s,o,n,"day");if(o>=r)return a(s,o,r,"hour");if(o>=t)return a(s,o,t,"minute");if(o>=e)return a(s,o,e,"second");return s+" ms"}(s):function(s){var o=Math.abs(s);if(o>=n)return Math.round(s/n)+"d";if(o>=r)return Math.round(s/r)+"h";if(o>=t)return Math.round(s/t)+"m";if(o>=e)return Math.round(s/e)+"s";return s+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))}}function p(){if(c)return i;return c=1,i=function(e){function t(e){let n,s,o,i=null;function c(...e){if(!c.enabled)return;const r=c,s=Number(new Date),o=s-(n||s);r.diff=o,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(n,s)=>{if("%%"===n)return"%";i++;const o=t.formatters[s];if("function"==typeof o){const t=e[i];n=o.call(r,t),e.splice(i,1),i--}return n}),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return c.namespace=e,c.useColors=t.useColors(),c.color=t.selectColor(e),c.extend=r,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(s!==t.namespaces&&(s=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(c),c}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e,t){let r=0,n=0,s=-1,o=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(s=n,o=r,n++):(r++,n++);else{if(-1===s)return!1;n=s+1,o++,r=o}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names,...t.skips.map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const e of r)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const r of t.skips)if(n(e,r))return!1;for(const r of t.names)if(n(e,r))return!0;return!1},t.humanize=f(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach(r=>{t[r]=e[r]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},i}var d={exports:{}};const C=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e?.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),m=0!==C&&{level:C,hasBasic:!0,has256:C>=2,has16m:C>=3},g={stdout:m,stderr:m};var h,F,y=n(Object.freeze({__proto__:null,default:g}));function b(){return h||(h=1,function(r,n){const s=e,o=t;n.init=function(e){e.inspectOpts={};const t=Object.keys(n.inspectOpts);for(let r=0;r<t.length;r++)e.inspectOpts[t[r]]=n.inspectOpts[t[r]]},n.log=function(...e){return process.stderr.write(o.formatWithOptions(n.inspectOpts,...e)+"\n")},n.formatArgs=function(e){const{namespace:t,useColors:s}=this;if(s){const n=this.color,s="[3"+(n<8?n:"8;5;"+n),o=`${s};1m${("+"+r.exports.humanize(this.diff)).padStart(6)} ${t} `;e[0]=o+e[0].split("\n").join("\n"+o),e.push(s+"")}else e[0]=function(){if(n.inspectOpts.hideDate)return"";return(new Date).toISOString()+" "}()+t+" "+e[0]},n.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},n.load=function(){return process.env.DEBUG},n.useColors=function(){return"colors"in n.inspectOpts?Boolean(n.inspectOpts.colors):s.isatty(process.stderr.fd)},n.destroy=o.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),n.colors=[6,2,3,4,5,1];try{const e=y;e&&(e.stderr||e).level>=2&&(n.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}n.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{const r=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase());let n=process.env[t];return n=!!/^(yes|on|true|enabled)$/i.test(n)||!/^(no|off|false|disabled)$/i.test(n)&&("null"===n?null:Number(n)),e[r]=n,e},{}),r.exports=p()(n);const{formatters:i}=r.exports;i.o=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts).split("\n").map(e=>e.trim()).join(" ")},i.O=function(e){return this.inspectOpts.colors=this.useColors,o.inspect(e,this.inspectOpts)}}(d,d.exports)),d.exports}var v=(F||(F=1,"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?u.exports=(a||(a=1,function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+`${("+"+e.exports.humanize(this.diff)).padStart(6)} ${this.namespace}`+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" "),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))}),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=p()(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(l,l.exports)),l.exports):u.exports=b()),u.exports),w=r(v);export{w as default};
package/dist/debug.js CHANGED
@@ -1,17 +1,15 @@
1
1
  /**
2
- * Re-export patched debug library
2
+ * Re-export patched debug library
3
3
  * This file bundles the patched version of debug into the library distribution.
4
- *
4
+ *
5
5
  * The patch moves time diff display before namespace:
6
6
  * Standard: gg:file +123ms
7
7
  * Patched: +123ms gg:file
8
- *
9
- * Note: In dev mode with Vite, this uses the debug from node_modules (with patch applied).
10
- * In production (svelte-package build), this bundles the ./debug/ folder into dist/.
11
8
  */
12
9
 
13
- // Import from debug package (works in dev with Vite optimizeDeps)
14
- // After svelte-package, this will bundle from ./debug/ folder
15
- import debug from 'debug';
10
+ // In dev mode: use debug from node_modules (with patch applied via pnpm)
11
+ // After build: this file is replaced by a direct import of the bundled version
12
+ // See: scripts/bundle-debug.js which creates dist/debug-bundled.js
13
+ import debug from './debug-bundled.js';
16
14
 
17
15
  export default debug;
package/dist/gg.js CHANGED
@@ -82,6 +82,13 @@ const srcRootRegex = new RegExp(ggConfig.srcRootPattern, 'i');
82
82
  // - Cache and reuse the same log function for a given callpoint.
83
83
  const namespaceToLogFunction = new Map();
84
84
  let maxCallpointLength = 0;
85
+ /**
86
+ * Reset the namespace width tracking.
87
+ * Useful after configuration checks that may have long callpoint paths.
88
+ */
89
+ function resetNamespaceWidth() {
90
+ maxCallpointLength = 0;
91
+ }
85
92
  function openInEditorUrl(fileName) {
86
93
  return ggConfig.openInEditorUrlTemplate.replace('$FILENAME', encodeURIComponent(fileName).replaceAll('%2F', '/'));
87
94
  }
@@ -97,7 +104,23 @@ export function gg(...args) {
97
104
  const filenameToOpen = filename.replace(srcRootRegex, '$<folderName>/');
98
105
  const url = openInEditorUrl(filenameToOpen);
99
106
  // Example: routes/+page.svelte
100
- const filenameToDisplay = filename.replace(srcRootRegex, '');
107
+ let filenameToDisplay = filename.replace(srcRootRegex, '');
108
+ // In production builds, simplify the built file paths for better readability
109
+ // e.g., "_app/immutable/nodes/0.CY8nc6EF.js" -> "nodes/0"
110
+ // e.g., ".svelte-kit/output/server/entries/pages/_layout.svelte.js" -> "pages/_layout"
111
+ if (filenameToDisplay.includes('_app/immutable/')) {
112
+ // Client-side production build
113
+ filenameToDisplay = filenameToDisplay
114
+ .replace(/.*\/_app\/immutable\//, '') // Remove path prefix
115
+ .replace(/\.[a-zA-Z0-9]+\.js$/, ''); // Remove hash and .js
116
+ }
117
+ else if (filenameToDisplay.includes('.svelte-kit/output/')) {
118
+ // Server-side production build
119
+ filenameToDisplay = filenameToDisplay
120
+ .replace(/.*\.svelte-kit\/output\/server\/entries\//, '') // Remove path prefix
121
+ .replace(/\.svelte\.js$/, '') // Remove .svelte.js
122
+ .replace(/\.js$/, ''); // Remove .js
123
+ }
101
124
  const { functionName } = stack[0];
102
125
  //console.log({ filename, fileNameToOpen: filenameToOpen, fileNameToDisplay: filenameToDisplay });
103
126
  // A callpoint is uniquely identified by the filename plus function name
@@ -163,4 +186,7 @@ if (ggConfig.showHints && !isCloudflareWorker()) {
163
186
  message(`${checkbox(ggLogTest.enabled)} DEBUG env variable: ${process?.env?.DEBUG}${hint}`);
164
187
  }
165
188
  console.log(ggMessage);
189
+ // Reset namespace width after configuration check
190
+ // This prevents the long callpoint from the config check from affecting subsequent logs
191
+ resetNamespaceWidth();
166
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leftium/gg",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Leftium/gg.git"
@@ -30,6 +30,9 @@
30
30
  "@eslint/compat": "^1.4.1",
31
31
  "@eslint/js": "^9.39.1",
32
32
  "@picocss/pico": "^2.1.1",
33
+ "@rollup/plugin-commonjs": "^29.0.0",
34
+ "@rollup/plugin-node-resolve": "^16.0.3",
35
+ "@rollup/plugin-terser": "^0.4.4",
33
36
  "@sveltejs/adapter-vercel": "^6.1.1",
34
37
  "@sveltejs/kit": "^2.48.4",
35
38
  "@sveltejs/package": "^2.5.4",
@@ -42,13 +45,12 @@
42
45
  "eslint-config-prettier": "^10.1.8",
43
46
  "eslint-plugin-svelte": "^3.13.0",
44
47
  "globals": "^16.5.0",
45
- "ms": "^2.1.3",
46
48
  "prettier": "^3.6.2",
47
49
  "prettier-plugin-svelte": "^3.4.0",
48
50
  "publint": "^0.3.15",
51
+ "supports-color": "^10.2.2",
49
52
  "svelte": "^5.43.3",
50
53
  "svelte-check": "^4.3.3",
51
- "terser": "^5.36.0",
52
54
  "typescript": "^5.9.3",
53
55
  "typescript-eslint": "^8.46.3",
54
56
  "vite": "^7.2.0",
@@ -58,7 +60,6 @@
58
60
  "svelte"
59
61
  ],
60
62
  "dependencies": {
61
- "debug": "^4.4.3",
62
63
  "dotenv": "^17.2.3",
63
64
  "error-stack-parser": "^2.1.4",
64
65
  "esm-env": "^1.2.2",