Skip to content

Commit 4613774

Browse files
committedNov 14, 2023
deps: hoisting newer deps in favor of older ones
In some cases this adds duplication to the tree which will be cleaned up as subdependencies update to the latest versions
1 parent 54c4f7b commit 4613774

File tree

48 files changed

+1560
-530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1560
-530
lines changed
 

‎node_modules/.gitignore

+17-10
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@
1717
!/@npmcli/
1818
/@npmcli/*
1919
!/@npmcli/agent
20-
!/@npmcli/agent/node_modules/
21-
/@npmcli/agent/node_modules/*
22-
!/@npmcli/agent/node_modules/agent-base
23-
!/@npmcli/agent/node_modules/http-proxy-agent
24-
!/@npmcli/agent/node_modules/https-proxy-agent
25-
!/@npmcli/agent/node_modules/socks-proxy-agent
2620
!/@npmcli/disparity-colors
21+
!/@npmcli/disparity-colors/node_modules/
22+
/@npmcli/disparity-colors/node_modules/*
23+
!/@npmcli/disparity-colors/node_modules/ansi-styles
2724
!/@npmcli/fs
2825
!/@npmcli/git
2926
!/@npmcli/installed-package-contents
@@ -50,6 +47,7 @@
5047
!/@tufjs/models
5148
!/abbrev
5249
!/abort-controller
50+
!/agent-base
5351
!/aggregate-error
5452
!/ansi-regex
5553
!/ansi-styles
@@ -72,6 +70,7 @@
7270
!/cli-columns
7371
!/cli-columns/node_modules/
7472
/cli-columns/node_modules/*
73+
!/cli-columns/node_modules/ansi-regex
7574
!/cli-columns/node_modules/strip-ansi
7675
!/cli-table3
7776
!/clone
@@ -82,6 +81,7 @@
8281
!/columnify
8382
!/columnify/node_modules/
8483
/columnify/node_modules/*
84+
!/columnify/node_modules/ansi-regex
8585
!/columnify/node_modules/strip-ansi
8686
!/common-ancestor-path
8787
!/console-control-strings
@@ -112,13 +112,16 @@
112112
!/gauge
113113
!/gauge/node_modules/
114114
/gauge/node_modules/*
115+
!/gauge/node_modules/ansi-regex
115116
!/gauge/node_modules/strip-ansi
116117
!/glob
117118
!/graceful-fs
118119
!/has-unicode
119120
!/has
120121
!/hosted-git-info
121122
!/http-cache-semantics
123+
!/http-proxy-agent
124+
!/https-proxy-agent
122125
!/iconv-lite
123126
!/ieee754
124127
!/ignore-walk
@@ -218,6 +221,7 @@
218221
!/signal-exit
219222
!/sigstore
220223
!/smart-buffer
224+
!/socks-proxy-agent
221225
!/socks
222226
!/spdx-correct
223227
!/spdx-exceptions
@@ -228,16 +232,18 @@
228232
!/string-width-cjs
229233
!/string-width-cjs/node_modules/
230234
/string-width-cjs/node_modules/*
235+
!/string-width-cjs/node_modules/ansi-regex
231236
!/string-width-cjs/node_modules/strip-ansi
232237
!/string-width
233238
!/string-width/node_modules/
234239
/string-width/node_modules/*
240+
!/string-width/node_modules/ansi-regex
235241
!/string-width/node_modules/strip-ansi
236242
!/strip-ansi-cjs
243+
!/strip-ansi-cjs/node_modules/
244+
/strip-ansi-cjs/node_modules/*
245+
!/strip-ansi-cjs/node_modules/ansi-regex
237246
!/strip-ansi
238-
!/strip-ansi/node_modules/
239-
/strip-ansi/node_modules/*
240-
!/strip-ansi/node_modules/ansi-regex
241247
!/supports-color
242248
!/tar
243249
!/tar/node_modules/
@@ -266,11 +272,12 @@
266272
!/wrap-ansi-cjs
267273
!/wrap-ansi-cjs/node_modules/
268274
/wrap-ansi-cjs/node_modules/*
275+
!/wrap-ansi-cjs/node_modules/ansi-regex
276+
!/wrap-ansi-cjs/node_modules/ansi-styles
269277
!/wrap-ansi-cjs/node_modules/strip-ansi
270278
!/wrap-ansi
271279
!/wrap-ansi/node_modules/
272280
/wrap-ansi/node_modules/*
273-
!/wrap-ansi/node_modules/ansi-styles
274281
!/wrap-ansi/node_modules/emoji-regex
275282
!/wrap-ansi/node_modules/string-width
276283
!/write-file-atomic
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
'use strict';
2+
3+
const wrapAnsi16 = (fn, offset) => (...args) => {
4+
const code = fn(...args);
5+
return `\u001B[${code + offset}m`;
6+
};
7+
8+
const wrapAnsi256 = (fn, offset) => (...args) => {
9+
const code = fn(...args);
10+
return `\u001B[${38 + offset};5;${code}m`;
11+
};
12+
13+
const wrapAnsi16m = (fn, offset) => (...args) => {
14+
const rgb = fn(...args);
15+
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
16+
};
17+
18+
const ansi2ansi = n => n;
19+
const rgb2rgb = (r, g, b) => [r, g, b];
20+
21+
const setLazyProperty = (object, property, get) => {
22+
Object.defineProperty(object, property, {
23+
get: () => {
24+
const value = get();
25+
26+
Object.defineProperty(object, property, {
27+
value,
28+
enumerable: true,
29+
configurable: true
30+
});
31+
32+
return value;
33+
},
34+
enumerable: true,
35+
configurable: true
36+
});
37+
};
38+
39+
/** @type {typeof import('color-convert')} */
40+
let colorConvert;
41+
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
42+
if (colorConvert === undefined) {
43+
colorConvert = require('color-convert');
44+
}
45+
46+
const offset = isBackground ? 10 : 0;
47+
const styles = {};
48+
49+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
50+
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
51+
if (sourceSpace === targetSpace) {
52+
styles[name] = wrap(identity, offset);
53+
} else if (typeof suite === 'object') {
54+
styles[name] = wrap(suite[targetSpace], offset);
55+
}
56+
}
57+
58+
return styles;
59+
};
60+
61+
function assembleStyles() {
62+
const codes = new Map();
63+
const styles = {
64+
modifier: {
65+
reset: [0, 0],
66+
// 21 isn't widely supported and 22 does the same thing
67+
bold: [1, 22],
68+
dim: [2, 22],
69+
italic: [3, 23],
70+
underline: [4, 24],
71+
inverse: [7, 27],
72+
hidden: [8, 28],
73+
strikethrough: [9, 29]
74+
},
75+
color: {
76+
black: [30, 39],
77+
red: [31, 39],
78+
green: [32, 39],
79+
yellow: [33, 39],
80+
blue: [34, 39],
81+
magenta: [35, 39],
82+
cyan: [36, 39],
83+
white: [37, 39],
84+
85+
// Bright color
86+
blackBright: [90, 39],
87+
redBright: [91, 39],
88+
greenBright: [92, 39],
89+
yellowBright: [93, 39],
90+
blueBright: [94, 39],
91+
magentaBright: [95, 39],
92+
cyanBright: [96, 39],
93+
whiteBright: [97, 39]
94+
},
95+
bgColor: {
96+
bgBlack: [40, 49],
97+
bgRed: [41, 49],
98+
bgGreen: [42, 49],
99+
bgYellow: [43, 49],
100+
bgBlue: [44, 49],
101+
bgMagenta: [45, 49],
102+
bgCyan: [46, 49],
103+
bgWhite: [47, 49],
104+
105+
// Bright color
106+
bgBlackBright: [100, 49],
107+
bgRedBright: [101, 49],
108+
bgGreenBright: [102, 49],
109+
bgYellowBright: [103, 49],
110+
bgBlueBright: [104, 49],
111+
bgMagentaBright: [105, 49],
112+
bgCyanBright: [106, 49],
113+
bgWhiteBright: [107, 49]
114+
}
115+
};
116+
117+
// Alias bright black as gray (and grey)
118+
styles.color.gray = styles.color.blackBright;
119+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
120+
styles.color.grey = styles.color.blackBright;
121+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
122+
123+
for (const [groupName, group] of Object.entries(styles)) {
124+
for (const [styleName, style] of Object.entries(group)) {
125+
styles[styleName] = {
126+
open: `\u001B[${style[0]}m`,
127+
close: `\u001B[${style[1]}m`
128+
};
129+
130+
group[styleName] = styles[styleName];
131+
132+
codes.set(style[0], style[1]);
133+
}
134+
135+
Object.defineProperty(styles, groupName, {
136+
value: group,
137+
enumerable: false
138+
});
139+
}
140+
141+
Object.defineProperty(styles, 'codes', {
142+
value: codes,
143+
enumerable: false
144+
});
145+
146+
styles.color.close = '\u001B[39m';
147+
styles.bgColor.close = '\u001B[49m';
148+
149+
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
150+
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
151+
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
152+
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
153+
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
154+
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
155+
156+
return styles;
157+
}
158+
159+
// Make the export immutable
160+
Object.defineProperty(module, 'exports', {
161+
enumerable: true,
162+
get: assembleStyles
163+
});

0 commit comments

Comments
 (0)
Please sign in to comment.