@drupal-canvas/cli 0.2.0 → 0.3.0
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.js +1056 -734
- package/dist/index.js.map +1 -0
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -4,13 +4,16 @@ import { Command } from 'commander';
|
|
|
4
4
|
import * as p9 from '@clack/prompts';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import fs__default, { realpathSync as realpathSync$1, readlinkSync, readdirSync, readdir as readdir$1, lstatSync, promises } from 'fs';
|
|
7
|
-
import
|
|
7
|
+
import path11, { win32, posix } from 'path';
|
|
8
8
|
import dotenv from 'dotenv';
|
|
9
9
|
import { transform, Features } from 'lightningcss';
|
|
10
10
|
import axios from 'axios';
|
|
11
11
|
import fs2, { realpath, readlink, readdir, lstat } from 'fs/promises';
|
|
12
12
|
import os from 'os';
|
|
13
13
|
import { transformSync } from '@swc/wasm';
|
|
14
|
+
import { basename } from 'path/win32';
|
|
15
|
+
import { ESLint } from 'eslint';
|
|
16
|
+
import { required } from '@drupal-canvas/eslint-config';
|
|
14
17
|
import { table } from 'table';
|
|
15
18
|
import { fileURLToPath } from 'url';
|
|
16
19
|
import { EventEmitter } from 'events';
|
|
@@ -20,251 +23,18 @@ import * as yaml from 'js-yaml';
|
|
|
20
23
|
import yaml__default from 'js-yaml';
|
|
21
24
|
import { parse } from '@babel/parser';
|
|
22
25
|
|
|
23
|
-
var __create = Object.create;
|
|
24
|
-
var __defProp = Object.defineProperty;
|
|
25
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
27
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
28
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
29
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
30
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
31
|
-
};
|
|
32
|
-
var __copyProps = (to2, from, except, desc) => {
|
|
33
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
34
|
-
for (let key of __getOwnPropNames(from))
|
|
35
|
-
if (!__hasOwnProp.call(to2, key) && key !== except)
|
|
36
|
-
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
37
|
-
}
|
|
38
|
-
return to2;
|
|
39
|
-
};
|
|
40
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
41
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
42
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
43
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
44
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
45
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
46
|
-
mod
|
|
47
|
-
));
|
|
48
|
-
|
|
49
|
-
// ../node_modules/balanced-match/index.js
|
|
50
|
-
var require_balanced_match = __commonJS({
|
|
51
|
-
"../node_modules/balanced-match/index.js"(exports, module) {
|
|
52
|
-
module.exports = balanced;
|
|
53
|
-
function balanced(a, b, str) {
|
|
54
|
-
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
55
|
-
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
56
|
-
var r = range(a, b, str);
|
|
57
|
-
return r && {
|
|
58
|
-
start: r[0],
|
|
59
|
-
end: r[1],
|
|
60
|
-
pre: str.slice(0, r[0]),
|
|
61
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
62
|
-
post: str.slice(r[1] + b.length)
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function maybeMatch(reg, str) {
|
|
66
|
-
var m = str.match(reg);
|
|
67
|
-
return m ? m[0] : null;
|
|
68
|
-
}
|
|
69
|
-
balanced.range = range;
|
|
70
|
-
function range(a, b, str) {
|
|
71
|
-
var begs, beg, left, right, result;
|
|
72
|
-
var ai2 = str.indexOf(a);
|
|
73
|
-
var bi2 = str.indexOf(b, ai2 + 1);
|
|
74
|
-
var i = ai2;
|
|
75
|
-
if (ai2 >= 0 && bi2 > 0) {
|
|
76
|
-
if (a === b) {
|
|
77
|
-
return [ai2, bi2];
|
|
78
|
-
}
|
|
79
|
-
begs = [];
|
|
80
|
-
left = str.length;
|
|
81
|
-
while (i >= 0 && !result) {
|
|
82
|
-
if (i == ai2) {
|
|
83
|
-
begs.push(i);
|
|
84
|
-
ai2 = str.indexOf(a, i + 1);
|
|
85
|
-
} else if (begs.length == 1) {
|
|
86
|
-
result = [begs.pop(), bi2];
|
|
87
|
-
} else {
|
|
88
|
-
beg = begs.pop();
|
|
89
|
-
if (beg < left) {
|
|
90
|
-
left = beg;
|
|
91
|
-
right = bi2;
|
|
92
|
-
}
|
|
93
|
-
bi2 = str.indexOf(b, i + 1);
|
|
94
|
-
}
|
|
95
|
-
i = ai2 < bi2 && ai2 >= 0 ? ai2 : bi2;
|
|
96
|
-
}
|
|
97
|
-
if (begs.length) {
|
|
98
|
-
result = [left, right];
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return result;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// ../node_modules/glob/node_modules/brace-expansion/index.js
|
|
107
|
-
var require_brace_expansion = __commonJS({
|
|
108
|
-
"../node_modules/glob/node_modules/brace-expansion/index.js"(exports, module) {
|
|
109
|
-
var balanced = require_balanced_match();
|
|
110
|
-
module.exports = expandTop;
|
|
111
|
-
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
112
|
-
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
113
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
114
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
115
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
116
|
-
function numeric(str) {
|
|
117
|
-
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
118
|
-
}
|
|
119
|
-
function escapeBraces(str) {
|
|
120
|
-
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
121
|
-
}
|
|
122
|
-
function unescapeBraces(str) {
|
|
123
|
-
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
124
|
-
}
|
|
125
|
-
function parseCommaParts(str) {
|
|
126
|
-
if (!str)
|
|
127
|
-
return [""];
|
|
128
|
-
var parts = [];
|
|
129
|
-
var m = balanced("{", "}", str);
|
|
130
|
-
if (!m)
|
|
131
|
-
return str.split(",");
|
|
132
|
-
var pre = m.pre;
|
|
133
|
-
var body = m.body;
|
|
134
|
-
var post = m.post;
|
|
135
|
-
var p12 = pre.split(",");
|
|
136
|
-
p12[p12.length - 1] += "{" + body + "}";
|
|
137
|
-
var postParts = parseCommaParts(post);
|
|
138
|
-
if (post.length) {
|
|
139
|
-
p12[p12.length - 1] += postParts.shift();
|
|
140
|
-
p12.push.apply(p12, postParts);
|
|
141
|
-
}
|
|
142
|
-
parts.push.apply(parts, p12);
|
|
143
|
-
return parts;
|
|
144
|
-
}
|
|
145
|
-
function expandTop(str) {
|
|
146
|
-
if (!str)
|
|
147
|
-
return [];
|
|
148
|
-
if (str.substr(0, 2) === "{}") {
|
|
149
|
-
str = "\\{\\}" + str.substr(2);
|
|
150
|
-
}
|
|
151
|
-
return expand2(escapeBraces(str), true).map(unescapeBraces);
|
|
152
|
-
}
|
|
153
|
-
function embrace(str) {
|
|
154
|
-
return "{" + str + "}";
|
|
155
|
-
}
|
|
156
|
-
function isPadded(el2) {
|
|
157
|
-
return /^-?0\d/.test(el2);
|
|
158
|
-
}
|
|
159
|
-
function lte(i, y) {
|
|
160
|
-
return i <= y;
|
|
161
|
-
}
|
|
162
|
-
function gte(i, y) {
|
|
163
|
-
return i >= y;
|
|
164
|
-
}
|
|
165
|
-
function expand2(str, isTop) {
|
|
166
|
-
var expansions = [];
|
|
167
|
-
var m = balanced("{", "}", str);
|
|
168
|
-
if (!m) return [str];
|
|
169
|
-
var pre = m.pre;
|
|
170
|
-
var post = m.post.length ? expand2(m.post, false) : [""];
|
|
171
|
-
if (/\$$/.test(m.pre)) {
|
|
172
|
-
for (var k = 0; k < post.length; k++) {
|
|
173
|
-
var expansion = pre + "{" + m.body + "}" + post[k];
|
|
174
|
-
expansions.push(expansion);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
178
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
179
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
180
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
181
|
-
if (!isSequence && !isOptions) {
|
|
182
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
183
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
184
|
-
return expand2(str);
|
|
185
|
-
}
|
|
186
|
-
return [str];
|
|
187
|
-
}
|
|
188
|
-
var n;
|
|
189
|
-
if (isSequence) {
|
|
190
|
-
n = m.body.split(/\.\./);
|
|
191
|
-
} else {
|
|
192
|
-
n = parseCommaParts(m.body);
|
|
193
|
-
if (n.length === 1) {
|
|
194
|
-
n = expand2(n[0], false).map(embrace);
|
|
195
|
-
if (n.length === 1) {
|
|
196
|
-
return post.map(function(p12) {
|
|
197
|
-
return m.pre + n[0] + p12;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
var N;
|
|
203
|
-
if (isSequence) {
|
|
204
|
-
var x = numeric(n[0]);
|
|
205
|
-
var y = numeric(n[1]);
|
|
206
|
-
var width = Math.max(n[0].length, n[1].length);
|
|
207
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
208
|
-
var test = lte;
|
|
209
|
-
var reverse = y < x;
|
|
210
|
-
if (reverse) {
|
|
211
|
-
incr *= -1;
|
|
212
|
-
test = gte;
|
|
213
|
-
}
|
|
214
|
-
var pad = n.some(isPadded);
|
|
215
|
-
N = [];
|
|
216
|
-
for (var i = x; test(i, y); i += incr) {
|
|
217
|
-
var c;
|
|
218
|
-
if (isAlphaSequence) {
|
|
219
|
-
c = String.fromCharCode(i);
|
|
220
|
-
if (c === "\\")
|
|
221
|
-
c = "";
|
|
222
|
-
} else {
|
|
223
|
-
c = String(i);
|
|
224
|
-
if (pad) {
|
|
225
|
-
var need = width - c.length;
|
|
226
|
-
if (need > 0) {
|
|
227
|
-
var z = new Array(need + 1).join("0");
|
|
228
|
-
if (i < 0)
|
|
229
|
-
c = "-" + z + c.slice(1);
|
|
230
|
-
else
|
|
231
|
-
c = z + c;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
N.push(c);
|
|
236
|
-
}
|
|
237
|
-
} else {
|
|
238
|
-
N = [];
|
|
239
|
-
for (var j = 0; j < n.length; j++) {
|
|
240
|
-
N.push.apply(N, expand2(n[j], false));
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
for (var j = 0; j < N.length; j++) {
|
|
244
|
-
for (var k = 0; k < post.length; k++) {
|
|
245
|
-
var expansion = pre + N[j] + post[k];
|
|
246
|
-
if (!isTop || isSequence || expansion)
|
|
247
|
-
expansions.push(expansion);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return expansions;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
|
|
256
26
|
// package.json
|
|
257
27
|
var package_default = {
|
|
258
|
-
};
|
|
28
|
+
version: "0.3.0"};
|
|
259
29
|
function loadEnvFiles() {
|
|
260
30
|
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
261
31
|
if (homeDir) {
|
|
262
|
-
const homeEnvPath =
|
|
32
|
+
const homeEnvPath = path11.resolve(homeDir, ".canvasrc");
|
|
263
33
|
if (fs__default.existsSync(homeEnvPath)) {
|
|
264
34
|
dotenv.config({ path: homeEnvPath });
|
|
265
35
|
}
|
|
266
36
|
}
|
|
267
|
-
const localEnvPath =
|
|
37
|
+
const localEnvPath = path11.resolve(process.cwd(), ".env");
|
|
268
38
|
if (fs__default.existsSync(localEnvPath)) {
|
|
269
39
|
dotenv.config({ path: localEnvPath });
|
|
270
40
|
}
|
|
@@ -276,7 +46,8 @@ var config = {
|
|
|
276
46
|
clientSecret: process.env.CANVAS_CLIENT_SECRET || "",
|
|
277
47
|
scope: process.env.CANVAS_SCOPE || "canvas:js_component canvas:asset_library",
|
|
278
48
|
componentDir: process.env.CANVAS_COMPONENT_DIR || "./components",
|
|
279
|
-
verbose: process.env.CANVAS_VERBOSE === "true"
|
|
49
|
+
verbose: process.env.CANVAS_VERBOSE === "true",
|
|
50
|
+
userAgent: process.env.CANVAS_USER_AGENT || ""
|
|
280
51
|
};
|
|
281
52
|
function getConfig() {
|
|
282
53
|
return config;
|
|
@@ -480,10 +251,10 @@ var $E = Ej((DA) => {
|
|
|
480
251
|
return Array(F + 1).join("../") + j.substr(A2.length + 1);
|
|
481
252
|
}
|
|
482
253
|
DA.relative = u0;
|
|
483
|
-
var ie = function() {
|
|
254
|
+
var ie = (function() {
|
|
484
255
|
var A2 = /* @__PURE__ */ Object.create(null);
|
|
485
256
|
return !("__proto__" in A2);
|
|
486
|
-
}();
|
|
257
|
+
})();
|
|
487
258
|
function oe(A2) {
|
|
488
259
|
return A2;
|
|
489
260
|
}
|
|
@@ -1122,15 +893,15 @@ function xF(A2, j) {
|
|
|
1122
893
|
if (!(s === J6 && ($ = A2.charCodeAt(a + 1), $ === NA))) if (s === A6) r === "" && (n = a), r += A2.slice(a, a + 2), a += 1;
|
|
1123
894
|
else if (s === M6 && A2.charCodeAt(a + 1) === _6) {
|
|
1124
895
|
let i = a;
|
|
1125
|
-
for (let
|
|
1126
|
-
else if ($ === _6 && A2.charCodeAt(
|
|
1127
|
-
a =
|
|
896
|
+
for (let p13 = a + 2; p13 < A2.length; p13++) if ($ = A2.charCodeAt(p13), $ === A6) p13 += 1;
|
|
897
|
+
else if ($ === _6 && A2.charCodeAt(p13 + 1) === M6) {
|
|
898
|
+
a = p13 + 1;
|
|
1128
899
|
break;
|
|
1129
900
|
}
|
|
1130
901
|
let c = A2.slice(i, a + 1);
|
|
1131
902
|
if (c.charCodeAt(2) === D8) {
|
|
1132
|
-
let
|
|
1133
|
-
k.push(
|
|
903
|
+
let p13 = dt(c.slice(2, -2));
|
|
904
|
+
k.push(p13), F && (p13.src = [F, i, a + 1], p13.dst = [F, i, a + 1]);
|
|
1134
905
|
}
|
|
1135
906
|
} else if (s === fG || s === mG) {
|
|
1136
907
|
let i = XG(A2, a, s);
|
|
@@ -1141,7 +912,7 @@ function xF(A2, j) {
|
|
|
1141
912
|
if (r.length === 0) continue;
|
|
1142
913
|
$ = r.charCodeAt(r.length - 1), $ !== j6 && $ !== NA && $ !== R6 && (r += " ");
|
|
1143
914
|
} else if (s === PG && A2.charCodeAt(a + 1) === PG && r.length === 0) {
|
|
1144
|
-
let i = "", c = a,
|
|
915
|
+
let i = "", c = a, p13 = -1;
|
|
1145
916
|
for (let I = a + 2; I < A2.length; I++) if ($ = A2.charCodeAt(I), $ === A6) I += 1;
|
|
1146
917
|
else if ($ === fG || $ === mG) I = XG(A2, I, $);
|
|
1147
918
|
else if ($ === M6 && A2.charCodeAt(I + 1) === _6) {
|
|
@@ -1150,7 +921,7 @@ function xF(A2, j) {
|
|
|
1150
921
|
I = g + 1;
|
|
1151
922
|
break;
|
|
1152
923
|
}
|
|
1153
|
-
} else if (
|
|
924
|
+
} else if (p13 === -1 && $ === h8) p13 = r.length + I - c;
|
|
1154
925
|
else if ($ === N6 && i.length === 0) {
|
|
1155
926
|
r += A2.slice(c, I), a = I;
|
|
1156
927
|
break;
|
|
@@ -1161,7 +932,7 @@ function xF(A2, j) {
|
|
|
1161
932
|
a = I - 1, r += A2.slice(c, I);
|
|
1162
933
|
break;
|
|
1163
934
|
} else ($ === HG || $ === d8 || $ === JE) && i.length > 0 && A2[I] === i[i.length - 1] && (i = i.slice(0, -1));
|
|
1164
|
-
let h = VE(r,
|
|
935
|
+
let h = VE(r, p13);
|
|
1165
936
|
if (!h) throw new Error("Invalid custom property, expected a value");
|
|
1166
937
|
F && (h.src = [F, c, a], h.dst = [F, c, a]), t ? t.nodes.push(h) : E.push(h), r = "";
|
|
1167
938
|
} else if (s === N6 && r.charCodeAt(0) === UE) q = z6(r), F && (q.src = [F, n, a], q.dst = [F, n, a]), t ? t.nodes.push(q) : E.push(q), r = "", q = null;
|
|
@@ -1179,9 +950,9 @@ function xF(A2, j) {
|
|
|
1179
950
|
else {
|
|
1180
951
|
let c = r.indexOf(":");
|
|
1181
952
|
if (t) {
|
|
1182
|
-
let
|
|
1183
|
-
if (!
|
|
1184
|
-
F && (
|
|
953
|
+
let p13 = VE(r, c);
|
|
954
|
+
if (!p13) throw new Error(`Invalid declaration: \`${r.trim()}\``);
|
|
955
|
+
F && (p13.src = [F, n, a], p13.dst = [F, n, a]), t.nodes.push(p13);
|
|
1185
956
|
}
|
|
1186
957
|
}
|
|
1187
958
|
let i = G.pop() ?? null;
|
|
@@ -1560,23 +1331,23 @@ function ZE(A2, j, F = [], E = {}) {
|
|
|
1560
1331
|
}
|
|
1561
1332
|
function E6(A2, j, F = 3) {
|
|
1562
1333
|
let E = [], k = /* @__PURE__ */ new Set(), G = new iA(() => /* @__PURE__ */ new Set()), t = new iA(() => /* @__PURE__ */ new Set()), q = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), e = [], n = [], $ = new iA(() => /* @__PURE__ */ new Set());
|
|
1563
|
-
function a(i, c,
|
|
1334
|
+
function a(i, c, p13 = {}, h = 0) {
|
|
1564
1335
|
if (i.kind === "declaration") {
|
|
1565
1336
|
if (i.property === "--tw-sort" || i.value === void 0 || i.value === null) return;
|
|
1566
|
-
if (
|
|
1337
|
+
if (p13.theme && i.property[0] === "-" && i.property[1] === "-") {
|
|
1567
1338
|
if (i.value === "initial") {
|
|
1568
1339
|
i.value = void 0;
|
|
1569
1340
|
return;
|
|
1570
1341
|
}
|
|
1571
|
-
|
|
1342
|
+
p13.keyframes || G.get(c).add(i);
|
|
1572
1343
|
}
|
|
1573
|
-
if (i.value.includes("var(")) if (
|
|
1344
|
+
if (i.value.includes("var(")) if (p13.theme && i.property[0] === "-" && i.property[1] === "-") for (let I of ut(i.value)) $.get(I).add(i.property);
|
|
1574
1345
|
else j.trackUsedVariables(i.value);
|
|
1575
1346
|
if (i.property === "animation") for (let I of zG(i.value)) r.add(I);
|
|
1576
1347
|
F & 2 && i.value.includes("color-mix(") && t.get(c).add(i), c.push(i);
|
|
1577
1348
|
} else if (i.kind === "rule") {
|
|
1578
1349
|
let I = [];
|
|
1579
|
-
for (let b of i.nodes) a(b, I,
|
|
1350
|
+
for (let b of i.nodes) a(b, I, p13, h + 1);
|
|
1580
1351
|
let g = {}, v = /* @__PURE__ */ new Set();
|
|
1581
1352
|
for (let b of I) {
|
|
1582
1353
|
if (b.kind !== "declaration") continue;
|
|
@@ -1596,31 +1367,31 @@ function E6(A2, j, F = 3) {
|
|
|
1596
1367
|
}
|
|
1597
1368
|
k.add(i.params);
|
|
1598
1369
|
let I = { ...i, nodes: [] };
|
|
1599
|
-
for (let g of i.nodes) a(g, I.nodes,
|
|
1370
|
+
for (let g of i.nodes) a(g, I.nodes, p13, h + 1);
|
|
1600
1371
|
c.push(I);
|
|
1601
1372
|
} else if (i.kind === "at-rule") {
|
|
1602
|
-
i.name === "@keyframes" && (
|
|
1373
|
+
i.name === "@keyframes" && (p13 = { ...p13, keyframes: true });
|
|
1603
1374
|
let I = { ...i, nodes: [] };
|
|
1604
|
-
for (let g of i.nodes) a(g, I.nodes,
|
|
1605
|
-
i.name === "@keyframes" &&
|
|
1375
|
+
for (let g of i.nodes) a(g, I.nodes, p13, h + 1);
|
|
1376
|
+
i.name === "@keyframes" && p13.theme && q.add(I), (I.nodes.length > 0 || I.name === "@layer" || I.name === "@charset" || I.name === "@custom-media" || I.name === "@namespace" || I.name === "@import") && c.push(I);
|
|
1606
1377
|
} else if (i.kind === "at-root") for (let I of i.nodes) {
|
|
1607
1378
|
let g = [];
|
|
1608
|
-
a(I, g,
|
|
1379
|
+
a(I, g, p13, 0);
|
|
1609
1380
|
for (let v of g) E.push(v);
|
|
1610
1381
|
}
|
|
1611
1382
|
else if (i.kind === "context") {
|
|
1612
1383
|
if (i.context.reference) return;
|
|
1613
|
-
for (let I of i.nodes) a(I, c, { ...
|
|
1384
|
+
for (let I of i.nodes) a(I, c, { ...p13, ...i.context }, h);
|
|
1614
1385
|
} else i.kind === "comment" && c.push(i);
|
|
1615
1386
|
}
|
|
1616
1387
|
let s = [];
|
|
1617
1388
|
for (let i of A2) a(i, s, {}, 0);
|
|
1618
|
-
A: for (let [i, c] of G) for (let
|
|
1619
|
-
if (Dt(
|
|
1620
|
-
if (
|
|
1389
|
+
A: for (let [i, c] of G) for (let p13 of c) {
|
|
1390
|
+
if (Dt(p13.property, j.theme, $)) {
|
|
1391
|
+
if (p13.property.startsWith(j.theme.prefixKey("--animate-"))) for (let I of zG(p13.value)) r.add(I);
|
|
1621
1392
|
continue;
|
|
1622
1393
|
}
|
|
1623
|
-
let h = i.indexOf(
|
|
1394
|
+
let h = i.indexOf(p13);
|
|
1624
1395
|
if (i.splice(h, 1), i.length === 0) {
|
|
1625
1396
|
let I = L8(s, (g) => g.kind === "rule" && g.nodes === i);
|
|
1626
1397
|
if (!I || I.length === 0) continue A;
|
|
@@ -1641,10 +1412,10 @@ function E6(A2, j, F = 3) {
|
|
|
1641
1412
|
let c = E.indexOf(i);
|
|
1642
1413
|
E.splice(c, 1);
|
|
1643
1414
|
}
|
|
1644
|
-
if (s = s.concat(E), F & 2) for (let [i, c] of t) for (let
|
|
1645
|
-
let h = i.indexOf(
|
|
1646
|
-
if (h === -1 ||
|
|
1647
|
-
let I = BA(
|
|
1415
|
+
if (s = s.concat(E), F & 2) for (let [i, c] of t) for (let p13 of c) {
|
|
1416
|
+
let h = i.indexOf(p13);
|
|
1417
|
+
if (h === -1 || p13.value == null) continue;
|
|
1418
|
+
let I = BA(p13.value), g = false;
|
|
1648
1419
|
if (wA(I, (L, { replaceWith: T }) => {
|
|
1649
1420
|
if (L.kind !== "function" || L.value !== "color-mix") return;
|
|
1650
1421
|
let P = false, AA = false;
|
|
@@ -1685,8 +1456,8 @@ function E6(A2, j, F = 3) {
|
|
|
1685
1456
|
S.kind === "word" && (S.value === "oklab" || S.value === "oklch" || S.value === "lab" || S.value === "lch") && (S.value = "srgb");
|
|
1686
1457
|
}
|
|
1687
1458
|
}), !g) continue;
|
|
1688
|
-
let v = { ...
|
|
1689
|
-
b.src =
|
|
1459
|
+
let v = { ...p13, value: mA(I) }, b = uA("@supports (color: color-mix(in lab, red, red))", [p13]);
|
|
1460
|
+
b.src = p13.src, i.splice(h, 1, v, b);
|
|
1690
1461
|
}
|
|
1691
1462
|
if (F & 1) {
|
|
1692
1463
|
let i = [];
|
|
@@ -1699,8 +1470,8 @@ function E6(A2, j, F = 3) {
|
|
|
1699
1470
|
c.src = n[0].src, i.push(c);
|
|
1700
1471
|
}
|
|
1701
1472
|
if (i.length > 0) {
|
|
1702
|
-
let c = s.findIndex((I) => !(I.kind === "comment" || I.kind === "at-rule" && (I.name === "@charset" || I.name === "@import"))),
|
|
1703
|
-
|
|
1473
|
+
let c = s.findIndex((I) => !(I.kind === "comment" || I.kind === "at-rule" && (I.name === "@charset" || I.name === "@import"))), p13 = EA("@layer", "properties", []);
|
|
1474
|
+
p13.src = i[0].src, s.splice(c < 0 ? s.length : c, 0, p13);
|
|
1704
1475
|
let h = uA("@layer properties", [EA("@supports", "((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b))))", i)]);
|
|
1705
1476
|
h.src = i[0].src, h.nodes[0].src = i[0].src, s.push(h);
|
|
1706
1477
|
}
|
|
@@ -1939,17 +1710,17 @@ function* T8(A2, j) {
|
|
|
1939
1710
|
if (a[a.length - 1] !== "]") return;
|
|
1940
1711
|
let c = hj(a.slice(i + 1, -1));
|
|
1941
1712
|
if (!$j(c)) continue;
|
|
1942
|
-
let
|
|
1713
|
+
let p13 = "";
|
|
1943
1714
|
for (let h = 0; h < c.length; h++) {
|
|
1944
1715
|
let I = c.charCodeAt(h);
|
|
1945
1716
|
if (I === O8) {
|
|
1946
|
-
|
|
1717
|
+
p13 = c.slice(0, h), c = c.slice(h + 1);
|
|
1947
1718
|
break;
|
|
1948
1719
|
}
|
|
1949
1720
|
if (!(I === JG || I >= UG && I <= VG)) break;
|
|
1950
1721
|
}
|
|
1951
1722
|
if (c.length === 0 || c.trim().length === 0) continue;
|
|
1952
|
-
s.value = { kind: "arbitrary", dataType:
|
|
1723
|
+
s.value = { kind: "arbitrary", dataType: p13 || null, value: c };
|
|
1953
1724
|
} else {
|
|
1954
1725
|
let c = q === null || s.modifier?.kind === "arbitrary" ? null : `${a}/${q}`;
|
|
1955
1726
|
s.value = { kind: "named", value: a, fraction: c };
|
|
@@ -3064,8 +2835,8 @@ function W8(A2) {
|
|
|
3064
2835
|
Only valid data types are: ${FF.map((c) => `"${c}"`).join(", ")}.
|
|
3065
2836
|
`);
|
|
3066
2837
|
let e = r.value, n = structuredClone(t), $ = "\xB6";
|
|
3067
|
-
wA(n.nodes, (c, { replaceWith:
|
|
3068
|
-
c.kind === "word" && c.value === e &&
|
|
2838
|
+
wA(n.nodes, (c, { replaceWith: p13 }) => {
|
|
2839
|
+
c.kind === "word" && c.value === e && p13({ kind: "word", value: $ });
|
|
3069
2840
|
});
|
|
3070
2841
|
let a = "^".repeat(mA([r]).length), s = mA([n]).indexOf($), i = ["```css", mA([t]), " ".repeat(s) + a, "```"].join(`
|
|
3071
2842
|
`);
|
|
@@ -3076,7 +2847,7 @@ Only valid data types are: ${FF.map((c) => `"${c}"`).join(", ")}.
|
|
|
3076
2847
|
let G = structuredClone(A2), t = k.value, q = k.modifier;
|
|
3077
2848
|
if (t === null) return;
|
|
3078
2849
|
let r = false, e = false, n = false, $ = false, a = /* @__PURE__ */ new Map(), s = false;
|
|
3079
|
-
if (Y([G], (i, { parent: c, replaceWith:
|
|
2850
|
+
if (Y([G], (i, { parent: c, replaceWith: p13 }) => {
|
|
3080
2851
|
if (c?.kind !== "rule" && c?.kind !== "at-rule" || i.kind !== "declaration" || !i.value) return;
|
|
3081
2852
|
let h = BA(i.value);
|
|
3082
2853
|
(wA(h, (I, { replaceWith: g }) => {
|
|
@@ -3084,19 +2855,19 @@ Only valid data types are: ${FF.map((c) => `"${c}"`).join(", ")}.
|
|
|
3084
2855
|
if (I.value === "--value") {
|
|
3085
2856
|
r = true;
|
|
3086
2857
|
let v = WG(t, I, F);
|
|
3087
|
-
return v ? (e = true, v.ratio ? s = true : a.set(i, c), g(v.nodes), 1) : (r ||= false,
|
|
2858
|
+
return v ? (e = true, v.ratio ? s = true : a.set(i, c), g(v.nodes), 1) : (r ||= false, p13([]), 2);
|
|
3088
2859
|
} else if (I.value === "--modifier") {
|
|
3089
|
-
if (q === null) return
|
|
2860
|
+
if (q === null) return p13([]), 2;
|
|
3090
2861
|
n = true;
|
|
3091
2862
|
let v = WG(q, I, F);
|
|
3092
|
-
return v ? ($ = true, g(v.nodes), 1) : (n ||= false,
|
|
2863
|
+
return v ? ($ = true, g(v.nodes), 1) : (n ||= false, p13([]), 2);
|
|
3093
2864
|
}
|
|
3094
2865
|
}
|
|
3095
2866
|
}) ?? 0) === 0 && (i.value = mA(h));
|
|
3096
2867
|
}), r && !e || n && !$ || s && $ || q && !s && !$) return null;
|
|
3097
2868
|
if (s) for (let [i, c] of a) {
|
|
3098
|
-
let
|
|
3099
|
-
|
|
2869
|
+
let p13 = c.nodes.indexOf(i);
|
|
2870
|
+
p13 !== -1 && c.nodes.splice(p13, 1);
|
|
3100
2871
|
}
|
|
3101
2872
|
return G.nodes;
|
|
3102
2873
|
}), F.utilities.suggest(j.slice(0, -2), () => {
|
|
@@ -3314,8 +3085,8 @@ function ex(A2) {
|
|
|
3314
3085
|
let v = I.kind === "at-rule", b = g.kind === "at-rule";
|
|
3315
3086
|
return v && !b ? -1 : !v && b ? 1 : 0;
|
|
3316
3087
|
});
|
|
3317
|
-
let
|
|
3318
|
-
for (let I =
|
|
3088
|
+
let p13 = c.flatMap((I) => I.kind === "rule" ? I.selector === "&" ? [] : [I.selector] : I.kind === "at-rule" ? [`${I.name} ${I.params}`] : []), h = "";
|
|
3089
|
+
for (let I = p13.length - 1; I >= 0; I--) h = h === "" ? p13[I] : `${p13[I]} { ${h} }`;
|
|
3319
3090
|
s.push(h);
|
|
3320
3091
|
}), s;
|
|
3321
3092
|
};
|
|
@@ -3474,25 +3245,25 @@ function xx(A2) {
|
|
|
3474
3245
|
let i = [], c = [];
|
|
3475
3246
|
for (let h of s) h.kind === "at-rule" ? i.push(h) : h.kind === "rule" && c.push(h);
|
|
3476
3247
|
if (i.length > 1 || c.length > 1) return 2;
|
|
3477
|
-
let
|
|
3248
|
+
let p13 = [];
|
|
3478
3249
|
for (let h of c) {
|
|
3479
3250
|
let I = t(h.selector);
|
|
3480
3251
|
if (!I) return $ = false, 2;
|
|
3481
|
-
|
|
3252
|
+
p13.push(FA(I, []));
|
|
3482
3253
|
}
|
|
3483
3254
|
for (let h of i) {
|
|
3484
3255
|
let I = G(h);
|
|
3485
3256
|
if (!I) return $ = false, 2;
|
|
3486
|
-
|
|
3257
|
+
p13.push(I);
|
|
3487
3258
|
}
|
|
3488
|
-
return Object.assign(e, FA("&",
|
|
3259
|
+
return Object.assign(e, FA("&", p13)), $ = true, 1;
|
|
3489
3260
|
}), e.kind === "rule" && e.selector === "&" && e.nodes.length === 1 && Object.assign(e, e.nodes[0]), !$) return null;
|
|
3490
3261
|
}), j.suggest("not", () => Array.from(j.keys()).filter((e) => j.compoundsWith("not", e))), j.compound("group", 2, (e, n) => {
|
|
3491
3262
|
if (n.variant.kind === "arbitrary" && n.variant.relative) return null;
|
|
3492
3263
|
let $ = n.modifier ? `:where(.${A2.prefix ? `${A2.prefix}\\:` : ""}group\\/${n.modifier.value})` : `:where(.${A2.prefix ? `${A2.prefix}\\:` : ""}group)`, a = false;
|
|
3493
3264
|
if (Y([e], (s, { path: i }) => {
|
|
3494
3265
|
if (s.kind !== "rule") return 0;
|
|
3495
|
-
for (let
|
|
3266
|
+
for (let p13 of i.slice(0, -1)) if (p13.kind === "rule") return a = false, 2;
|
|
3496
3267
|
let c = s.selector.replaceAll("&", $);
|
|
3497
3268
|
U(c, ",").length > 1 && (c = `:is(${c})`), s.selector = `&:is(${c} *)`, a = true;
|
|
3498
3269
|
}), !a) return null;
|
|
@@ -3501,7 +3272,7 @@ function xx(A2) {
|
|
|
3501
3272
|
let $ = n.modifier ? `:where(.${A2.prefix ? `${A2.prefix}\\:` : ""}peer\\/${n.modifier.value})` : `:where(.${A2.prefix ? `${A2.prefix}\\:` : ""}peer)`, a = false;
|
|
3502
3273
|
if (Y([e], (s, { path: i }) => {
|
|
3503
3274
|
if (s.kind !== "rule") return 0;
|
|
3504
|
-
for (let
|
|
3275
|
+
for (let p13 of i.slice(0, -1)) if (p13.kind === "rule") return a = false, 2;
|
|
3505
3276
|
let c = s.selector.replaceAll("&", $);
|
|
3506
3277
|
U(c, ",").length > 1 && (c = `:is(${c})`), s.selector = `&:is(${c} ~ *)`, a = true;
|
|
3507
3278
|
}), !a) return null;
|
|
@@ -3735,9 +3506,9 @@ function jE(A2, j, { onInvalidCandidate: F, respectImportant: E } = {}) {
|
|
|
3735
3506
|
if (s.length !== 0) {
|
|
3736
3507
|
$ = true;
|
|
3737
3508
|
for (let { node: i, propertySort: c } of s) {
|
|
3738
|
-
let
|
|
3739
|
-
for (let h of a.variants)
|
|
3740
|
-
k.set(i, { properties: c, variants:
|
|
3509
|
+
let p13 = 0n;
|
|
3510
|
+
for (let h of a.variants) p13 |= 1n << BigInt(r.get(h));
|
|
3511
|
+
k.set(i, { properties: c, variants: p13, candidate: e }), G.push(i);
|
|
3741
3512
|
}
|
|
3742
3513
|
}
|
|
3743
3514
|
}
|
|
@@ -3846,7 +3617,7 @@ function GF(A2, j) {
|
|
|
3846
3617
|
t.get(i).add($), Y($.nodes, (c) => {
|
|
3847
3618
|
if (!(c.kind !== "at-rule" || c.name !== "@apply")) {
|
|
3848
3619
|
k.add($);
|
|
3849
|
-
for (let
|
|
3620
|
+
for (let p13 of Ft(c, j)) G.get($).add(p13);
|
|
3850
3621
|
}
|
|
3851
3622
|
});
|
|
3852
3623
|
return;
|
|
@@ -3866,12 +3637,12 @@ function GF(A2, j) {
|
|
|
3866
3637
|
throw $.kind === "at-rule" && $.name === "@utility" && s.kind === "at-rule" && s.name === "@utility" && Y($.nodes, (i) => {
|
|
3867
3638
|
if (i.kind !== "at-rule" || i.name !== "@apply") return;
|
|
3868
3639
|
let c = i.params.split(/\s+/g);
|
|
3869
|
-
for (let
|
|
3640
|
+
for (let p13 of c) for (let h of j.parseCandidate(p13)) switch (h.kind) {
|
|
3870
3641
|
case "arbitrary":
|
|
3871
3642
|
break;
|
|
3872
3643
|
case "static":
|
|
3873
3644
|
case "functional":
|
|
3874
|
-
if (s.params.replace(/-\*$/, "") === h.root) throw new Error(`You cannot \`@apply\` the \`${
|
|
3645
|
+
if (s.params.replace(/-\*$/, "") === h.root) throw new Error(`You cannot \`@apply\` the \`${p13}\` utility here because it creates a circular dependency.`);
|
|
3875
3646
|
break;
|
|
3876
3647
|
}
|
|
3877
3648
|
}), new Error(`Circular dependency detected:
|
|
@@ -3889,8 +3660,8 @@ ${uj([s])}`);
|
|
|
3889
3660
|
for (let $ of k) n($);
|
|
3890
3661
|
for (let $ of r) "nodes" in $ && Y($.nodes, (a, { replaceWith: s }) => {
|
|
3891
3662
|
if (a.kind !== "at-rule" || a.name !== "@apply") return;
|
|
3892
|
-
let i = a.params.split(/(\s+)/g), c = {},
|
|
3893
|
-
for (let [h, I] of i.entries()) h % 2 === 0 && (c[I] =
|
|
3663
|
+
let i = a.params.split(/(\s+)/g), c = {}, p13 = 0;
|
|
3664
|
+
for (let [h, I] of i.entries()) h % 2 === 0 && (c[I] = p13), p13 += I.length;
|
|
3894
3665
|
{
|
|
3895
3666
|
let h = Object.keys(c), I = jE(h, j, { respectImportant: false, onInvalidCandidate: (L) => {
|
|
3896
3667
|
if (j.theme.prefix && !L.startsWith(j.theme.prefix)) throw new Error(`Cannot apply unprefixed utility class \`${L}\`. Did you mean \`${j.theme.prefix}:${L}\`?`);
|
|
@@ -3949,8 +3720,8 @@ async function Lt(A2, j, F, E = 0, k = false) {
|
|
|
3949
3720
|
let i = pj({}, []);
|
|
3950
3721
|
return t.push((async () => {
|
|
3951
3722
|
if (E > 100) throw new Error(`Exceeded maximum recursion depth while resolving \`${n}\` in \`${j}\`)`);
|
|
3952
|
-
let c = await F(n, j),
|
|
3953
|
-
await Lt(
|
|
3723
|
+
let c = await F(n, j), p13 = xF(c.content, { from: k ? c.path : void 0 });
|
|
3724
|
+
await Lt(p13, c.base, F, E + 1, k), i.nodes = ox(q, [pj({ base: c.base }, p13)], $, a, s);
|
|
3954
3725
|
})()), r(i), 1;
|
|
3955
3726
|
}
|
|
3956
3727
|
}), t.length > 0 && await Promise.all(t), G;
|
|
@@ -4133,14 +3904,14 @@ function px(A2, j) {
|
|
|
4133
3904
|
continue;
|
|
4134
3905
|
}
|
|
4135
3906
|
let a = n.indexOf("--"), s = n.slice(0, a), i = n.slice(a + 2);
|
|
4136
|
-
i = i.replace(/-([a-z])/g, (c,
|
|
3907
|
+
i = i.replace(/-([a-z])/g, (c, p13) => p13.toUpperCase()), k.get(s === "" ? null : s).set(i, [$, A2.getOptions(`--${F}${n}`)]);
|
|
4137
3908
|
}
|
|
4138
3909
|
let q = A2.getOptions(`--${F}`);
|
|
4139
3910
|
for (let [n, $] of k) {
|
|
4140
3911
|
let a = E.get(n);
|
|
4141
3912
|
if (typeof a != "string") continue;
|
|
4142
3913
|
let s = {}, i = {};
|
|
4143
|
-
for (let [c, [
|
|
3914
|
+
for (let [c, [p13, h]] of $) s[c] = p13, i[c] = h;
|
|
4144
3915
|
E.set(n, [a, s]), t.set(n, [q, i]);
|
|
4145
3916
|
}
|
|
4146
3917
|
let r = {}, e = {};
|
|
@@ -4391,10 +4162,10 @@ function Bt({ designSystem: A2, ast: j, resolvedConfig: F, featuresRef: E, refer
|
|
|
4391
4162
|
});
|
|
4392
4163
|
}, (a, s) => {
|
|
4393
4164
|
if (a.kind !== "functional" || s.kind !== "functional") return 0;
|
|
4394
|
-
let i = a.value ? a.value.value : "DEFAULT", c = s.value ? s.value.value : "DEFAULT",
|
|
4395
|
-
if (e && typeof e.sort == "function") return e.sort({ value:
|
|
4165
|
+
let i = a.value ? a.value.value : "DEFAULT", c = s.value ? s.value.value : "DEFAULT", p13 = e?.values?.[i] ?? i, h = e?.values?.[c] ?? c;
|
|
4166
|
+
if (e && typeof e.sort == "function") return e.sort({ value: p13, modifier: a.modifier?.value ?? null }, { value: h, modifier: s.modifier?.value ?? null });
|
|
4396
4167
|
let I = $.indexOf(i), g = $.indexOf(c);
|
|
4397
|
-
return I = I === -1 ? $.length : I, g = g === -1 ? $.length : g, I !== g ? I - g :
|
|
4168
|
+
return I = I === -1 ? $.length : I, g = g === -1 ? $.length : g, I !== g ? I - g : p13 < h ? -1 : 1;
|
|
4398
4169
|
}), A2.variants.suggest(q, () => Object.keys(e?.values ?? {}).filter((a) => a !== "DEFAULT"));
|
|
4399
4170
|
}, addUtilities(q) {
|
|
4400
4171
|
q = Array.isArray(q) ? q : [q];
|
|
@@ -4416,7 +4187,7 @@ function Bt({ designSystem: A2, ast: j, resolvedConfig: F, featuresRef: E, refer
|
|
|
4416
4187
|
if (i.kind === "selector" && i.value[0] === "." && st.test(i.value.slice(1))) {
|
|
4417
4188
|
let c = i.value;
|
|
4418
4189
|
i.value = "&";
|
|
4419
|
-
let
|
|
4190
|
+
let p13 = Z6(a), h = c.slice(1), I = p13 === "&" ? Gj($) : [uA(p13, Gj($))];
|
|
4420
4191
|
e.get(h).push(...I), s = true, i.value = c;
|
|
4421
4192
|
return;
|
|
4422
4193
|
}
|
|
@@ -4440,19 +4211,19 @@ function Bt({ designSystem: A2, ast: j, resolvedConfig: F, featuresRef: E, refer
|
|
|
4440
4211
|
let s = function({ negative: i }) {
|
|
4441
4212
|
return (c) => {
|
|
4442
4213
|
if (c.value?.kind === "arbitrary" && e.length > 0 && !e.includes("any") && (c.value.dataType && !e.includes(c.value.dataType) || !c.value.dataType && !xA(c.value.value, e))) return;
|
|
4443
|
-
let
|
|
4214
|
+
let p13 = e.includes("color"), h = null, I = false;
|
|
4444
4215
|
{
|
|
4445
4216
|
let b = r?.values ?? {};
|
|
4446
|
-
|
|
4217
|
+
p13 && (b = Object.assign({ inherit: "inherit", transparent: "transparent", current: "currentcolor" }, b)), c.value ? c.value.kind === "arbitrary" ? h = c.value.value : c.value.fraction && b[c.value.fraction] ? (h = b[c.value.fraction], I = true) : b[c.value.value] ? h = b[c.value.value] : b.__BARE_VALUE__ && (h = b.__BARE_VALUE__(c.value) ?? null, I = (c.value.fraction !== null && h?.includes("/")) ?? false) : h = b.DEFAULT ?? null;
|
|
4447
4218
|
}
|
|
4448
4219
|
if (h === null) return;
|
|
4449
4220
|
let g;
|
|
4450
4221
|
{
|
|
4451
4222
|
let b = r?.modifiers ?? null;
|
|
4452
|
-
c.modifier ? b === "any" || c.modifier.kind === "arbitrary" ? g = c.modifier.value : b?.[c.modifier.value] ? g = b[c.modifier.value] :
|
|
4223
|
+
c.modifier ? b === "any" || c.modifier.kind === "arbitrary" ? g = c.modifier.value : b?.[c.modifier.value] ? g = b[c.modifier.value] : p13 && !Number.isNaN(Number(c.modifier.value)) ? g = `${c.modifier.value}%` : g = null : g = null;
|
|
4453
4224
|
}
|
|
4454
4225
|
if (c.modifier && g === null && !I) return c.value?.kind === "arbitrary" ? null : void 0;
|
|
4455
|
-
|
|
4226
|
+
p13 && g !== null && (h = vA(h, g)), i && (h = `calc(${h} * -1)`);
|
|
4456
4227
|
let v = Gj(a(h, { modifier: g }));
|
|
4457
4228
|
return Ct(v, $, c.raw), E.current |= GF(v, A2), v;
|
|
4458
4229
|
};
|
|
@@ -4461,7 +4232,7 @@ function Bt({ designSystem: A2, ast: j, resolvedConfig: F, featuresRef: E, refer
|
|
|
4461
4232
|
r?.supportsNegativeValues && A2.utilities.functional(`-${$}`, s({ negative: true }), { types: e }), A2.utilities.functional($, s({ negative: false }), { types: e }), A2.utilities.suggest($, () => {
|
|
4462
4233
|
let i = r?.values ?? {}, c = new Set(Object.keys(i));
|
|
4463
4234
|
c.delete("__BARE_VALUE__"), c.delete("__CSS_VALUES__"), c.has("DEFAULT") && (c.delete("DEFAULT"), c.add(null));
|
|
4464
|
-
let
|
|
4235
|
+
let p13 = r?.modifiers ?? {}, h = p13 === "any" ? [] : Object.keys(p13);
|
|
4465
4236
|
return [{ supportsNegative: r?.supportsNegativeValues ?? false, values: Array.from(c), modifiers: h }];
|
|
4466
4237
|
});
|
|
4467
4238
|
}
|
|
@@ -4703,7 +4474,7 @@ async function Jx({ designSystem: A2, base: j, ast: F, loadModule: E, sources: k
|
|
|
4703
4474
|
if (a !== null) throw new Error("`@plugin` cannot be nested.");
|
|
4704
4475
|
let c = $.params.slice(1, -1);
|
|
4705
4476
|
if (c.length === 0) throw new Error("`@plugin` must have a path.");
|
|
4706
|
-
let
|
|
4477
|
+
let p13 = {};
|
|
4707
4478
|
for (let h of $.nodes ?? []) {
|
|
4708
4479
|
if (h.kind !== "declaration") throw new Error(`Unexpected \`@plugin\` option:
|
|
4709
4480
|
|
|
@@ -4723,9 +4494,9 @@ Using an object as a plugin option is currently only supported in JavaScript con
|
|
|
4723
4494
|
} else return Number(v);
|
|
4724
4495
|
return v;
|
|
4725
4496
|
});
|
|
4726
|
-
|
|
4497
|
+
p13[h.property] = g.length === 1 ? g[0] : g;
|
|
4727
4498
|
}
|
|
4728
|
-
t.push([{ id: c, base: i.base, reference: !!i.reference, src: $.src }, Object.keys(
|
|
4499
|
+
t.push([{ id: c, base: i.base, reference: !!i.reference, src: $.src }, Object.keys(p13).length > 0 ? p13 : null]), s([]), G |= 4;
|
|
4729
4500
|
return;
|
|
4730
4501
|
}
|
|
4731
4502
|
if ($.name === "@config") {
|
|
@@ -4744,8 +4515,8 @@ Using an object as a plugin option is currently only supported in JavaScript con
|
|
|
4744
4515
|
let c = await E($, a, "config");
|
|
4745
4516
|
return { path: $, base: c.base, config: c.module, reference: s, src: i };
|
|
4746
4517
|
})), Promise.all(t.map(async ([{ id: $, base: a, reference: s, src: i }, c]) => {
|
|
4747
|
-
let
|
|
4748
|
-
return { path: $, base:
|
|
4518
|
+
let p13 = await E($, a, "plugin");
|
|
4519
|
+
return { path: $, base: p13.base, plugin: p13.module, options: c, reference: s, src: i };
|
|
4749
4520
|
}))]);
|
|
4750
4521
|
return G |= pt({ designSystem: A2, base: j, ast: F, sources: k, configs: e, pluginDetails: n }), G;
|
|
4751
4522
|
}
|
|
@@ -4759,13 +4530,13 @@ function pt({ designSystem: A2, base: j, ast: F, sources: E, configs: k, pluginD
|
|
|
4759
4530
|
} } }, a = Bt({ ...$, referenceMode: false, src: void 0 }), s = A2.resolveThemeValue;
|
|
4760
4531
|
A2.resolveThemeValue = function(i, c) {
|
|
4761
4532
|
if (i[0] === "-" && i[1] === "-") return s(i, c);
|
|
4762
|
-
let
|
|
4763
|
-
if (Array.isArray(
|
|
4764
|
-
if (Array.isArray(
|
|
4765
|
-
if (typeof
|
|
4533
|
+
let p13 = a.theme(i, void 0);
|
|
4534
|
+
if (Array.isArray(p13) && p13.length === 2) return p13[0];
|
|
4535
|
+
if (Array.isArray(p13)) return p13.join(", ");
|
|
4536
|
+
if (typeof p13 == "string") return p13;
|
|
4766
4537
|
};
|
|
4767
|
-
for (let { handler: i, reference: c, src:
|
|
4768
|
-
let h = Bt({ ...$, referenceMode: c ?? false, src:
|
|
4538
|
+
for (let { handler: i, reference: c, src: p13 } of r.plugins) {
|
|
4539
|
+
let h = Bt({ ...$, referenceMode: c ?? false, src: p13 });
|
|
4769
4540
|
i(h);
|
|
4770
4541
|
}
|
|
4771
4542
|
if (sx(A2, e, n), Px(A2, e), Nx(e, A2), Rx(e, A2), wx(e, A2), !A2.theme.prefix && r.prefix) {
|
|
@@ -4774,8 +4545,8 @@ function pt({ designSystem: A2, base: j, ast: F, sources: E, configs: k, pluginD
|
|
|
4774
4545
|
}
|
|
4775
4546
|
if (!A2.important && r.important === true && (A2.important = true), typeof r.important == "string") {
|
|
4776
4547
|
let i = r.important;
|
|
4777
|
-
Y(F, (c, { replaceWith:
|
|
4778
|
-
if (c.kind === "at-rule" && !(c.name !== "@tailwind" || c.params !== "utilities")) return h?.kind === "rule" && h.selector === i ||
|
|
4548
|
+
Y(F, (c, { replaceWith: p13, parent: h }) => {
|
|
4549
|
+
if (c.kind === "at-rule" && !(c.name !== "@tailwind" || c.params !== "utilities")) return h?.kind === "rule" && h.selector === i || p13(FA(i, [c])), 2;
|
|
4779
4550
|
});
|
|
4780
4551
|
}
|
|
4781
4552
|
for (let i of r.blocklist) A2.invalidCandidates.add(i);
|
|
@@ -4884,7 +4655,7 @@ var Mt = ((A2) => (A2[A2.None = 0] = "None", A2[A2.AtApply = 1] = "AtApply", A2[
|
|
|
4884
4655
|
async function E0(A2, { base: j = "", from: F, loadModule: E = Zx, loadStylesheet: k = A0 } = {}) {
|
|
4885
4656
|
let G = 0;
|
|
4886
4657
|
A2 = [pj({ base: j }, A2)], G |= await Lt(A2, j, k, 0, F !== void 0);
|
|
4887
|
-
let t = null, q = new K8(), r = [], e = [], n = null, $ = null, a = [], s = [], i = [], c = [],
|
|
4658
|
+
let t = null, q = new K8(), r = [], e = [], n = null, $ = null, a = [], s = [], i = [], c = [], p13 = null;
|
|
4888
4659
|
Y(A2, (I, { parent: g, replaceWith: v, context: b }) => {
|
|
4889
4660
|
if (I.kind === "at-rule") {
|
|
4890
4661
|
if (I.name === "@tailwind" && (I.params === "utilities" || I.params.startsWith("utilities"))) {
|
|
@@ -4900,11 +4671,11 @@ async function E0(A2, { base: j = "", from: F, loadModule: E = Zx, loadStyleshee
|
|
|
4900
4671
|
for (let T of L) if (T.startsWith("source(")) {
|
|
4901
4672
|
let P = T.slice(7, -1);
|
|
4902
4673
|
if (P === "none") {
|
|
4903
|
-
|
|
4674
|
+
p13 = P;
|
|
4904
4675
|
continue;
|
|
4905
4676
|
}
|
|
4906
4677
|
if (P[0] === '"' && P[P.length - 1] !== '"' || P[0] === "'" && P[P.length - 1] !== "'" || P[0] !== "'" && P[0] !== '"') throw new Error("`source(\u2026)` paths must be quoted.");
|
|
4907
|
-
|
|
4678
|
+
p13 = { base: b.sourceBase ?? b.base, pattern: P.slice(1, -1) };
|
|
4908
4679
|
}
|
|
4909
4680
|
$ = I, G |= 16;
|
|
4910
4681
|
}
|
|
@@ -5042,7 +4813,7 @@ ${AA}`);
|
|
|
5042
4813
|
}
|
|
5043
4814
|
return Y(A2, (I, { replaceWith: g }) => {
|
|
5044
4815
|
if (I.kind === "at-rule") return I.name === "@utility" && g([]), 1;
|
|
5045
|
-
}), { designSystem: h, ast: A2, sources: s, root:
|
|
4816
|
+
}), { designSystem: h, ast: A2, sources: s, root: p13, utilitiesNode: $, features: G, inlineCandidates: i };
|
|
5046
4817
|
}
|
|
5047
4818
|
async function _t(A2, j = {}) {
|
|
5048
4819
|
let { designSystem: F, ast: E, sources: k, root: G, utilitiesNode: t, features: q, inlineCandidates: r } = await E0(A2, j);
|
|
@@ -5055,18 +4826,18 @@ async function _t(A2, j = {}) {
|
|
|
5055
4826
|
return { sources: k, root: G, features: q, build(i) {
|
|
5056
4827
|
if (q === 0) return A2;
|
|
5057
4828
|
if (!t) return $ ??= E6(E, F, j.polyfills), $;
|
|
5058
|
-
let c = s,
|
|
4829
|
+
let c = s, p13 = false;
|
|
5059
4830
|
s = false;
|
|
5060
4831
|
let h = n.size;
|
|
5061
4832
|
for (let g of i) if (!F.invalidCandidates.has(g)) if (g[0] === "-" && g[1] === "-") {
|
|
5062
4833
|
let v = F.theme.markUsedVariable(g);
|
|
5063
|
-
c ||= v,
|
|
4834
|
+
c ||= v, p13 ||= v;
|
|
5064
4835
|
} else n.add(g), c ||= n.size !== h;
|
|
5065
4836
|
if (!c) return $ ??= E6(E, F, j.polyfills), $;
|
|
5066
4837
|
let I = jE(n, F, { onInvalidCandidate: e }).astNodes;
|
|
5067
4838
|
return j.from && Y(I, (g) => {
|
|
5068
4839
|
g.src ??= t.src;
|
|
5069
|
-
}), !
|
|
4840
|
+
}), !p13 && a === I.length ? ($ ??= E6(E, F, j.polyfills), $) : (a = I.length, t.nodes = I, $ = E6(E, F, j.polyfills), $);
|
|
5070
4841
|
} };
|
|
5071
4842
|
}
|
|
5072
4843
|
async function FE(A2, j = {}) {
|
|
@@ -7460,7 +7231,7 @@ var Yt = 60;
|
|
|
7460
7231
|
var Zt = " ";
|
|
7461
7232
|
function Ae({ source: A2, line: j, column: F, baseLine: E, baseColumn: k }, G) {
|
|
7462
7233
|
function t(i, c) {
|
|
7463
|
-
return e.slice(i, c).map((
|
|
7234
|
+
return e.slice(i, c).map((p13, h) => String(i + h + 1).padStart(a) + " |" + p13).join(`
|
|
7464
7235
|
`);
|
|
7465
7236
|
}
|
|
7466
7237
|
let q = `
|
|
@@ -7616,9 +7387,9 @@ function Ge(A2) {
|
|
|
7616
7387
|
j = e, n = n || {}, q.setSource(j, ij), t.setSource(j, n.offset, n.line, n.column), F = n.filename || "<unknown>", E = !!n.positions, k = typeof n.onParseError == "function" ? n.onParseError : Ee, G = false, q.parseAtrulePrelude = "parseAtrulePrelude" in n ? !!n.parseAtrulePrelude : true, q.parseRulePrelude = "parseRulePrelude" in n ? !!n.parseRulePrelude : true, q.parseValue = "parseValue" in n ? !!n.parseValue : true, q.parseCustomProperty = "parseCustomProperty" in n ? !!n.parseCustomProperty : false;
|
|
7617
7388
|
let { context: $ = "default", onComment: a } = n;
|
|
7618
7389
|
if (!($ in q.context)) throw new Error("Unknown context `" + $ + "`");
|
|
7619
|
-
typeof a == "function" && q.forEachToken((i, c,
|
|
7390
|
+
typeof a == "function" && q.forEachToken((i, c, p13) => {
|
|
7620
7391
|
if (i === 25) {
|
|
7621
|
-
let h = q.getLocation(c,
|
|
7392
|
+
let h = q.getLocation(c, p13), I = ej(j, p13 - 2, p13, "*/") ? j.slice(c + 2, p13 - 2) : j.slice(c + 2, p13);
|
|
7622
7393
|
a(I, h);
|
|
7623
7394
|
}
|
|
7624
7395
|
});
|
|
@@ -7771,10 +7542,10 @@ function be(A2) {
|
|
|
7771
7542
|
for (let e in j) gF.call(j, e) && j[e] !== null && (F[e] = Xe(j[e], false), E[e] = Xe(j[e], true));
|
|
7772
7543
|
let t = Le(F), q = Le(E), r = function(e, n) {
|
|
7773
7544
|
function $(h, I, g) {
|
|
7774
|
-
let v = a.call(
|
|
7775
|
-
return v === k ? true : v === G ? false : !!(i.hasOwnProperty(h.type) && i[h.type](h,
|
|
7545
|
+
let v = a.call(p13, h, I, g);
|
|
7546
|
+
return v === k ? true : v === G ? false : !!(i.hasOwnProperty(h.type) && i[h.type](h, p13, $, c) || s.call(p13, h, I, g) === k);
|
|
7776
7547
|
}
|
|
7777
|
-
let a = s6, s = s6, i = F, c = (h, I, g, v) => h || $(I, g, v),
|
|
7548
|
+
let a = s6, s = s6, i = F, c = (h, I, g, v) => h || $(I, g, v), p13 = { break: k, skip: G, root: e, stylesheet: null, atrule: null, atrulePrelude: null, rule: null, selector: null, block: null, declaration: null, function: null };
|
|
7778
7549
|
if (typeof n == "function") a = n;
|
|
7779
7550
|
else if (n && (a = He(n.enter), s = He(n.leave), n.reverse && (i = E), n.visit)) {
|
|
7780
7551
|
if (t.hasOwnProperty(n.visit)) i = n.reverse ? q[n.visit] : t[n.visit];
|
|
@@ -8671,15 +8442,15 @@ function kn(A2, j, F) {
|
|
|
8671
8442
|
function n() {
|
|
8672
8443
|
v.type === YF ? v = v.prev : v = { type: ar, syntax: $.syntax, token: v.token, prev: v }, $ = $.prev;
|
|
8673
8444
|
}
|
|
8674
|
-
let $ = null, a = null, s = null, i = null, c = 0,
|
|
8675
|
-
for (E();
|
|
8445
|
+
let $ = null, a = null, s = null, i = null, c = 0, p13 = null, h = null, I = -1, g = 0, v = { type: Wl, syntax: null, token: null, prev: null };
|
|
8446
|
+
for (E(); p13 === null && ++c < lr; ) switch (j.type) {
|
|
8676
8447
|
case "Match":
|
|
8677
8448
|
if (a === null) {
|
|
8678
8449
|
if (h !== null && (I !== A2.length - 1 || h.value !== "\\0" && h.value !== "\\9")) {
|
|
8679
8450
|
j = GA;
|
|
8680
8451
|
break;
|
|
8681
8452
|
}
|
|
8682
|
-
|
|
8453
|
+
p13 = xr;
|
|
8683
8454
|
break;
|
|
8684
8455
|
}
|
|
8685
8456
|
if (j = a.nextState, j === mE) if (a.matchStack === v) {
|
|
@@ -8692,7 +8463,7 @@ function kn(A2, j, F) {
|
|
|
8692
8463
|
case "Mismatch":
|
|
8693
8464
|
if (i !== null && i !== false) (s === null || I > s.tokenIndex) && (s = i, i = false);
|
|
8694
8465
|
else if (s === null) {
|
|
8695
|
-
|
|
8466
|
+
p13 = Zl;
|
|
8696
8467
|
break;
|
|
8697
8468
|
}
|
|
8698
8469
|
j = s.nextState, a = s.thenStack, $ = s.syntaxStack, v = s.matchStack, I = s.tokenIndex, h = I < A2.length ? A2[I] : null, s = s.prev;
|
|
@@ -8802,9 +8573,9 @@ function kn(A2, j, F) {
|
|
|
8802
8573
|
default:
|
|
8803
8574
|
throw new Error("Unknown node type: " + j.type);
|
|
8804
8575
|
}
|
|
8805
|
-
switch (
|
|
8576
|
+
switch (p13) {
|
|
8806
8577
|
case null:
|
|
8807
|
-
console.warn("[csstree-match] BREAK after " + lr + " iterations"),
|
|
8578
|
+
console.warn("[csstree-match] BREAK after " + lr + " iterations"), p13 = An, v = null;
|
|
8808
8579
|
break;
|
|
8809
8580
|
case xr:
|
|
8810
8581
|
for (; $ !== null; ) n();
|
|
@@ -8812,7 +8583,7 @@ function kn(A2, j, F) {
|
|
|
8812
8583
|
default:
|
|
8813
8584
|
v = null;
|
|
8814
8585
|
}
|
|
8815
|
-
return { tokens: A2, reason:
|
|
8586
|
+
return { tokens: A2, reason: p13, iterations: c, match: v, longestMatch: g };
|
|
8816
8587
|
}
|
|
8817
8588
|
function ZF(A2, j, F) {
|
|
8818
8589
|
let E = kn(A2, j, F || {});
|
|
@@ -10697,19 +10468,26 @@ var ApiService = class _ApiService {
|
|
|
10697
10468
|
clientId;
|
|
10698
10469
|
clientSecret;
|
|
10699
10470
|
scope;
|
|
10471
|
+
userAgent;
|
|
10700
10472
|
accessToken = null;
|
|
10473
|
+
refreshPromise = null;
|
|
10701
10474
|
constructor(options) {
|
|
10702
10475
|
this.clientId = options.clientId;
|
|
10703
10476
|
this.clientSecret = options.clientSecret;
|
|
10704
10477
|
this.siteUrl = options.siteUrl;
|
|
10705
10478
|
this.scope = options.scope;
|
|
10479
|
+
this.userAgent = options.userAgent || "";
|
|
10480
|
+
const headers = {
|
|
10481
|
+
"Content-Type": "application/json",
|
|
10482
|
+
// Add the CLI marker header to identify CLI requests
|
|
10483
|
+
"X-Canvas-CLI": "1"
|
|
10484
|
+
};
|
|
10485
|
+
if (this.userAgent) {
|
|
10486
|
+
headers["User-Agent"] = this.userAgent;
|
|
10487
|
+
}
|
|
10706
10488
|
this.client = axios.create({
|
|
10707
10489
|
baseURL: options.siteUrl,
|
|
10708
|
-
headers
|
|
10709
|
-
"Content-Type": "application/json",
|
|
10710
|
-
// Add the CLI marker header to identify CLI requests
|
|
10711
|
-
"X-Canvas-CLI": "1"
|
|
10712
|
-
},
|
|
10490
|
+
headers,
|
|
10713
10491
|
// Allow longer timeout for uploads
|
|
10714
10492
|
timeout: 3e4,
|
|
10715
10493
|
transformResponse: [
|
|
@@ -10726,33 +10504,80 @@ var ApiService = class _ApiService {
|
|
|
10726
10504
|
}
|
|
10727
10505
|
]
|
|
10728
10506
|
});
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
{
|
|
10742
|
-
headers: {
|
|
10743
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
10507
|
+
this.client.interceptors.response.use(
|
|
10508
|
+
(response) => response,
|
|
10509
|
+
async (error) => {
|
|
10510
|
+
const originalRequest = error.config;
|
|
10511
|
+
if (error.response?.status === 401 && !originalRequest._retry && !originalRequest.url?.includes("/oauth/token")) {
|
|
10512
|
+
originalRequest._retry = true;
|
|
10513
|
+
try {
|
|
10514
|
+
const newToken = await this.refreshAccessToken();
|
|
10515
|
+
originalRequest.headers.Authorization = `Bearer ${newToken}`;
|
|
10516
|
+
return this.client(originalRequest);
|
|
10517
|
+
} catch (refreshError) {
|
|
10518
|
+
return Promise.reject(error);
|
|
10744
10519
|
}
|
|
10745
10520
|
}
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10521
|
+
return Promise.reject(error);
|
|
10522
|
+
}
|
|
10523
|
+
);
|
|
10524
|
+
this.client.interceptors.request.use(
|
|
10525
|
+
async (config2) => {
|
|
10526
|
+
if (!this.accessToken && !config2.url?.includes("/oauth/token")) {
|
|
10527
|
+
try {
|
|
10528
|
+
const token = await this.refreshAccessToken();
|
|
10529
|
+
config2.headers.Authorization = `Bearer ${token}`;
|
|
10530
|
+
} catch (error) {
|
|
10531
|
+
return Promise.reject(error);
|
|
10532
|
+
}
|
|
10533
|
+
}
|
|
10534
|
+
return config2;
|
|
10535
|
+
},
|
|
10536
|
+
(error) => {
|
|
10537
|
+
return Promise.reject(error);
|
|
10538
|
+
}
|
|
10539
|
+
);
|
|
10540
|
+
}
|
|
10541
|
+
/**
|
|
10542
|
+
* Refresh the access token using client credentials.
|
|
10543
|
+
* Handles concurrent refresh attempts by reusing the same promise.
|
|
10544
|
+
*/
|
|
10545
|
+
async refreshAccessToken() {
|
|
10546
|
+
if (this.refreshPromise) {
|
|
10547
|
+
return this.refreshPromise;
|
|
10548
|
+
}
|
|
10549
|
+
this.refreshPromise = (async () => {
|
|
10550
|
+
try {
|
|
10551
|
+
const response = await this.client.post(
|
|
10552
|
+
"/oauth/token",
|
|
10553
|
+
new URLSearchParams({
|
|
10554
|
+
grant_type: "client_credentials",
|
|
10555
|
+
client_id: this.clientId,
|
|
10556
|
+
client_secret: this.clientSecret,
|
|
10557
|
+
scope: this.scope
|
|
10558
|
+
}).toString(),
|
|
10559
|
+
{
|
|
10560
|
+
headers: {
|
|
10561
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
10562
|
+
}
|
|
10563
|
+
}
|
|
10564
|
+
);
|
|
10565
|
+
this.accessToken = response.data.access_token;
|
|
10566
|
+
this.client.defaults.headers.common["Authorization"] = `Bearer ${this.accessToken}`;
|
|
10567
|
+
return this.accessToken;
|
|
10568
|
+
} catch (error) {
|
|
10569
|
+
this.handleApiError(error);
|
|
10570
|
+
throw new Error("Failed to refresh access token");
|
|
10571
|
+
}
|
|
10572
|
+
})();
|
|
10573
|
+
try {
|
|
10574
|
+
return await this.refreshPromise;
|
|
10575
|
+
} finally {
|
|
10576
|
+
this.refreshPromise = null;
|
|
10754
10577
|
}
|
|
10755
|
-
|
|
10578
|
+
}
|
|
10579
|
+
static async create(options) {
|
|
10580
|
+
return new _ApiService(options);
|
|
10756
10581
|
}
|
|
10757
10582
|
getAccessToken() {
|
|
10758
10583
|
return this.accessToken;
|
|
@@ -10976,20 +10801,21 @@ function createApiService() {
|
|
|
10976
10801
|
siteUrl: config2.siteUrl,
|
|
10977
10802
|
clientId: config2.clientId,
|
|
10978
10803
|
clientSecret: config2.clientSecret,
|
|
10979
|
-
scope: config2.scope
|
|
10804
|
+
scope: config2.scope,
|
|
10805
|
+
userAgent: config2.userAgent
|
|
10980
10806
|
});
|
|
10981
10807
|
}
|
|
10982
|
-
var CANVAS_CACHE_DIR =
|
|
10808
|
+
var CANVAS_CACHE_DIR = path11.join(os.homedir(), ".canvas");
|
|
10983
10809
|
async function downloadJsSourceFromCanvas(componentsToDownload) {
|
|
10984
10810
|
for (const key in componentsToDownload) {
|
|
10985
10811
|
const component = componentsToDownload[key];
|
|
10986
10812
|
try {
|
|
10987
|
-
const componentDir =
|
|
10813
|
+
const componentDir = path11.join(CANVAS_CACHE_DIR, component.machineName);
|
|
10988
10814
|
await fs2.rm(componentDir, { recursive: true, force: true });
|
|
10989
10815
|
await fs2.mkdir(componentDir, { recursive: true });
|
|
10990
10816
|
if (component.sourceCodeJs) {
|
|
10991
10817
|
await fs2.writeFile(
|
|
10992
|
-
|
|
10818
|
+
path11.join(componentDir, `index.jsx`),
|
|
10993
10819
|
component.sourceCodeJs,
|
|
10994
10820
|
"utf-8"
|
|
10995
10821
|
);
|
|
@@ -11007,14 +10833,14 @@ async function copyLocalJsSource(componentsToCopy) {
|
|
|
11007
10833
|
try {
|
|
11008
10834
|
await fs2.mkdir(CANVAS_CACHE_DIR, { recursive: true });
|
|
11009
10835
|
for (const componentPath of componentsToCopy) {
|
|
11010
|
-
const baseName =
|
|
10836
|
+
const baseName = path11.basename(componentPath);
|
|
11011
10837
|
const sourcePath = componentPath;
|
|
11012
|
-
const targetPath =
|
|
10838
|
+
const targetPath = path11.join(CANVAS_CACHE_DIR, baseName);
|
|
11013
10839
|
const stats = await fs2.stat(sourcePath);
|
|
11014
10840
|
if (stats.isDirectory()) {
|
|
11015
10841
|
await fs2.mkdir(targetPath, { recursive: true });
|
|
11016
|
-
const sourceFile =
|
|
11017
|
-
const targetFile =
|
|
10842
|
+
const sourceFile = path11.join(sourcePath, "index.jsx");
|
|
10843
|
+
const targetFile = path11.join(targetPath, "index.jsx");
|
|
11018
10844
|
await fs2.copyFile(sourceFile, targetFile);
|
|
11019
10845
|
}
|
|
11020
10846
|
}
|
|
@@ -11032,7 +10858,7 @@ async function cleanUpCacheDirectory() {
|
|
|
11032
10858
|
withFileTypes: true
|
|
11033
10859
|
});
|
|
11034
10860
|
for (const entry of cacheEntries) {
|
|
11035
|
-
const entryPath =
|
|
10861
|
+
const entryPath = path11.join(CANVAS_CACHE_DIR, entry.name);
|
|
11036
10862
|
if (entry.isDirectory()) {
|
|
11037
10863
|
await fs2.rm(entryPath, { recursive: true, force: true });
|
|
11038
10864
|
} else {
|
|
@@ -11057,7 +10883,7 @@ async function getAllClassNameCandidatesFromCacheDir(componentsToDownload, local
|
|
|
11057
10883
|
const cacheEntries = await promises.readdir(CANVAS_CACHE_DIR, {
|
|
11058
10884
|
withFileTypes: true
|
|
11059
10885
|
});
|
|
11060
|
-
const cacheDirs = cacheEntries.filter((entry) => entry.isDirectory()).map((dir) =>
|
|
10886
|
+
const cacheDirs = cacheEntries.filter((entry) => entry.isDirectory()).map((dir) => path11.join(CANVAS_CACHE_DIR, dir.name));
|
|
11061
10887
|
let allClassNameCandidates = [];
|
|
11062
10888
|
for (const cacheDir of cacheDirs) {
|
|
11063
10889
|
const componentClassNameCandidates = await getClassNameCandidatesForComponent(cacheDir);
|
|
@@ -11075,16 +10901,16 @@ async function buildTailwindCss(classNameCandidates, globalSourceCodeCss, distDi
|
|
|
11075
10901
|
globalSourceCodeCss
|
|
11076
10902
|
);
|
|
11077
10903
|
const transformedTwCss = await transformCss(compiledTwCss);
|
|
11078
|
-
await promises.writeFile(
|
|
10904
|
+
await promises.writeFile(path11.join(distDir, "index.css"), transformedTwCss);
|
|
11079
10905
|
}
|
|
11080
10906
|
async function getClassNameCandidatesForComponent(dir) {
|
|
11081
|
-
const componentName =
|
|
10907
|
+
const componentName = path11.basename(dir);
|
|
11082
10908
|
const config2 = getConfig();
|
|
11083
10909
|
const componentsDir = config2.componentDir;
|
|
11084
|
-
const distDir =
|
|
11085
|
-
const jsSource = await promises.readFile(
|
|
10910
|
+
const distDir = path11.join(componentsDir, "dist");
|
|
10911
|
+
const jsSource = await promises.readFile(path11.join(dir, "index.jsx"), "utf-8");
|
|
11086
10912
|
const currentGlobalSourceCodeJs = await promises.readFile(
|
|
11087
|
-
|
|
10913
|
+
path11.join(distDir, "index.js"),
|
|
11088
10914
|
"utf-8"
|
|
11089
10915
|
);
|
|
11090
10916
|
const classNameCandidates = OE(jsSource);
|
|
@@ -11093,7 +10919,7 @@ async function getClassNameCandidatesForComponent(dir) {
|
|
|
11093
10919
|
componentName,
|
|
11094
10920
|
classNameCandidates
|
|
11095
10921
|
);
|
|
11096
|
-
await promises.writeFile(
|
|
10922
|
+
await promises.writeFile(path11.join(distDir, "index.js"), globalJSClassNameIndex);
|
|
11097
10923
|
return nextClassNameCandidates;
|
|
11098
10924
|
}
|
|
11099
10925
|
async function buildTailwindForComponents(selectedComponents) {
|
|
@@ -11104,9 +10930,9 @@ async function buildTailwindForComponents(selectedComponents) {
|
|
|
11104
10930
|
const globalAssetLibrary = await apiService.getGlobalAssetLibrary();
|
|
11105
10931
|
const globalSourceCodeJs = globalAssetLibrary.js.original;
|
|
11106
10932
|
const globalSourceCodeCss = globalAssetLibrary.css.original;
|
|
11107
|
-
const distDir =
|
|
10933
|
+
const distDir = path11.join(config2.componentDir, "dist");
|
|
11108
10934
|
await promises.mkdir(distDir, { recursive: true });
|
|
11109
|
-
const targetFile =
|
|
10935
|
+
const targetFile = path11.join(distDir, "index.js");
|
|
11110
10936
|
await promises.writeFile(targetFile, globalSourceCodeJs, "utf-8");
|
|
11111
10937
|
const allClassNameCandidates = await getAllClassNameCandidatesFromCacheDir(
|
|
11112
10938
|
onlineComponents,
|
|
@@ -11169,16 +10995,49 @@ async function fileExists(filePath) {
|
|
|
11169
10995
|
async function directoryExists(dirPath) {
|
|
11170
10996
|
return await fs2.stat(dirPath).then(() => true).catch(() => false);
|
|
11171
10997
|
}
|
|
10998
|
+
async function validateComponent(componentDir, fix = false) {
|
|
10999
|
+
const eslint = new ESLint({
|
|
11000
|
+
overrideConfigFile: true,
|
|
11001
|
+
overrideConfig: required,
|
|
11002
|
+
fix
|
|
11003
|
+
});
|
|
11004
|
+
const eslintResults = await eslint.lintFiles(componentDir + "/**/*");
|
|
11005
|
+
if (fix) {
|
|
11006
|
+
await ESLint.outputFixes(eslintResults);
|
|
11007
|
+
}
|
|
11008
|
+
const success = eslintResults.every((result) => result.errorCount === 0);
|
|
11009
|
+
const details = [];
|
|
11010
|
+
eslintResults.filter((result) => result.errorCount > 0).forEach((result) => {
|
|
11011
|
+
const messages = result.messages.map(
|
|
11012
|
+
(msg) => `Line ${msg.line}, Column ${msg.column}: ` + msg.message + (msg.ruleId ? ` (${msg.ruleId})` : "")
|
|
11013
|
+
);
|
|
11014
|
+
details.push({
|
|
11015
|
+
heading: path11.relative(process.cwd(), result.filePath),
|
|
11016
|
+
content: messages.join("\n\n")
|
|
11017
|
+
});
|
|
11018
|
+
});
|
|
11019
|
+
return {
|
|
11020
|
+
itemName: basename(componentDir),
|
|
11021
|
+
success,
|
|
11022
|
+
details
|
|
11023
|
+
};
|
|
11024
|
+
}
|
|
11172
11025
|
|
|
11173
11026
|
// src/utils/build.ts
|
|
11174
11027
|
async function buildComponent(componentDir) {
|
|
11175
|
-
const componentName =
|
|
11028
|
+
const componentName = path11.basename(componentDir);
|
|
11176
11029
|
const result = {
|
|
11177
11030
|
itemName: componentName,
|
|
11178
11031
|
success: true,
|
|
11179
11032
|
details: []
|
|
11180
11033
|
};
|
|
11181
|
-
const
|
|
11034
|
+
const validationResult = await validateComponent(componentDir);
|
|
11035
|
+
if (!validationResult.success) {
|
|
11036
|
+
result.success = false;
|
|
11037
|
+
result.details = validationResult.details;
|
|
11038
|
+
return result;
|
|
11039
|
+
}
|
|
11040
|
+
const distDir = path11.join(componentDir, "dist");
|
|
11182
11041
|
try {
|
|
11183
11042
|
await promises.mkdir(distDir, { recursive: true });
|
|
11184
11043
|
} catch (error) {
|
|
@@ -11191,11 +11050,11 @@ async function buildComponent(componentDir) {
|
|
|
11191
11050
|
}
|
|
11192
11051
|
try {
|
|
11193
11052
|
const jsSource = await promises.readFile(
|
|
11194
|
-
|
|
11053
|
+
path11.join(componentDir, "index.jsx"),
|
|
11195
11054
|
"utf-8"
|
|
11196
11055
|
);
|
|
11197
11056
|
const jsCompiled = compileJS(jsSource);
|
|
11198
|
-
await promises.writeFile(
|
|
11057
|
+
await promises.writeFile(path11.join(distDir, "index.js"), jsCompiled);
|
|
11199
11058
|
} catch (error) {
|
|
11200
11059
|
result.success = false;
|
|
11201
11060
|
result.details?.push({
|
|
@@ -11207,7 +11066,7 @@ async function buildComponent(componentDir) {
|
|
|
11207
11066
|
const globalAssetLibrary = await apiService.getGlobalAssetLibrary();
|
|
11208
11067
|
const globalSourceCodeCss = globalAssetLibrary.css.original;
|
|
11209
11068
|
try {
|
|
11210
|
-
const cssPath =
|
|
11069
|
+
const cssPath = path11.join(componentDir, "index.css");
|
|
11211
11070
|
const cssFileExists = await fileExists(cssPath);
|
|
11212
11071
|
if (cssFileExists) {
|
|
11213
11072
|
const cssSource = await promises.readFile(cssPath, "utf-8");
|
|
@@ -11216,7 +11075,7 @@ async function buildComponent(componentDir) {
|
|
|
11216
11075
|
globalSourceCodeCss
|
|
11217
11076
|
);
|
|
11218
11077
|
const cssTranspiled = await transformCss(cssCompiled);
|
|
11219
|
-
await promises.writeFile(
|
|
11078
|
+
await promises.writeFile(path11.join(distDir, "index.css"), cssTranspiled);
|
|
11220
11079
|
}
|
|
11221
11080
|
} catch (error) {
|
|
11222
11081
|
result.success = false;
|
|
@@ -11269,14 +11128,225 @@ ${d2.content}` : d2.content
|
|
|
11269
11128
|
colSpan: hasDetails ? 2 : 1,
|
|
11270
11129
|
alignment: hasDetails ? "right" : "left"
|
|
11271
11130
|
}
|
|
11272
|
-
]
|
|
11131
|
+
],
|
|
11132
|
+
columns: {
|
|
11133
|
+
// Limit the width of the details column for improved readability of long details.
|
|
11134
|
+
2: { width: 100, wrapWord: true }
|
|
11135
|
+
}
|
|
11273
11136
|
})
|
|
11274
11137
|
);
|
|
11275
11138
|
}
|
|
11276
11139
|
}
|
|
11277
11140
|
|
|
11278
|
-
// ../node_modules/
|
|
11279
|
-
var
|
|
11141
|
+
// ../node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
11142
|
+
var balanced = (a, b, str) => {
|
|
11143
|
+
const ma2 = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
11144
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
11145
|
+
const r = ma2 !== null && mb != null && range(ma2, mb, str);
|
|
11146
|
+
return r && {
|
|
11147
|
+
start: r[0],
|
|
11148
|
+
end: r[1],
|
|
11149
|
+
pre: str.slice(0, r[0]),
|
|
11150
|
+
body: str.slice(r[0] + ma2.length, r[1]),
|
|
11151
|
+
post: str.slice(r[1] + mb.length)
|
|
11152
|
+
};
|
|
11153
|
+
};
|
|
11154
|
+
var maybeMatch = (reg, str) => {
|
|
11155
|
+
const m = str.match(reg);
|
|
11156
|
+
return m ? m[0] : null;
|
|
11157
|
+
};
|
|
11158
|
+
var range = (a, b, str) => {
|
|
11159
|
+
let begs, beg, left, right = void 0, result;
|
|
11160
|
+
let ai2 = str.indexOf(a);
|
|
11161
|
+
let bi2 = str.indexOf(b, ai2 + 1);
|
|
11162
|
+
let i = ai2;
|
|
11163
|
+
if (ai2 >= 0 && bi2 > 0) {
|
|
11164
|
+
if (a === b) {
|
|
11165
|
+
return [ai2, bi2];
|
|
11166
|
+
}
|
|
11167
|
+
begs = [];
|
|
11168
|
+
left = str.length;
|
|
11169
|
+
while (i >= 0 && !result) {
|
|
11170
|
+
if (i === ai2) {
|
|
11171
|
+
begs.push(i);
|
|
11172
|
+
ai2 = str.indexOf(a, i + 1);
|
|
11173
|
+
} else if (begs.length === 1) {
|
|
11174
|
+
const r = begs.pop();
|
|
11175
|
+
if (r !== void 0)
|
|
11176
|
+
result = [r, bi2];
|
|
11177
|
+
} else {
|
|
11178
|
+
beg = begs.pop();
|
|
11179
|
+
if (beg !== void 0 && beg < left) {
|
|
11180
|
+
left = beg;
|
|
11181
|
+
right = bi2;
|
|
11182
|
+
}
|
|
11183
|
+
bi2 = str.indexOf(b, i + 1);
|
|
11184
|
+
}
|
|
11185
|
+
i = ai2 < bi2 && ai2 >= 0 ? ai2 : bi2;
|
|
11186
|
+
}
|
|
11187
|
+
if (begs.length && right !== void 0) {
|
|
11188
|
+
result = [left, right];
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
return result;
|
|
11192
|
+
};
|
|
11193
|
+
|
|
11194
|
+
// ../node_modules/@isaacs/brace-expansion/dist/esm/index.js
|
|
11195
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
11196
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
11197
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
11198
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
11199
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
11200
|
+
var escSlashPattern = new RegExp(escSlash, "g");
|
|
11201
|
+
var escOpenPattern = new RegExp(escOpen, "g");
|
|
11202
|
+
var escClosePattern = new RegExp(escClose, "g");
|
|
11203
|
+
var escCommaPattern = new RegExp(escComma, "g");
|
|
11204
|
+
var escPeriodPattern = new RegExp(escPeriod, "g");
|
|
11205
|
+
var slashPattern = /\\\\/g;
|
|
11206
|
+
var openPattern = /\\{/g;
|
|
11207
|
+
var closePattern = /\\}/g;
|
|
11208
|
+
var commaPattern = /\\,/g;
|
|
11209
|
+
var periodPattern = /\\./g;
|
|
11210
|
+
function numeric(str) {
|
|
11211
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
11212
|
+
}
|
|
11213
|
+
function escapeBraces(str) {
|
|
11214
|
+
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
11215
|
+
}
|
|
11216
|
+
function unescapeBraces(str) {
|
|
11217
|
+
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
11218
|
+
}
|
|
11219
|
+
function parseCommaParts(str) {
|
|
11220
|
+
if (!str) {
|
|
11221
|
+
return [""];
|
|
11222
|
+
}
|
|
11223
|
+
const parts = [];
|
|
11224
|
+
const m = balanced("{", "}", str);
|
|
11225
|
+
if (!m) {
|
|
11226
|
+
return str.split(",");
|
|
11227
|
+
}
|
|
11228
|
+
const { pre, body, post } = m;
|
|
11229
|
+
const p13 = pre.split(",");
|
|
11230
|
+
p13[p13.length - 1] += "{" + body + "}";
|
|
11231
|
+
const postParts = parseCommaParts(post);
|
|
11232
|
+
if (post.length) {
|
|
11233
|
+
p13[p13.length - 1] += postParts.shift();
|
|
11234
|
+
p13.push.apply(p13, postParts);
|
|
11235
|
+
}
|
|
11236
|
+
parts.push.apply(parts, p13);
|
|
11237
|
+
return parts;
|
|
11238
|
+
}
|
|
11239
|
+
function expand(str) {
|
|
11240
|
+
if (!str) {
|
|
11241
|
+
return [];
|
|
11242
|
+
}
|
|
11243
|
+
if (str.slice(0, 2) === "{}") {
|
|
11244
|
+
str = "\\{\\}" + str.slice(2);
|
|
11245
|
+
}
|
|
11246
|
+
return expand_(escapeBraces(str), true).map(unescapeBraces);
|
|
11247
|
+
}
|
|
11248
|
+
function embrace(str) {
|
|
11249
|
+
return "{" + str + "}";
|
|
11250
|
+
}
|
|
11251
|
+
function isPadded(el2) {
|
|
11252
|
+
return /^-?0\d/.test(el2);
|
|
11253
|
+
}
|
|
11254
|
+
function lte(i, y) {
|
|
11255
|
+
return i <= y;
|
|
11256
|
+
}
|
|
11257
|
+
function gte(i, y) {
|
|
11258
|
+
return i >= y;
|
|
11259
|
+
}
|
|
11260
|
+
function expand_(str, isTop) {
|
|
11261
|
+
const expansions = [];
|
|
11262
|
+
const m = balanced("{", "}", str);
|
|
11263
|
+
if (!m)
|
|
11264
|
+
return [str];
|
|
11265
|
+
const pre = m.pre;
|
|
11266
|
+
const post = m.post.length ? expand_(m.post, false) : [""];
|
|
11267
|
+
if (/\$$/.test(m.pre)) {
|
|
11268
|
+
for (let k = 0; k < post.length; k++) {
|
|
11269
|
+
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
11270
|
+
expansions.push(expansion);
|
|
11271
|
+
}
|
|
11272
|
+
} else {
|
|
11273
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
11274
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
11275
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
11276
|
+
const isOptions = m.body.indexOf(",") >= 0;
|
|
11277
|
+
if (!isSequence && !isOptions) {
|
|
11278
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
11279
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
11280
|
+
return expand_(str);
|
|
11281
|
+
}
|
|
11282
|
+
return [str];
|
|
11283
|
+
}
|
|
11284
|
+
let n;
|
|
11285
|
+
if (isSequence) {
|
|
11286
|
+
n = m.body.split(/\.\./);
|
|
11287
|
+
} else {
|
|
11288
|
+
n = parseCommaParts(m.body);
|
|
11289
|
+
if (n.length === 1 && n[0] !== void 0) {
|
|
11290
|
+
n = expand_(n[0], false).map(embrace);
|
|
11291
|
+
if (n.length === 1) {
|
|
11292
|
+
return post.map((p13) => m.pre + n[0] + p13);
|
|
11293
|
+
}
|
|
11294
|
+
}
|
|
11295
|
+
}
|
|
11296
|
+
let N;
|
|
11297
|
+
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
11298
|
+
const x = numeric(n[0]);
|
|
11299
|
+
const y = numeric(n[1]);
|
|
11300
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
11301
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
11302
|
+
let test = lte;
|
|
11303
|
+
const reverse = y < x;
|
|
11304
|
+
if (reverse) {
|
|
11305
|
+
incr *= -1;
|
|
11306
|
+
test = gte;
|
|
11307
|
+
}
|
|
11308
|
+
const pad = n.some(isPadded);
|
|
11309
|
+
N = [];
|
|
11310
|
+
for (let i = x; test(i, y); i += incr) {
|
|
11311
|
+
let c;
|
|
11312
|
+
if (isAlphaSequence) {
|
|
11313
|
+
c = String.fromCharCode(i);
|
|
11314
|
+
if (c === "\\") {
|
|
11315
|
+
c = "";
|
|
11316
|
+
}
|
|
11317
|
+
} else {
|
|
11318
|
+
c = String(i);
|
|
11319
|
+
if (pad) {
|
|
11320
|
+
const need = width - c.length;
|
|
11321
|
+
if (need > 0) {
|
|
11322
|
+
const z = new Array(need + 1).join("0");
|
|
11323
|
+
if (i < 0) {
|
|
11324
|
+
c = "-" + z + c.slice(1);
|
|
11325
|
+
} else {
|
|
11326
|
+
c = z + c;
|
|
11327
|
+
}
|
|
11328
|
+
}
|
|
11329
|
+
}
|
|
11330
|
+
}
|
|
11331
|
+
N.push(c);
|
|
11332
|
+
}
|
|
11333
|
+
} else {
|
|
11334
|
+
N = [];
|
|
11335
|
+
for (let j = 0; j < n.length; j++) {
|
|
11336
|
+
N.push.apply(N, expand_(n[j], false));
|
|
11337
|
+
}
|
|
11338
|
+
}
|
|
11339
|
+
for (let j = 0; j < N.length; j++) {
|
|
11340
|
+
for (let k = 0; k < post.length; k++) {
|
|
11341
|
+
const expansion = pre + N[j] + post[k];
|
|
11342
|
+
if (!isTop || isSequence || expansion) {
|
|
11343
|
+
expansions.push(expansion);
|
|
11344
|
+
}
|
|
11345
|
+
}
|
|
11346
|
+
}
|
|
11347
|
+
}
|
|
11348
|
+
return expansions;
|
|
11349
|
+
}
|
|
11280
11350
|
|
|
11281
11351
|
// ../node_modules/glob/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
11282
11352
|
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
@@ -11399,8 +11469,11 @@ var parseClass = (glob2, position) => {
|
|
|
11399
11469
|
};
|
|
11400
11470
|
|
|
11401
11471
|
// ../node_modules/glob/node_modules/minimatch/dist/esm/unescape.js
|
|
11402
|
-
var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
11403
|
-
|
|
11472
|
+
var unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
11473
|
+
if (magicalBraces) {
|
|
11474
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
|
|
11475
|
+
}
|
|
11476
|
+
return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
11404
11477
|
};
|
|
11405
11478
|
|
|
11406
11479
|
// ../node_modules/glob/node_modules/minimatch/dist/esm/ast.js
|
|
@@ -11445,10 +11518,10 @@ var AST = class _AST {
|
|
|
11445
11518
|
get hasMagic() {
|
|
11446
11519
|
if (this.#hasMagic !== void 0)
|
|
11447
11520
|
return this.#hasMagic;
|
|
11448
|
-
for (const
|
|
11449
|
-
if (typeof
|
|
11521
|
+
for (const p13 of this.#parts) {
|
|
11522
|
+
if (typeof p13 === "string")
|
|
11450
11523
|
continue;
|
|
11451
|
-
if (
|
|
11524
|
+
if (p13.type || p13.hasMagic)
|
|
11452
11525
|
return this.#hasMagic = true;
|
|
11453
11526
|
}
|
|
11454
11527
|
return this.#hasMagic;
|
|
@@ -11458,9 +11531,9 @@ var AST = class _AST {
|
|
|
11458
11531
|
if (this.#toString !== void 0)
|
|
11459
11532
|
return this.#toString;
|
|
11460
11533
|
if (!this.type) {
|
|
11461
|
-
return this.#toString = this.#parts.map((
|
|
11534
|
+
return this.#toString = this.#parts.map((p13) => String(p13)).join("");
|
|
11462
11535
|
} else {
|
|
11463
|
-
return this.#toString = this.type + "(" + this.#parts.map((
|
|
11536
|
+
return this.#toString = this.type + "(" + this.#parts.map((p13) => String(p13)).join("|") + ")";
|
|
11464
11537
|
}
|
|
11465
11538
|
}
|
|
11466
11539
|
#fillNegs() {
|
|
@@ -11474,10 +11547,10 @@ var AST = class _AST {
|
|
|
11474
11547
|
while (n = this.#negs.pop()) {
|
|
11475
11548
|
if (n.type !== "!")
|
|
11476
11549
|
continue;
|
|
11477
|
-
let
|
|
11478
|
-
let pp =
|
|
11550
|
+
let p13 = n;
|
|
11551
|
+
let pp = p13.#parent;
|
|
11479
11552
|
while (pp) {
|
|
11480
|
-
for (let i =
|
|
11553
|
+
for (let i = p13.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) {
|
|
11481
11554
|
for (const part of n.#parts) {
|
|
11482
11555
|
if (typeof part === "string") {
|
|
11483
11556
|
throw new Error("string part in extglob AST??");
|
|
@@ -11485,24 +11558,24 @@ var AST = class _AST {
|
|
|
11485
11558
|
part.copyIn(pp.#parts[i]);
|
|
11486
11559
|
}
|
|
11487
11560
|
}
|
|
11488
|
-
|
|
11489
|
-
pp =
|
|
11561
|
+
p13 = pp;
|
|
11562
|
+
pp = p13.#parent;
|
|
11490
11563
|
}
|
|
11491
11564
|
}
|
|
11492
11565
|
return this;
|
|
11493
11566
|
}
|
|
11494
11567
|
push(...parts) {
|
|
11495
|
-
for (const
|
|
11496
|
-
if (
|
|
11568
|
+
for (const p13 of parts) {
|
|
11569
|
+
if (p13 === "")
|
|
11497
11570
|
continue;
|
|
11498
|
-
if (typeof
|
|
11499
|
-
throw new Error("invalid part: " +
|
|
11571
|
+
if (typeof p13 !== "string" && !(p13 instanceof _AST && p13.#parent === this)) {
|
|
11572
|
+
throw new Error("invalid part: " + p13);
|
|
11500
11573
|
}
|
|
11501
|
-
this.#parts.push(
|
|
11574
|
+
this.#parts.push(p13);
|
|
11502
11575
|
}
|
|
11503
11576
|
}
|
|
11504
11577
|
toJSON() {
|
|
11505
|
-
const ret = this.type === null ? this.#parts.slice().map((
|
|
11578
|
+
const ret = this.type === null ? this.#parts.slice().map((p13) => typeof p13 === "string" ? p13 : p13.toJSON()) : [this.type, ...this.#parts.map((p13) => p13.toJSON())];
|
|
11506
11579
|
if (this.isStart() && !this.type)
|
|
11507
11580
|
ret.unshift([]);
|
|
11508
11581
|
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
|
|
@@ -11517,9 +11590,9 @@ var AST = class _AST {
|
|
|
11517
11590
|
return false;
|
|
11518
11591
|
if (this.#parentIndex === 0)
|
|
11519
11592
|
return true;
|
|
11520
|
-
const
|
|
11593
|
+
const p13 = this.#parent;
|
|
11521
11594
|
for (let i = 0; i < this.#parentIndex; i++) {
|
|
11522
|
-
const pp =
|
|
11595
|
+
const pp = p13.#parts[i];
|
|
11523
11596
|
if (!(pp instanceof _AST && pp.type === "!")) {
|
|
11524
11597
|
return false;
|
|
11525
11598
|
}
|
|
@@ -11546,8 +11619,8 @@ var AST = class _AST {
|
|
|
11546
11619
|
}
|
|
11547
11620
|
clone(parent) {
|
|
11548
11621
|
const c = new _AST(this.type, parent);
|
|
11549
|
-
for (const
|
|
11550
|
-
c.copyIn(
|
|
11622
|
+
for (const p13 of this.#parts) {
|
|
11623
|
+
c.copyIn(p13);
|
|
11551
11624
|
}
|
|
11552
11625
|
return c;
|
|
11553
11626
|
}
|
|
@@ -11754,9 +11827,9 @@ var AST = class _AST {
|
|
|
11754
11827
|
if (this.#root === this)
|
|
11755
11828
|
this.#fillNegs();
|
|
11756
11829
|
if (!this.type) {
|
|
11757
|
-
const noEmpty = this.isStart() && this.isEnd();
|
|
11758
|
-
const src = this.#parts.map((
|
|
11759
|
-
const [re, _2, hasMagic2, uflag] = typeof
|
|
11830
|
+
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
11831
|
+
const src = this.#parts.map((p13) => {
|
|
11832
|
+
const [re, _2, hasMagic2, uflag] = typeof p13 === "string" ? _AST.#parseGlob(p13, this.#hasMagic, noEmpty) : p13.toRegExpSource(allowDot);
|
|
11760
11833
|
this.#hasMagic = this.#hasMagic || hasMagic2;
|
|
11761
11834
|
this.#uflag = this.#uflag || uflag;
|
|
11762
11835
|
return re;
|
|
@@ -11825,14 +11898,14 @@ var AST = class _AST {
|
|
|
11825
11898
|
];
|
|
11826
11899
|
}
|
|
11827
11900
|
#partsToRegExp(dot) {
|
|
11828
|
-
return this.#parts.map((
|
|
11829
|
-
if (typeof
|
|
11901
|
+
return this.#parts.map((p13) => {
|
|
11902
|
+
if (typeof p13 === "string") {
|
|
11830
11903
|
throw new Error("string type in extglob ast??");
|
|
11831
11904
|
}
|
|
11832
|
-
const [re, _2, _hasMagic, uflag] =
|
|
11905
|
+
const [re, _2, _hasMagic, uflag] = p13.toRegExpSource(dot);
|
|
11833
11906
|
this.#uflag = this.#uflag || uflag;
|
|
11834
11907
|
return re;
|
|
11835
|
-
}).filter((
|
|
11908
|
+
}).filter((p13) => !(this.isStart() && this.isEnd()) || !!p13).join("|");
|
|
11836
11909
|
}
|
|
11837
11910
|
static #parseGlob(glob2, hasMagic2, noEmpty = false) {
|
|
11838
11911
|
let escaping = false;
|
|
@@ -11864,10 +11937,7 @@ var AST = class _AST {
|
|
|
11864
11937
|
}
|
|
11865
11938
|
}
|
|
11866
11939
|
if (c === "*") {
|
|
11867
|
-
|
|
11868
|
-
re += starNoEmpty;
|
|
11869
|
-
else
|
|
11870
|
-
re += star;
|
|
11940
|
+
re += noEmpty && glob2 === "*" ? starNoEmpty : star;
|
|
11871
11941
|
hasMagic2 = true;
|
|
11872
11942
|
continue;
|
|
11873
11943
|
}
|
|
@@ -11883,17 +11953,20 @@ var AST = class _AST {
|
|
|
11883
11953
|
};
|
|
11884
11954
|
|
|
11885
11955
|
// ../node_modules/glob/node_modules/minimatch/dist/esm/escape.js
|
|
11886
|
-
var escape = (s, { windowsPathsNoEscape = false } = {}) => {
|
|
11956
|
+
var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
11957
|
+
if (magicalBraces) {
|
|
11958
|
+
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
11959
|
+
}
|
|
11887
11960
|
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
11888
11961
|
};
|
|
11889
11962
|
|
|
11890
11963
|
// ../node_modules/glob/node_modules/minimatch/dist/esm/index.js
|
|
11891
|
-
var minimatch = (
|
|
11964
|
+
var minimatch = (p13, pattern, options = {}) => {
|
|
11892
11965
|
assertValidPattern(pattern);
|
|
11893
11966
|
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
11894
11967
|
return false;
|
|
11895
11968
|
}
|
|
11896
|
-
return new Minimatch(pattern, options).match(
|
|
11969
|
+
return new Minimatch(pattern, options).match(p13);
|
|
11897
11970
|
};
|
|
11898
11971
|
var starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
|
|
11899
11972
|
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
@@ -11946,11 +12019,11 @@ var qmarksTestNoExtDot = ([$02]) => {
|
|
|
11946
12019
|
return (f) => f.length === len && f !== "." && f !== "..";
|
|
11947
12020
|
};
|
|
11948
12021
|
var defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
11949
|
-
var
|
|
12022
|
+
var path6 = {
|
|
11950
12023
|
win32: { sep: "\\" },
|
|
11951
12024
|
posix: { sep: "/" }
|
|
11952
12025
|
};
|
|
11953
|
-
var sep = defaultPlatform === "win32" ?
|
|
12026
|
+
var sep = defaultPlatform === "win32" ? path6.win32.sep : path6.posix.sep;
|
|
11954
12027
|
minimatch.sep = sep;
|
|
11955
12028
|
var GLOBSTAR = Symbol("globstar **");
|
|
11956
12029
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
@@ -11958,7 +12031,7 @@ var qmark2 = "[^/]";
|
|
|
11958
12031
|
var star2 = qmark2 + "*?";
|
|
11959
12032
|
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
11960
12033
|
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
11961
|
-
var filter = (pattern, options = {}) => (
|
|
12034
|
+
var filter = (pattern, options = {}) => (p13) => minimatch(p13, pattern, options);
|
|
11962
12035
|
minimatch.filter = filter;
|
|
11963
12036
|
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
11964
12037
|
var defaults = (def) => {
|
|
@@ -11966,7 +12039,7 @@ var defaults = (def) => {
|
|
|
11966
12039
|
return minimatch;
|
|
11967
12040
|
}
|
|
11968
12041
|
const orig = minimatch;
|
|
11969
|
-
const m = (
|
|
12042
|
+
const m = (p13, pattern, options = {}) => orig(p13, pattern, ext(def, options));
|
|
11970
12043
|
return Object.assign(m, {
|
|
11971
12044
|
Minimatch: class Minimatch extends orig.Minimatch {
|
|
11972
12045
|
constructor(pattern, options = {}) {
|
|
@@ -12003,7 +12076,7 @@ var braceExpand = (pattern, options = {}) => {
|
|
|
12003
12076
|
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
12004
12077
|
return [pattern];
|
|
12005
12078
|
}
|
|
12006
|
-
return (
|
|
12079
|
+
return expand(pattern);
|
|
12007
12080
|
};
|
|
12008
12081
|
minimatch.braceExpand = braceExpand;
|
|
12009
12082
|
var makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
@@ -12112,9 +12185,9 @@ var Minimatch = class {
|
|
|
12112
12185
|
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
12113
12186
|
if (this.isWindows) {
|
|
12114
12187
|
for (let i = 0; i < this.set.length; i++) {
|
|
12115
|
-
const
|
|
12116
|
-
if (
|
|
12117
|
-
|
|
12188
|
+
const p13 = this.set[i];
|
|
12189
|
+
if (p13[0] === "" && p13[1] === "" && this.globParts[i][2] === "?" && typeof p13[3] === "string" && /^[a-z]:$/i.test(p13[3])) {
|
|
12190
|
+
p13[2] = "?";
|
|
12118
12191
|
}
|
|
12119
12192
|
}
|
|
12120
12193
|
}
|
|
@@ -12191,10 +12264,10 @@ var Minimatch = class {
|
|
|
12191
12264
|
didSomething = false;
|
|
12192
12265
|
if (!this.preserveMultipleSlashes) {
|
|
12193
12266
|
for (let i = 1; i < parts.length - 1; i++) {
|
|
12194
|
-
const
|
|
12195
|
-
if (i === 1 &&
|
|
12267
|
+
const p13 = parts[i];
|
|
12268
|
+
if (i === 1 && p13 === "" && parts[0] === "")
|
|
12196
12269
|
continue;
|
|
12197
|
-
if (
|
|
12270
|
+
if (p13 === "." || p13 === "") {
|
|
12198
12271
|
didSomething = true;
|
|
12199
12272
|
parts.splice(i, 1);
|
|
12200
12273
|
i--;
|
|
@@ -12207,8 +12280,8 @@ var Minimatch = class {
|
|
|
12207
12280
|
}
|
|
12208
12281
|
let dd = 0;
|
|
12209
12282
|
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
12210
|
-
const
|
|
12211
|
-
if (
|
|
12283
|
+
const p13 = parts[dd - 1];
|
|
12284
|
+
if (p13 && p13 !== "." && p13 !== ".." && p13 !== "**") {
|
|
12212
12285
|
didSomething = true;
|
|
12213
12286
|
parts.splice(dd - 1, 2);
|
|
12214
12287
|
dd -= 2;
|
|
@@ -12250,11 +12323,11 @@ var Minimatch = class {
|
|
|
12250
12323
|
parts.splice(gs + 1, gss - gs);
|
|
12251
12324
|
}
|
|
12252
12325
|
let next = parts[gs + 1];
|
|
12253
|
-
const
|
|
12326
|
+
const p13 = parts[gs + 2];
|
|
12254
12327
|
const p22 = parts[gs + 3];
|
|
12255
12328
|
if (next !== "..")
|
|
12256
12329
|
continue;
|
|
12257
|
-
if (!
|
|
12330
|
+
if (!p13 || p13 === "." || p13 === ".." || !p22 || p22 === "." || p22 === "..") {
|
|
12258
12331
|
continue;
|
|
12259
12332
|
}
|
|
12260
12333
|
didSomething = true;
|
|
@@ -12266,10 +12339,10 @@ var Minimatch = class {
|
|
|
12266
12339
|
}
|
|
12267
12340
|
if (!this.preserveMultipleSlashes) {
|
|
12268
12341
|
for (let i = 1; i < parts.length - 1; i++) {
|
|
12269
|
-
const
|
|
12270
|
-
if (i === 1 &&
|
|
12342
|
+
const p13 = parts[i];
|
|
12343
|
+
if (i === 1 && p13 === "" && parts[0] === "")
|
|
12271
12344
|
continue;
|
|
12272
|
-
if (
|
|
12345
|
+
if (p13 === "." || p13 === "") {
|
|
12273
12346
|
didSomething = true;
|
|
12274
12347
|
parts.splice(i, 1);
|
|
12275
12348
|
i--;
|
|
@@ -12282,8 +12355,8 @@ var Minimatch = class {
|
|
|
12282
12355
|
}
|
|
12283
12356
|
let dd = 0;
|
|
12284
12357
|
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
12285
|
-
const
|
|
12286
|
-
if (
|
|
12358
|
+
const p13 = parts[dd - 1];
|
|
12359
|
+
if (p13 && p13 !== "." && p13 !== ".." && p13 !== "**") {
|
|
12287
12360
|
didSomething = true;
|
|
12288
12361
|
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
12289
12362
|
const splin = needDot ? ["."] : [];
|
|
@@ -12401,14 +12474,14 @@ var Minimatch = class {
|
|
|
12401
12474
|
this.debug("matchOne", file.length, pattern.length);
|
|
12402
12475
|
for (var fi2 = 0, pi2 = 0, fl2 = file.length, pl2 = pattern.length; fi2 < fl2 && pi2 < pl2; fi2++, pi2++) {
|
|
12403
12476
|
this.debug("matchOne loop");
|
|
12404
|
-
var
|
|
12477
|
+
var p13 = pattern[pi2];
|
|
12405
12478
|
var f = file[fi2];
|
|
12406
|
-
this.debug(pattern,
|
|
12407
|
-
if (
|
|
12479
|
+
this.debug(pattern, p13, f);
|
|
12480
|
+
if (p13 === false) {
|
|
12408
12481
|
return false;
|
|
12409
12482
|
}
|
|
12410
|
-
if (
|
|
12411
|
-
this.debug("GLOBSTAR", [pattern,
|
|
12483
|
+
if (p13 === GLOBSTAR) {
|
|
12484
|
+
this.debug("GLOBSTAR", [pattern, p13, f]);
|
|
12412
12485
|
var fr2 = fi2;
|
|
12413
12486
|
var pr2 = pi2 + 1;
|
|
12414
12487
|
if (pr2 === pl2) {
|
|
@@ -12443,12 +12516,12 @@ var Minimatch = class {
|
|
|
12443
12516
|
return false;
|
|
12444
12517
|
}
|
|
12445
12518
|
let hit;
|
|
12446
|
-
if (typeof
|
|
12447
|
-
hit = f ===
|
|
12448
|
-
this.debug("string match",
|
|
12519
|
+
if (typeof p13 === "string") {
|
|
12520
|
+
hit = f === p13;
|
|
12521
|
+
this.debug("string match", p13, f, hit);
|
|
12449
12522
|
} else {
|
|
12450
|
-
hit =
|
|
12451
|
-
this.debug("pattern match",
|
|
12523
|
+
hit = p13.test(f);
|
|
12524
|
+
this.debug("pattern match", p13, f, hit);
|
|
12452
12525
|
}
|
|
12453
12526
|
if (!hit)
|
|
12454
12527
|
return false;
|
|
@@ -12504,17 +12577,17 @@ var Minimatch = class {
|
|
|
12504
12577
|
const twoStar = options.noglobstar ? star2 : options.dot ? twoStarDot : twoStarNoDot;
|
|
12505
12578
|
const flags = new Set(options.nocase ? ["i"] : []);
|
|
12506
12579
|
let re = set.map((pattern) => {
|
|
12507
|
-
const pp = pattern.map((
|
|
12508
|
-
if (
|
|
12509
|
-
for (const f of
|
|
12580
|
+
const pp = pattern.map((p13) => {
|
|
12581
|
+
if (p13 instanceof RegExp) {
|
|
12582
|
+
for (const f of p13.flags.split(""))
|
|
12510
12583
|
flags.add(f);
|
|
12511
12584
|
}
|
|
12512
|
-
return typeof
|
|
12585
|
+
return typeof p13 === "string" ? regExpEscape2(p13) : p13 === GLOBSTAR ? GLOBSTAR : p13._src;
|
|
12513
12586
|
});
|
|
12514
|
-
pp.forEach((
|
|
12587
|
+
pp.forEach((p13, i) => {
|
|
12515
12588
|
const next = pp[i + 1];
|
|
12516
12589
|
const prev = pp[i - 1];
|
|
12517
|
-
if (
|
|
12590
|
+
if (p13 !== GLOBSTAR || prev === GLOBSTAR) {
|
|
12518
12591
|
return;
|
|
12519
12592
|
}
|
|
12520
12593
|
if (prev === void 0) {
|
|
@@ -12524,16 +12597,27 @@ var Minimatch = class {
|
|
|
12524
12597
|
pp[i] = twoStar;
|
|
12525
12598
|
}
|
|
12526
12599
|
} else if (next === void 0) {
|
|
12527
|
-
pp[i - 1] = prev + "(
|
|
12600
|
+
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
12528
12601
|
} else if (next !== GLOBSTAR) {
|
|
12529
12602
|
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
12530
12603
|
pp[i + 1] = GLOBSTAR;
|
|
12531
12604
|
}
|
|
12532
12605
|
});
|
|
12533
|
-
|
|
12606
|
+
const filtered = pp.filter((p13) => p13 !== GLOBSTAR);
|
|
12607
|
+
if (this.partial && filtered.length >= 1) {
|
|
12608
|
+
const prefixes = [];
|
|
12609
|
+
for (let i = 1; i <= filtered.length; i++) {
|
|
12610
|
+
prefixes.push(filtered.slice(0, i).join("/"));
|
|
12611
|
+
}
|
|
12612
|
+
return "(?:" + prefixes.join("|") + ")";
|
|
12613
|
+
}
|
|
12614
|
+
return filtered.join("/");
|
|
12534
12615
|
}).join("|");
|
|
12535
12616
|
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
12536
12617
|
re = "^" + open + re + close + "$";
|
|
12618
|
+
if (this.partial) {
|
|
12619
|
+
re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
12620
|
+
}
|
|
12537
12621
|
if (this.negate)
|
|
12538
12622
|
re = "^(?!" + re + ").+$";
|
|
12539
12623
|
try {
|
|
@@ -12543,13 +12627,13 @@ var Minimatch = class {
|
|
|
12543
12627
|
}
|
|
12544
12628
|
return this.regexp;
|
|
12545
12629
|
}
|
|
12546
|
-
slashSplit(
|
|
12630
|
+
slashSplit(p13) {
|
|
12547
12631
|
if (this.preserveMultipleSlashes) {
|
|
12548
|
-
return
|
|
12549
|
-
} else if (this.isWindows && /^\/\/[^\/]+/.test(
|
|
12550
|
-
return ["", ...
|
|
12632
|
+
return p13.split("/");
|
|
12633
|
+
} else if (this.isWindows && /^\/\/[^\/]+/.test(p13)) {
|
|
12634
|
+
return ["", ...p13.split(/\/+/)];
|
|
12551
12635
|
} else {
|
|
12552
|
-
return
|
|
12636
|
+
return p13.split(/\/+/);
|
|
12553
12637
|
}
|
|
12554
12638
|
}
|
|
12555
12639
|
match(f, partial = this.partial) {
|
|
@@ -12605,8 +12689,8 @@ minimatch.Minimatch = Minimatch;
|
|
|
12605
12689
|
minimatch.escape = escape;
|
|
12606
12690
|
minimatch.unescape = unescape;
|
|
12607
12691
|
|
|
12608
|
-
// ../node_modules/lru-cache/dist/esm/index.js
|
|
12609
|
-
var
|
|
12692
|
+
// ../node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js
|
|
12693
|
+
var defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
12610
12694
|
var warned = /* @__PURE__ */ new Set();
|
|
12611
12695
|
var PROCESS = typeof process === "object" && !!process ? process : {};
|
|
12612
12696
|
var emitWarning = (msg, type, code, fn2) => {
|
|
@@ -12690,9 +12774,17 @@ var LRUCache = class _LRUCache {
|
|
|
12690
12774
|
#max;
|
|
12691
12775
|
#maxSize;
|
|
12692
12776
|
#dispose;
|
|
12777
|
+
#onInsert;
|
|
12693
12778
|
#disposeAfter;
|
|
12694
12779
|
#fetchMethod;
|
|
12695
12780
|
#memoMethod;
|
|
12781
|
+
#perf;
|
|
12782
|
+
/**
|
|
12783
|
+
* {@link LRUCache.OptionsBase.perf}
|
|
12784
|
+
*/
|
|
12785
|
+
get perf() {
|
|
12786
|
+
return this.#perf;
|
|
12787
|
+
}
|
|
12696
12788
|
/**
|
|
12697
12789
|
* {@link LRUCache.OptionsBase.ttl}
|
|
12698
12790
|
*/
|
|
@@ -12771,6 +12863,7 @@ var LRUCache = class _LRUCache {
|
|
|
12771
12863
|
#hasDispose;
|
|
12772
12864
|
#hasFetchMethod;
|
|
12773
12865
|
#hasDisposeAfter;
|
|
12866
|
+
#hasOnInsert;
|
|
12774
12867
|
/**
|
|
12775
12868
|
* Do not call this method unless you need to inspect the
|
|
12776
12869
|
* inner workings of the cache. If anything returned by this
|
|
@@ -12799,7 +12892,7 @@ var LRUCache = class _LRUCache {
|
|
|
12799
12892
|
},
|
|
12800
12893
|
free: c.#free,
|
|
12801
12894
|
// methods
|
|
12802
|
-
isBackgroundFetch: (
|
|
12895
|
+
isBackgroundFetch: (p13) => c.#isBackgroundFetch(p13),
|
|
12803
12896
|
backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
|
|
12804
12897
|
moveToTail: (index) => c.#moveToTail(index),
|
|
12805
12898
|
indexes: (options) => c.#indexes(options),
|
|
@@ -12847,6 +12940,12 @@ var LRUCache = class _LRUCache {
|
|
|
12847
12940
|
get dispose() {
|
|
12848
12941
|
return this.#dispose;
|
|
12849
12942
|
}
|
|
12943
|
+
/**
|
|
12944
|
+
* {@link LRUCache.OptionsBase.onInsert} (read-only)
|
|
12945
|
+
*/
|
|
12946
|
+
get onInsert() {
|
|
12947
|
+
return this.#onInsert;
|
|
12948
|
+
}
|
|
12850
12949
|
/**
|
|
12851
12950
|
* {@link LRUCache.OptionsBase.disposeAfter} (read-only)
|
|
12852
12951
|
*/
|
|
@@ -12854,7 +12953,13 @@ var LRUCache = class _LRUCache {
|
|
|
12854
12953
|
return this.#disposeAfter;
|
|
12855
12954
|
}
|
|
12856
12955
|
constructor(options) {
|
|
12857
|
-
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
12956
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
|
|
12957
|
+
if (perf !== void 0) {
|
|
12958
|
+
if (typeof perf?.now !== "function") {
|
|
12959
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
this.#perf = perf ?? defaultPerf;
|
|
12858
12963
|
if (max !== 0 && !isPosInt(max)) {
|
|
12859
12964
|
throw new TypeError("max option must be a nonnegative integer");
|
|
12860
12965
|
}
|
|
@@ -12896,6 +13001,9 @@ var LRUCache = class _LRUCache {
|
|
|
12896
13001
|
if (typeof dispose === "function") {
|
|
12897
13002
|
this.#dispose = dispose;
|
|
12898
13003
|
}
|
|
13004
|
+
if (typeof onInsert === "function") {
|
|
13005
|
+
this.#onInsert = onInsert;
|
|
13006
|
+
}
|
|
12899
13007
|
if (typeof disposeAfter === "function") {
|
|
12900
13008
|
this.#disposeAfter = disposeAfter;
|
|
12901
13009
|
this.#disposed = [];
|
|
@@ -12904,6 +13012,7 @@ var LRUCache = class _LRUCache {
|
|
|
12904
13012
|
this.#disposed = void 0;
|
|
12905
13013
|
}
|
|
12906
13014
|
this.#hasDispose = !!this.#dispose;
|
|
13015
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
12907
13016
|
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
12908
13017
|
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
12909
13018
|
this.noUpdateTTL = !!noUpdateTTL;
|
|
@@ -12959,7 +13068,7 @@ var LRUCache = class _LRUCache {
|
|
|
12959
13068
|
const starts = new ZeroArray(this.#max);
|
|
12960
13069
|
this.#ttls = ttls;
|
|
12961
13070
|
this.#starts = starts;
|
|
12962
|
-
this.#setItemTTL = (index, ttl, start = perf.now()) => {
|
|
13071
|
+
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
12963
13072
|
starts[index] = ttl !== 0 ? start : 0;
|
|
12964
13073
|
ttls[index] = ttl;
|
|
12965
13074
|
if (ttl !== 0 && this.ttlAutopurge) {
|
|
@@ -12974,7 +13083,7 @@ var LRUCache = class _LRUCache {
|
|
|
12974
13083
|
}
|
|
12975
13084
|
};
|
|
12976
13085
|
this.#updateItemAge = (index) => {
|
|
12977
|
-
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
13086
|
+
starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
|
|
12978
13087
|
};
|
|
12979
13088
|
this.#statusTTL = (status, index) => {
|
|
12980
13089
|
if (ttls[index]) {
|
|
@@ -12991,7 +13100,7 @@ var LRUCache = class _LRUCache {
|
|
|
12991
13100
|
};
|
|
12992
13101
|
let cachedNow = 0;
|
|
12993
13102
|
const getNow = () => {
|
|
12994
|
-
const n = perf.now();
|
|
13103
|
+
const n = this.#perf.now();
|
|
12995
13104
|
if (this.ttlResolution > 0) {
|
|
12996
13105
|
cachedNow = n;
|
|
12997
13106
|
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
@@ -13294,7 +13403,7 @@ var LRUCache = class _LRUCache {
|
|
|
13294
13403
|
const ttl = this.#ttls[i];
|
|
13295
13404
|
const start = this.#starts[i];
|
|
13296
13405
|
if (ttl && start) {
|
|
13297
|
-
const remain = ttl - (perf.now() - start);
|
|
13406
|
+
const remain = ttl - (this.#perf.now() - start);
|
|
13298
13407
|
entry.ttl = remain;
|
|
13299
13408
|
entry.start = Date.now();
|
|
13300
13409
|
}
|
|
@@ -13306,7 +13415,7 @@ var LRUCache = class _LRUCache {
|
|
|
13306
13415
|
}
|
|
13307
13416
|
/**
|
|
13308
13417
|
* Return an array of [key, {@link LRUCache.Entry}] tuples which can be
|
|
13309
|
-
* passed to {@link
|
|
13418
|
+
* passed to {@link LRUCache#load}.
|
|
13310
13419
|
*
|
|
13311
13420
|
* The `start` fields are calculated relative to a portable `Date.now()`
|
|
13312
13421
|
* timestamp, even if `performance.now()` is available.
|
|
@@ -13328,7 +13437,7 @@ var LRUCache = class _LRUCache {
|
|
|
13328
13437
|
const entry = { value };
|
|
13329
13438
|
if (this.#ttls && this.#starts) {
|
|
13330
13439
|
entry.ttl = this.#ttls[i];
|
|
13331
|
-
const age = perf.now() - this.#starts[i];
|
|
13440
|
+
const age = this.#perf.now() - this.#starts[i];
|
|
13332
13441
|
entry.start = Math.floor(Date.now() - age);
|
|
13333
13442
|
}
|
|
13334
13443
|
if (this.#sizes) {
|
|
@@ -13352,7 +13461,7 @@ var LRUCache = class _LRUCache {
|
|
|
13352
13461
|
for (const [key, entry] of arr) {
|
|
13353
13462
|
if (entry.start) {
|
|
13354
13463
|
const age = Date.now() - entry.start;
|
|
13355
|
-
entry.start = perf.now() - age;
|
|
13464
|
+
entry.start = this.#perf.now() - age;
|
|
13356
13465
|
}
|
|
13357
13466
|
this.set(key, entry.value, entry);
|
|
13358
13467
|
}
|
|
@@ -13417,6 +13526,9 @@ var LRUCache = class _LRUCache {
|
|
|
13417
13526
|
if (status)
|
|
13418
13527
|
status.set = "add";
|
|
13419
13528
|
noUpdateTTL = false;
|
|
13529
|
+
if (this.#hasOnInsert) {
|
|
13530
|
+
this.#onInsert?.(v, k, "add");
|
|
13531
|
+
}
|
|
13420
13532
|
} else {
|
|
13421
13533
|
this.#moveToTail(index);
|
|
13422
13534
|
const oldVal = this.#valList[index];
|
|
@@ -13452,6 +13564,9 @@ var LRUCache = class _LRUCache {
|
|
|
13452
13564
|
} else if (status) {
|
|
13453
13565
|
status.set = "update";
|
|
13454
13566
|
}
|
|
13567
|
+
if (this.#hasOnInsert) {
|
|
13568
|
+
this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
|
|
13569
|
+
}
|
|
13455
13570
|
}
|
|
13456
13571
|
if (ttl !== 0 && !this.#ttls) {
|
|
13457
13572
|
this.#initializeTTLTracking();
|
|
@@ -13618,10 +13733,11 @@ var LRUCache = class _LRUCache {
|
|
|
13618
13733
|
if (aborted && !ignoreAbort && !updateCache) {
|
|
13619
13734
|
return fetchFail(ac2.signal.reason);
|
|
13620
13735
|
}
|
|
13621
|
-
const bf2 =
|
|
13622
|
-
|
|
13736
|
+
const bf2 = p13;
|
|
13737
|
+
const vl2 = this.#valList[index];
|
|
13738
|
+
if (vl2 === p13 || ignoreAbort && updateCache && vl2 === void 0) {
|
|
13623
13739
|
if (v2 === void 0) {
|
|
13624
|
-
if (bf2.__staleWhileFetching) {
|
|
13740
|
+
if (bf2.__staleWhileFetching !== void 0) {
|
|
13625
13741
|
this.#valList[index] = bf2.__staleWhileFetching;
|
|
13626
13742
|
} else {
|
|
13627
13743
|
this.#delete(k, "fetch");
|
|
@@ -13646,8 +13762,8 @@ var LRUCache = class _LRUCache {
|
|
|
13646
13762
|
const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
|
|
13647
13763
|
const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
|
|
13648
13764
|
const noDelete = allowStale || options.noDeleteOnFetchRejection;
|
|
13649
|
-
const bf2 =
|
|
13650
|
-
if (this.#valList[index] ===
|
|
13765
|
+
const bf2 = p13;
|
|
13766
|
+
if (this.#valList[index] === p13) {
|
|
13651
13767
|
const del = !noDelete || bf2.__staleWhileFetching === void 0;
|
|
13652
13768
|
if (del) {
|
|
13653
13769
|
this.#delete(k, "fetch");
|
|
@@ -13680,8 +13796,8 @@ var LRUCache = class _LRUCache {
|
|
|
13680
13796
|
};
|
|
13681
13797
|
if (options.status)
|
|
13682
13798
|
options.status.fetchDispatched = true;
|
|
13683
|
-
const
|
|
13684
|
-
const bf = Object.assign(
|
|
13799
|
+
const p13 = new Promise(pcall).then(cb, eb);
|
|
13800
|
+
const bf = Object.assign(p13, {
|
|
13685
13801
|
__abortController: ac2,
|
|
13686
13802
|
__staleWhileFetching: v,
|
|
13687
13803
|
__returned: void 0
|
|
@@ -13694,10 +13810,10 @@ var LRUCache = class _LRUCache {
|
|
|
13694
13810
|
}
|
|
13695
13811
|
return bf;
|
|
13696
13812
|
}
|
|
13697
|
-
#isBackgroundFetch(
|
|
13813
|
+
#isBackgroundFetch(p13) {
|
|
13698
13814
|
if (!this.#hasFetchMethod)
|
|
13699
13815
|
return false;
|
|
13700
|
-
const b =
|
|
13816
|
+
const b = p13;
|
|
13701
13817
|
return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
|
|
13702
13818
|
}
|
|
13703
13819
|
async fetch(k, fetchOptions = {}) {
|
|
@@ -13752,8 +13868,8 @@ var LRUCache = class _LRUCache {
|
|
|
13752
13868
|
if (index === void 0) {
|
|
13753
13869
|
if (status)
|
|
13754
13870
|
status.fetch = "miss";
|
|
13755
|
-
const
|
|
13756
|
-
return
|
|
13871
|
+
const p13 = this.#backgroundFetch(k, index, options, context);
|
|
13872
|
+
return p13.__returned = p13;
|
|
13757
13873
|
} else {
|
|
13758
13874
|
const v = this.#valList[index];
|
|
13759
13875
|
if (this.#isBackgroundFetch(v)) {
|
|
@@ -13777,15 +13893,15 @@ var LRUCache = class _LRUCache {
|
|
|
13777
13893
|
this.#statusTTL(status, index);
|
|
13778
13894
|
return v;
|
|
13779
13895
|
}
|
|
13780
|
-
const
|
|
13781
|
-
const hasStale =
|
|
13896
|
+
const p13 = this.#backgroundFetch(k, index, options, context);
|
|
13897
|
+
const hasStale = p13.__staleWhileFetching !== void 0;
|
|
13782
13898
|
const staleVal = hasStale && allowStale;
|
|
13783
13899
|
if (status) {
|
|
13784
13900
|
status.fetch = isStale ? "stale" : "refresh";
|
|
13785
13901
|
if (staleVal && isStale)
|
|
13786
13902
|
status.returnedStale = true;
|
|
13787
13903
|
}
|
|
13788
|
-
return staleVal ?
|
|
13904
|
+
return staleVal ? p13.__staleWhileFetching : p13.__returned = p13;
|
|
13789
13905
|
}
|
|
13790
13906
|
}
|
|
13791
13907
|
async forceFetch(k, fetchOptions = {}) {
|
|
@@ -13856,9 +13972,9 @@ var LRUCache = class _LRUCache {
|
|
|
13856
13972
|
status.get = "miss";
|
|
13857
13973
|
}
|
|
13858
13974
|
}
|
|
13859
|
-
#connect(
|
|
13860
|
-
this.#prev[n] =
|
|
13861
|
-
this.#next[
|
|
13975
|
+
#connect(p13, n) {
|
|
13976
|
+
this.#prev[n] = p13;
|
|
13977
|
+
this.#next[p13] = n;
|
|
13862
13978
|
}
|
|
13863
13979
|
#moveToTail(index) {
|
|
13864
13980
|
if (index !== this.#tail) {
|
|
@@ -14453,16 +14569,16 @@ var Minipass = class extends EventEmitter {
|
|
|
14453
14569
|
* {@link Minipass#resume} is explicitly called.
|
|
14454
14570
|
*/
|
|
14455
14571
|
unpipe(dest) {
|
|
14456
|
-
const
|
|
14457
|
-
if (
|
|
14572
|
+
const p13 = this[PIPES].find((p14) => p14.dest === dest);
|
|
14573
|
+
if (p13) {
|
|
14458
14574
|
if (this[PIPES].length === 1) {
|
|
14459
14575
|
if (this[FLOWING] && this[DATALISTENERS] === 0) {
|
|
14460
14576
|
this[FLOWING] = false;
|
|
14461
14577
|
}
|
|
14462
14578
|
this[PIPES] = [];
|
|
14463
14579
|
} else
|
|
14464
|
-
this[PIPES].splice(this[PIPES].indexOf(
|
|
14465
|
-
|
|
14580
|
+
this[PIPES].splice(this[PIPES].indexOf(p13), 1);
|
|
14581
|
+
p13.unpipe();
|
|
14466
14582
|
}
|
|
14467
14583
|
}
|
|
14468
14584
|
/**
|
|
@@ -14628,8 +14744,8 @@ var Minipass = class extends EventEmitter {
|
|
|
14628
14744
|
return ret;
|
|
14629
14745
|
}
|
|
14630
14746
|
[EMITDATA](data) {
|
|
14631
|
-
for (const
|
|
14632
|
-
if (
|
|
14747
|
+
for (const p13 of this[PIPES]) {
|
|
14748
|
+
if (p13.dest.write(data) === false)
|
|
14633
14749
|
this.pause();
|
|
14634
14750
|
}
|
|
14635
14751
|
const ret = this[DISCARDED] ? false : super.emit("data", data);
|
|
@@ -14647,15 +14763,15 @@ var Minipass = class extends EventEmitter {
|
|
|
14647
14763
|
if (this[DECODER]) {
|
|
14648
14764
|
const data = this[DECODER].end();
|
|
14649
14765
|
if (data) {
|
|
14650
|
-
for (const
|
|
14651
|
-
|
|
14766
|
+
for (const p13 of this[PIPES]) {
|
|
14767
|
+
p13.dest.write(data);
|
|
14652
14768
|
}
|
|
14653
14769
|
if (!this[DISCARDED])
|
|
14654
14770
|
super.emit("data", data);
|
|
14655
14771
|
}
|
|
14656
14772
|
}
|
|
14657
|
-
for (const
|
|
14658
|
-
|
|
14773
|
+
for (const p13 of this[PIPES]) {
|
|
14774
|
+
p13.end();
|
|
14659
14775
|
}
|
|
14660
14776
|
const ret = super.emit("end");
|
|
14661
14777
|
this.removeAllListeners("end");
|
|
@@ -14671,13 +14787,13 @@ var Minipass = class extends EventEmitter {
|
|
|
14671
14787
|
});
|
|
14672
14788
|
if (!this[OBJECTMODE])
|
|
14673
14789
|
buf2.dataLength = 0;
|
|
14674
|
-
const
|
|
14790
|
+
const p13 = this.promise();
|
|
14675
14791
|
this.on("data", (c) => {
|
|
14676
14792
|
buf2.push(c);
|
|
14677
14793
|
if (!this[OBJECTMODE])
|
|
14678
14794
|
buf2.dataLength += c.length;
|
|
14679
14795
|
});
|
|
14680
|
-
await
|
|
14796
|
+
await p13;
|
|
14681
14797
|
return buf2;
|
|
14682
14798
|
}
|
|
14683
14799
|
/**
|
|
@@ -14891,7 +15007,7 @@ var ENOREALPATH = 512;
|
|
|
14891
15007
|
var ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH;
|
|
14892
15008
|
var TYPEMASK = 1023;
|
|
14893
15009
|
var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN;
|
|
14894
|
-
var normalizeCache =
|
|
15010
|
+
var normalizeCache = new LRUCache({ max: 2 ** 12 });
|
|
14895
15011
|
var normalize = (s) => {
|
|
14896
15012
|
const c = normalizeCache.get(s);
|
|
14897
15013
|
if (c)
|
|
@@ -14900,7 +15016,7 @@ var normalize = (s) => {
|
|
|
14900
15016
|
normalizeCache.set(s, n);
|
|
14901
15017
|
return n;
|
|
14902
15018
|
};
|
|
14903
|
-
var normalizeNocaseCache =
|
|
15019
|
+
var normalizeNocaseCache = new LRUCache({ max: 2 ** 12 });
|
|
14904
15020
|
var normalizeNocase = (s) => {
|
|
14905
15021
|
const c = normalizeNocaseCache.get(s);
|
|
14906
15022
|
if (c)
|
|
@@ -15057,13 +15173,17 @@ var PathBase = class {
|
|
|
15057
15173
|
get parentPath() {
|
|
15058
15174
|
return (this.parent || this).fullpath();
|
|
15059
15175
|
}
|
|
15176
|
+
/* c8 ignore start */
|
|
15060
15177
|
/**
|
|
15061
15178
|
* Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively,
|
|
15062
15179
|
* this property refers to the *parent* path, not the path object itself.
|
|
15180
|
+
*
|
|
15181
|
+
* @deprecated
|
|
15063
15182
|
*/
|
|
15064
15183
|
get path() {
|
|
15065
15184
|
return this.parentPath;
|
|
15066
15185
|
}
|
|
15186
|
+
/* c8 ignore stop */
|
|
15067
15187
|
/**
|
|
15068
15188
|
* Do not create new Path objects directly. They should always be accessed
|
|
15069
15189
|
* via the PathScurry class or other methods on the Path class.
|
|
@@ -15109,22 +15229,22 @@ var PathBase = class {
|
|
|
15109
15229
|
/**
|
|
15110
15230
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
15111
15231
|
*/
|
|
15112
|
-
resolve(
|
|
15113
|
-
if (!
|
|
15232
|
+
resolve(path13) {
|
|
15233
|
+
if (!path13) {
|
|
15114
15234
|
return this;
|
|
15115
15235
|
}
|
|
15116
|
-
const rootPath = this.getRootString(
|
|
15117
|
-
const dir =
|
|
15236
|
+
const rootPath = this.getRootString(path13);
|
|
15237
|
+
const dir = path13.substring(rootPath.length);
|
|
15118
15238
|
const dirParts = dir.split(this.splitSep);
|
|
15119
15239
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
15120
15240
|
return result;
|
|
15121
15241
|
}
|
|
15122
15242
|
#resolveParts(dirParts) {
|
|
15123
|
-
let
|
|
15243
|
+
let p13 = this;
|
|
15124
15244
|
for (const part of dirParts) {
|
|
15125
|
-
|
|
15245
|
+
p13 = p13.child(part);
|
|
15126
15246
|
}
|
|
15127
|
-
return
|
|
15247
|
+
return p13;
|
|
15128
15248
|
}
|
|
15129
15249
|
/**
|
|
15130
15250
|
* Returns the cached children Path objects, if still available. If they
|
|
@@ -15166,9 +15286,9 @@ var PathBase = class {
|
|
|
15166
15286
|
}
|
|
15167
15287
|
const children = this.children();
|
|
15168
15288
|
const name = this.nocase ? normalizeNocase(pathPart) : normalize(pathPart);
|
|
15169
|
-
for (const
|
|
15170
|
-
if (
|
|
15171
|
-
return
|
|
15289
|
+
for (const p13 of children) {
|
|
15290
|
+
if (p13.#matchName === name) {
|
|
15291
|
+
return p13;
|
|
15172
15292
|
}
|
|
15173
15293
|
}
|
|
15174
15294
|
const s = this.parent ? this.sep : "";
|
|
@@ -15195,12 +15315,12 @@ var PathBase = class {
|
|
|
15195
15315
|
return this.#relative;
|
|
15196
15316
|
}
|
|
15197
15317
|
const name = this.name;
|
|
15198
|
-
const
|
|
15199
|
-
if (!
|
|
15318
|
+
const p13 = this.parent;
|
|
15319
|
+
if (!p13) {
|
|
15200
15320
|
return this.#relative = this.name;
|
|
15201
15321
|
}
|
|
15202
|
-
const pv =
|
|
15203
|
-
return pv + (!pv || !
|
|
15322
|
+
const pv = p13.relative();
|
|
15323
|
+
return pv + (!pv || !p13.parent ? "" : this.sep) + name;
|
|
15204
15324
|
}
|
|
15205
15325
|
/**
|
|
15206
15326
|
* The relative path from the cwd, using / as the path separator.
|
|
@@ -15216,12 +15336,12 @@ var PathBase = class {
|
|
|
15216
15336
|
if (this.#relativePosix !== void 0)
|
|
15217
15337
|
return this.#relativePosix;
|
|
15218
15338
|
const name = this.name;
|
|
15219
|
-
const
|
|
15220
|
-
if (!
|
|
15339
|
+
const p13 = this.parent;
|
|
15340
|
+
if (!p13) {
|
|
15221
15341
|
return this.#relativePosix = this.fullpathPosix();
|
|
15222
15342
|
}
|
|
15223
|
-
const pv =
|
|
15224
|
-
return pv + (!pv || !
|
|
15343
|
+
const pv = p13.relativePosix();
|
|
15344
|
+
return pv + (!pv || !p13.parent ? "" : "/") + name;
|
|
15225
15345
|
}
|
|
15226
15346
|
/**
|
|
15227
15347
|
* The fully resolved path string for this Path entry
|
|
@@ -15231,12 +15351,12 @@ var PathBase = class {
|
|
|
15231
15351
|
return this.#fullpath;
|
|
15232
15352
|
}
|
|
15233
15353
|
const name = this.name;
|
|
15234
|
-
const
|
|
15235
|
-
if (!
|
|
15354
|
+
const p13 = this.parent;
|
|
15355
|
+
if (!p13) {
|
|
15236
15356
|
return this.#fullpath = this.name;
|
|
15237
15357
|
}
|
|
15238
|
-
const pv =
|
|
15239
|
-
const fp = pv + (!
|
|
15358
|
+
const pv = p13.fullpath();
|
|
15359
|
+
const fp = pv + (!p13.parent ? "" : this.sep) + name;
|
|
15240
15360
|
return this.#fullpath = fp;
|
|
15241
15361
|
}
|
|
15242
15362
|
/**
|
|
@@ -15251,16 +15371,16 @@ var PathBase = class {
|
|
|
15251
15371
|
if (this.sep === "/")
|
|
15252
15372
|
return this.#fullpathPosix = this.fullpath();
|
|
15253
15373
|
if (!this.parent) {
|
|
15254
|
-
const
|
|
15255
|
-
if (/^[a-z]:\//i.test(
|
|
15256
|
-
return this.#fullpathPosix = `//?/${
|
|
15374
|
+
const p14 = this.fullpath().replace(/\\/g, "/");
|
|
15375
|
+
if (/^[a-z]:\//i.test(p14)) {
|
|
15376
|
+
return this.#fullpathPosix = `//?/${p14}`;
|
|
15257
15377
|
} else {
|
|
15258
|
-
return this.#fullpathPosix =
|
|
15378
|
+
return this.#fullpathPosix = p14;
|
|
15259
15379
|
}
|
|
15260
15380
|
}
|
|
15261
|
-
const
|
|
15262
|
-
const pfpp =
|
|
15263
|
-
const fpp = pfpp + (!pfpp || !
|
|
15381
|
+
const p13 = this.parent;
|
|
15382
|
+
const pfpp = p13.fullpathPosix();
|
|
15383
|
+
const fpp = pfpp + (!pfpp || !p13.parent ? "" : "/") + this.name;
|
|
15264
15384
|
return this.#fullpathPosix = fpp;
|
|
15265
15385
|
}
|
|
15266
15386
|
/**
|
|
@@ -15469,8 +15589,8 @@ var PathBase = class {
|
|
|
15469
15589
|
}
|
|
15470
15590
|
#readdirSuccess(children) {
|
|
15471
15591
|
this.#type |= READDIR_CALLED;
|
|
15472
|
-
for (let
|
|
15473
|
-
const c = children[
|
|
15592
|
+
for (let p13 = children.provisional; p13 < children.length; p13++) {
|
|
15593
|
+
const c = children[p13];
|
|
15474
15594
|
if (c)
|
|
15475
15595
|
c.#markENOENT();
|
|
15476
15596
|
}
|
|
@@ -15484,8 +15604,8 @@ var PathBase = class {
|
|
|
15484
15604
|
#markChildrenENOENT() {
|
|
15485
15605
|
const children = this.children();
|
|
15486
15606
|
children.provisional = 0;
|
|
15487
|
-
for (const
|
|
15488
|
-
|
|
15607
|
+
for (const p13 of children) {
|
|
15608
|
+
p13.#markENOENT();
|
|
15489
15609
|
}
|
|
15490
15610
|
}
|
|
15491
15611
|
#markENOREALPATH() {
|
|
@@ -15513,8 +15633,8 @@ var PathBase = class {
|
|
|
15513
15633
|
}
|
|
15514
15634
|
#lstatFail(code = "") {
|
|
15515
15635
|
if (code === "ENOTDIR") {
|
|
15516
|
-
const
|
|
15517
|
-
|
|
15636
|
+
const p13 = this.parent;
|
|
15637
|
+
p13.#markENOTDIR();
|
|
15518
15638
|
} else if (code === "ENOENT") {
|
|
15519
15639
|
this.#markENOENT();
|
|
15520
15640
|
}
|
|
@@ -15547,29 +15667,29 @@ var PathBase = class {
|
|
|
15547
15667
|
return child;
|
|
15548
15668
|
}
|
|
15549
15669
|
#readdirMaybePromoteChild(e, c) {
|
|
15550
|
-
for (let
|
|
15551
|
-
const pchild = c[
|
|
15670
|
+
for (let p13 = c.provisional; p13 < c.length; p13++) {
|
|
15671
|
+
const pchild = c[p13];
|
|
15552
15672
|
const name = this.nocase ? normalizeNocase(e.name) : normalize(e.name);
|
|
15553
15673
|
if (name !== pchild.#matchName) {
|
|
15554
15674
|
continue;
|
|
15555
15675
|
}
|
|
15556
|
-
return this.#readdirPromoteChild(e, pchild,
|
|
15676
|
+
return this.#readdirPromoteChild(e, pchild, p13, c);
|
|
15557
15677
|
}
|
|
15558
15678
|
}
|
|
15559
|
-
#readdirPromoteChild(e,
|
|
15560
|
-
const v =
|
|
15561
|
-
|
|
15679
|
+
#readdirPromoteChild(e, p13, index, c) {
|
|
15680
|
+
const v = p13.name;
|
|
15681
|
+
p13.#type = p13.#type & IFMT_UNKNOWN | entToType(e);
|
|
15562
15682
|
if (v !== e.name)
|
|
15563
|
-
|
|
15683
|
+
p13.name = e.name;
|
|
15564
15684
|
if (index !== c.provisional) {
|
|
15565
15685
|
if (index === c.length - 1)
|
|
15566
15686
|
c.pop();
|
|
15567
15687
|
else
|
|
15568
15688
|
c.splice(index, 1);
|
|
15569
|
-
c.unshift(
|
|
15689
|
+
c.unshift(p13);
|
|
15570
15690
|
}
|
|
15571
15691
|
c.provisional++;
|
|
15572
|
-
return
|
|
15692
|
+
return p13;
|
|
15573
15693
|
}
|
|
15574
15694
|
/**
|
|
15575
15695
|
* Call lstat() on this Path, and update all known information that can be
|
|
@@ -15823,19 +15943,19 @@ var PathBase = class {
|
|
|
15823
15943
|
this.isCWD = true;
|
|
15824
15944
|
const changed = /* @__PURE__ */ new Set([]);
|
|
15825
15945
|
let rp = [];
|
|
15826
|
-
let
|
|
15827
|
-
while (
|
|
15828
|
-
changed.add(
|
|
15829
|
-
|
|
15830
|
-
|
|
15831
|
-
|
|
15946
|
+
let p13 = this;
|
|
15947
|
+
while (p13 && p13.parent) {
|
|
15948
|
+
changed.add(p13);
|
|
15949
|
+
p13.#relative = rp.join(this.sep);
|
|
15950
|
+
p13.#relativePosix = rp.join("/");
|
|
15951
|
+
p13 = p13.parent;
|
|
15832
15952
|
rp.push("..");
|
|
15833
15953
|
}
|
|
15834
|
-
|
|
15835
|
-
while (
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15954
|
+
p13 = oldCwd;
|
|
15955
|
+
while (p13 && p13.parent && !changed.has(p13)) {
|
|
15956
|
+
p13.#relative = void 0;
|
|
15957
|
+
p13.#relativePosix = void 0;
|
|
15958
|
+
p13 = p13.parent;
|
|
15839
15959
|
}
|
|
15840
15960
|
}
|
|
15841
15961
|
};
|
|
@@ -15866,8 +15986,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
|
|
|
15866
15986
|
/**
|
|
15867
15987
|
* @internal
|
|
15868
15988
|
*/
|
|
15869
|
-
getRootString(
|
|
15870
|
-
return win32.parse(
|
|
15989
|
+
getRootString(path13) {
|
|
15990
|
+
return win32.parse(path13).root;
|
|
15871
15991
|
}
|
|
15872
15992
|
/**
|
|
15873
15993
|
* @internal
|
|
@@ -15913,8 +16033,8 @@ var PathPosix = class _PathPosix extends PathBase {
|
|
|
15913
16033
|
/**
|
|
15914
16034
|
* @internal
|
|
15915
16035
|
*/
|
|
15916
|
-
getRootString(
|
|
15917
|
-
return
|
|
16036
|
+
getRootString(path13) {
|
|
16037
|
+
return path13.startsWith("/") ? "/" : "";
|
|
15918
16038
|
}
|
|
15919
16039
|
/**
|
|
15920
16040
|
* @internal
|
|
@@ -16003,11 +16123,11 @@ var PathScurryBase = class {
|
|
|
16003
16123
|
/**
|
|
16004
16124
|
* Get the depth of a provided path, string, or the cwd
|
|
16005
16125
|
*/
|
|
16006
|
-
depth(
|
|
16007
|
-
if (typeof
|
|
16008
|
-
|
|
16126
|
+
depth(path13 = this.cwd) {
|
|
16127
|
+
if (typeof path13 === "string") {
|
|
16128
|
+
path13 = this.cwd.resolve(path13);
|
|
16009
16129
|
}
|
|
16010
|
-
return
|
|
16130
|
+
return path13.depth();
|
|
16011
16131
|
}
|
|
16012
16132
|
/**
|
|
16013
16133
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -16030,11 +16150,11 @@ var PathScurryBase = class {
|
|
|
16030
16150
|
resolve(...paths) {
|
|
16031
16151
|
let r = "";
|
|
16032
16152
|
for (let i = paths.length - 1; i >= 0; i--) {
|
|
16033
|
-
const
|
|
16034
|
-
if (!
|
|
16153
|
+
const p13 = paths[i];
|
|
16154
|
+
if (!p13 || p13 === ".")
|
|
16035
16155
|
continue;
|
|
16036
|
-
r = r ? `${
|
|
16037
|
-
if (this.isAbsolute(
|
|
16156
|
+
r = r ? `${p13}/${r}` : p13;
|
|
16157
|
+
if (this.isAbsolute(p13)) {
|
|
16038
16158
|
break;
|
|
16039
16159
|
}
|
|
16040
16160
|
}
|
|
@@ -16060,11 +16180,11 @@ var PathScurryBase = class {
|
|
|
16060
16180
|
resolvePosix(...paths) {
|
|
16061
16181
|
let r = "";
|
|
16062
16182
|
for (let i = paths.length - 1; i >= 0; i--) {
|
|
16063
|
-
const
|
|
16064
|
-
if (!
|
|
16183
|
+
const p13 = paths[i];
|
|
16184
|
+
if (!p13 || p13 === ".")
|
|
16065
16185
|
continue;
|
|
16066
|
-
r = r ? `${
|
|
16067
|
-
if (this.isAbsolute(
|
|
16186
|
+
r = r ? `${p13}/${r}` : p13;
|
|
16187
|
+
if (this.isAbsolute(p13)) {
|
|
16068
16188
|
break;
|
|
16069
16189
|
}
|
|
16070
16190
|
}
|
|
@@ -16126,8 +16246,8 @@ var PathScurryBase = class {
|
|
|
16126
16246
|
if (!entry.canReaddir()) {
|
|
16127
16247
|
return [];
|
|
16128
16248
|
} else {
|
|
16129
|
-
const
|
|
16130
|
-
return withFileTypes ?
|
|
16249
|
+
const p13 = await entry.readdir();
|
|
16250
|
+
return withFileTypes ? p13 : p13.map((e) => e.name);
|
|
16131
16251
|
}
|
|
16132
16252
|
}
|
|
16133
16253
|
readdirSync(entry = this.cwd, opts = {
|
|
@@ -16494,9 +16614,9 @@ var PathScurryBase = class {
|
|
|
16494
16614
|
process2();
|
|
16495
16615
|
return results;
|
|
16496
16616
|
}
|
|
16497
|
-
chdir(
|
|
16617
|
+
chdir(path13 = this.cwd) {
|
|
16498
16618
|
const oldCwd = this.cwd;
|
|
16499
|
-
this.cwd = typeof
|
|
16619
|
+
this.cwd = typeof path13 === "string" ? this.cwd.resolve(path13) : path13;
|
|
16500
16620
|
this.cwd[setAsCwd](oldCwd);
|
|
16501
16621
|
}
|
|
16502
16622
|
};
|
|
@@ -16509,8 +16629,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
16509
16629
|
const { nocase = true } = opts;
|
|
16510
16630
|
super(cwd, win32, "\\", { ...opts, nocase });
|
|
16511
16631
|
this.nocase = nocase;
|
|
16512
|
-
for (let
|
|
16513
|
-
|
|
16632
|
+
for (let p13 = this.cwd; p13; p13 = p13.parent) {
|
|
16633
|
+
p13.nocase = this.nocase;
|
|
16514
16634
|
}
|
|
16515
16635
|
}
|
|
16516
16636
|
/**
|
|
@@ -16528,8 +16648,8 @@ var PathScurryWin32 = class extends PathScurryBase {
|
|
|
16528
16648
|
/**
|
|
16529
16649
|
* Return true if the provided path string is an absolute path
|
|
16530
16650
|
*/
|
|
16531
|
-
isAbsolute(
|
|
16532
|
-
return
|
|
16651
|
+
isAbsolute(p13) {
|
|
16652
|
+
return p13.startsWith("/") || p13.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p13);
|
|
16533
16653
|
}
|
|
16534
16654
|
};
|
|
16535
16655
|
var PathScurryPosix = class extends PathScurryBase {
|
|
@@ -16557,8 +16677,8 @@ var PathScurryPosix = class extends PathScurryBase {
|
|
|
16557
16677
|
/**
|
|
16558
16678
|
* Return true if the provided path string is an absolute path
|
|
16559
16679
|
*/
|
|
16560
|
-
isAbsolute(
|
|
16561
|
-
return
|
|
16680
|
+
isAbsolute(p13) {
|
|
16681
|
+
return p13.startsWith("/");
|
|
16562
16682
|
}
|
|
16563
16683
|
};
|
|
16564
16684
|
var PathScurryDarwin = class extends PathScurryPosix {
|
|
@@ -16611,9 +16731,9 @@ var Pattern = class _Pattern {
|
|
|
16611
16731
|
prest.shift();
|
|
16612
16732
|
grest.shift();
|
|
16613
16733
|
}
|
|
16614
|
-
const
|
|
16734
|
+
const p13 = [p0, p1, p22, p32, ""].join("/");
|
|
16615
16735
|
const g = [g0, g1, g2, g3, ""].join("/");
|
|
16616
|
-
this.#patternList = [
|
|
16736
|
+
this.#patternList = [p13, ...prest];
|
|
16617
16737
|
this.#globList = [g, ...grest];
|
|
16618
16738
|
this.length = this.#patternList.length;
|
|
16619
16739
|
} else if (this.isDrive() || this.isAbsolute()) {
|
|
@@ -16623,9 +16743,9 @@ var Pattern = class _Pattern {
|
|
|
16623
16743
|
prest.shift();
|
|
16624
16744
|
grest.shift();
|
|
16625
16745
|
}
|
|
16626
|
-
const
|
|
16746
|
+
const p13 = p1 + "/";
|
|
16627
16747
|
const g = g1 + "/";
|
|
16628
|
-
this.#patternList = [
|
|
16748
|
+
this.#patternList = [p13, ...prest];
|
|
16629
16749
|
this.#globList = [g, ...grest];
|
|
16630
16750
|
this.length = this.#patternList.length;
|
|
16631
16751
|
}
|
|
@@ -16714,8 +16834,8 @@ var Pattern = class _Pattern {
|
|
|
16714
16834
|
* consume the root of the pattern, and return it
|
|
16715
16835
|
*/
|
|
16716
16836
|
root() {
|
|
16717
|
-
const
|
|
16718
|
-
return typeof
|
|
16837
|
+
const p13 = this.#patternList[0];
|
|
16838
|
+
return typeof p13 === "string" && this.isAbsolute() && this.#index === 0 ? p13 : "";
|
|
16719
16839
|
}
|
|
16720
16840
|
/**
|
|
16721
16841
|
* Check to see if the current globstar pattern is allowed to follow
|
|
@@ -16776,10 +16896,10 @@ var Ignore = class {
|
|
|
16776
16896
|
parsed.shift();
|
|
16777
16897
|
globParts.shift();
|
|
16778
16898
|
}
|
|
16779
|
-
const
|
|
16780
|
-
const m = new Minimatch(
|
|
16899
|
+
const p13 = new Pattern(parsed, globParts, 0, this.platform);
|
|
16900
|
+
const m = new Minimatch(p13.globString(), this.mmopts);
|
|
16781
16901
|
const children = globParts[globParts.length - 1] === "**";
|
|
16782
|
-
const absolute =
|
|
16902
|
+
const absolute = p13.isAbsolute();
|
|
16783
16903
|
if (absolute)
|
|
16784
16904
|
this.absolute.push(m);
|
|
16785
16905
|
else
|
|
@@ -16792,10 +16912,10 @@ var Ignore = class {
|
|
|
16792
16912
|
}
|
|
16793
16913
|
}
|
|
16794
16914
|
}
|
|
16795
|
-
ignored(
|
|
16796
|
-
const fullpath =
|
|
16915
|
+
ignored(p13) {
|
|
16916
|
+
const fullpath = p13.fullpath();
|
|
16797
16917
|
const fullpaths = `${fullpath}/`;
|
|
16798
|
-
const relative =
|
|
16918
|
+
const relative = p13.relative() || ".";
|
|
16799
16919
|
const relatives = `${relative}/`;
|
|
16800
16920
|
for (const m of this.relative) {
|
|
16801
16921
|
if (m.match(relative) || m.match(relatives))
|
|
@@ -16807,9 +16927,9 @@ var Ignore = class {
|
|
|
16807
16927
|
}
|
|
16808
16928
|
return false;
|
|
16809
16929
|
}
|
|
16810
|
-
childrenIgnored(
|
|
16811
|
-
const fullpath =
|
|
16812
|
-
const relative = (
|
|
16930
|
+
childrenIgnored(p13) {
|
|
16931
|
+
const fullpath = p13.fullpath() + "/";
|
|
16932
|
+
const relative = (p13.relative() || ".") + "/";
|
|
16813
16933
|
for (const m of this.relativeChildren) {
|
|
16814
16934
|
if (m.match(relative))
|
|
16815
16935
|
return true;
|
|
@@ -16852,8 +16972,8 @@ var MatchRecord = class {
|
|
|
16852
16972
|
}
|
|
16853
16973
|
// match, absolute, ifdir
|
|
16854
16974
|
entries() {
|
|
16855
|
-
return [...this.store.entries()].map(([
|
|
16856
|
-
|
|
16975
|
+
return [...this.store.entries()].map(([path13, n]) => [
|
|
16976
|
+
path13,
|
|
16857
16977
|
!!(n & 2),
|
|
16858
16978
|
!!(n & 1)
|
|
16859
16979
|
]);
|
|
@@ -16867,7 +16987,7 @@ var SubWalks = class {
|
|
|
16867
16987
|
}
|
|
16868
16988
|
const subs = this.store.get(target);
|
|
16869
16989
|
if (subs) {
|
|
16870
|
-
if (!subs.find((
|
|
16990
|
+
if (!subs.find((p13) => p13.globString() === pattern.globString())) {
|
|
16871
16991
|
subs.push(pattern);
|
|
16872
16992
|
}
|
|
16873
16993
|
} else
|
|
@@ -16903,7 +17023,7 @@ var Processor = class _Processor {
|
|
|
16903
17023
|
}
|
|
16904
17024
|
processPatterns(target, patterns) {
|
|
16905
17025
|
this.patterns = patterns;
|
|
16906
|
-
const processingSet = patterns.map((
|
|
17026
|
+
const processingSet = patterns.map((p13) => [target, p13]);
|
|
16907
17027
|
for (let [t, pattern] of processingSet) {
|
|
16908
17028
|
this.hasWalkedCache.storeWalked(t, pattern);
|
|
16909
17029
|
const root = pattern.root();
|
|
@@ -16920,27 +17040,27 @@ var Processor = class _Processor {
|
|
|
16920
17040
|
}
|
|
16921
17041
|
if (t.isENOENT())
|
|
16922
17042
|
continue;
|
|
16923
|
-
let
|
|
17043
|
+
let p13;
|
|
16924
17044
|
let rest;
|
|
16925
17045
|
let changed = false;
|
|
16926
|
-
while (typeof (
|
|
16927
|
-
const c = t.resolve(
|
|
17046
|
+
while (typeof (p13 = pattern.pattern()) === "string" && (rest = pattern.rest())) {
|
|
17047
|
+
const c = t.resolve(p13);
|
|
16928
17048
|
t = c;
|
|
16929
17049
|
pattern = rest;
|
|
16930
17050
|
changed = true;
|
|
16931
17051
|
}
|
|
16932
|
-
|
|
17052
|
+
p13 = pattern.pattern();
|
|
16933
17053
|
rest = pattern.rest();
|
|
16934
17054
|
if (changed) {
|
|
16935
17055
|
if (this.hasWalkedCache.hasWalked(t, pattern))
|
|
16936
17056
|
continue;
|
|
16937
17057
|
this.hasWalkedCache.storeWalked(t, pattern);
|
|
16938
17058
|
}
|
|
16939
|
-
if (typeof
|
|
16940
|
-
const ifDir =
|
|
16941
|
-
this.matches.add(t.resolve(
|
|
17059
|
+
if (typeof p13 === "string") {
|
|
17060
|
+
const ifDir = p13 === ".." || p13 === "" || p13 === ".";
|
|
17061
|
+
this.matches.add(t.resolve(p13), absolute, ifDir);
|
|
16942
17062
|
continue;
|
|
16943
|
-
} else if (
|
|
17063
|
+
} else if (p13 === GLOBSTAR) {
|
|
16944
17064
|
if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) {
|
|
16945
17065
|
this.subwalks.add(t, pattern);
|
|
16946
17066
|
}
|
|
@@ -16958,7 +17078,7 @@ var Processor = class _Processor {
|
|
|
16958
17078
|
}
|
|
16959
17079
|
}
|
|
16960
17080
|
}
|
|
16961
|
-
} else if (
|
|
17081
|
+
} else if (p13 instanceof RegExp) {
|
|
16962
17082
|
this.subwalks.add(t, pattern);
|
|
16963
17083
|
}
|
|
16964
17084
|
}
|
|
@@ -16980,14 +17100,14 @@ var Processor = class _Processor {
|
|
|
16980
17100
|
for (const e of entries) {
|
|
16981
17101
|
for (const pattern of patterns) {
|
|
16982
17102
|
const absolute = pattern.isAbsolute();
|
|
16983
|
-
const
|
|
17103
|
+
const p13 = pattern.pattern();
|
|
16984
17104
|
const rest = pattern.rest();
|
|
16985
|
-
if (
|
|
17105
|
+
if (p13 === GLOBSTAR) {
|
|
16986
17106
|
results.testGlobstar(e, pattern, rest, absolute);
|
|
16987
|
-
} else if (
|
|
16988
|
-
results.testRegExp(e,
|
|
17107
|
+
} else if (p13 instanceof RegExp) {
|
|
17108
|
+
results.testRegExp(e, p13, rest, absolute);
|
|
16989
17109
|
} else {
|
|
16990
|
-
results.testString(e,
|
|
17110
|
+
results.testString(e, p13, rest, absolute);
|
|
16991
17111
|
}
|
|
16992
17112
|
}
|
|
16993
17113
|
}
|
|
@@ -17023,8 +17143,8 @@ var Processor = class _Processor {
|
|
|
17023
17143
|
}
|
|
17024
17144
|
}
|
|
17025
17145
|
}
|
|
17026
|
-
testRegExp(e,
|
|
17027
|
-
if (!
|
|
17146
|
+
testRegExp(e, p13, rest, absolute) {
|
|
17147
|
+
if (!p13.test(e.name))
|
|
17028
17148
|
return;
|
|
17029
17149
|
if (!rest) {
|
|
17030
17150
|
this.matches.add(e, absolute, false);
|
|
@@ -17032,8 +17152,8 @@ var Processor = class _Processor {
|
|
|
17032
17152
|
this.subwalks.add(e, rest);
|
|
17033
17153
|
}
|
|
17034
17154
|
}
|
|
17035
|
-
testString(e,
|
|
17036
|
-
if (!e.isNamed(
|
|
17155
|
+
testString(e, p13, rest, absolute) {
|
|
17156
|
+
if (!e.isNamed(p13))
|
|
17037
17157
|
return;
|
|
17038
17158
|
if (!rest) {
|
|
17039
17159
|
this.matches.add(e, absolute, false);
|
|
@@ -17058,9 +17178,9 @@ var GlobUtil = class {
|
|
|
17058
17178
|
signal;
|
|
17059
17179
|
maxDepth;
|
|
17060
17180
|
includeChildMatches;
|
|
17061
|
-
constructor(patterns,
|
|
17181
|
+
constructor(patterns, path13, opts) {
|
|
17062
17182
|
this.patterns = patterns;
|
|
17063
|
-
this.path =
|
|
17183
|
+
this.path = path13;
|
|
17064
17184
|
this.opts = opts;
|
|
17065
17185
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
17066
17186
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -17079,11 +17199,11 @@ var GlobUtil = class {
|
|
|
17079
17199
|
});
|
|
17080
17200
|
}
|
|
17081
17201
|
}
|
|
17082
|
-
#ignored(
|
|
17083
|
-
return this.seen.has(
|
|
17202
|
+
#ignored(path13) {
|
|
17203
|
+
return this.seen.has(path13) || !!this.#ignore?.ignored?.(path13);
|
|
17084
17204
|
}
|
|
17085
|
-
#childrenIgnored(
|
|
17086
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
17205
|
+
#childrenIgnored(path13) {
|
|
17206
|
+
return !!this.#ignore?.childrenIgnored?.(path13);
|
|
17087
17207
|
}
|
|
17088
17208
|
// backpressure mechanism
|
|
17089
17209
|
pause() {
|
|
@@ -17174,14 +17294,14 @@ var GlobUtil = class {
|
|
|
17174
17294
|
}
|
|
17175
17295
|
}
|
|
17176
17296
|
async match(e, absolute, ifDir) {
|
|
17177
|
-
const
|
|
17178
|
-
if (
|
|
17179
|
-
this.matchFinish(
|
|
17297
|
+
const p13 = await this.matchCheck(e, ifDir);
|
|
17298
|
+
if (p13)
|
|
17299
|
+
this.matchFinish(p13, absolute);
|
|
17180
17300
|
}
|
|
17181
17301
|
matchSync(e, absolute, ifDir) {
|
|
17182
|
-
const
|
|
17183
|
-
if (
|
|
17184
|
-
this.matchFinish(
|
|
17302
|
+
const p13 = this.matchCheckSync(e, ifDir);
|
|
17303
|
+
if (p13)
|
|
17304
|
+
this.matchFinish(p13, absolute);
|
|
17185
17305
|
}
|
|
17186
17306
|
walkCB(target, patterns, cb) {
|
|
17187
17307
|
if (this.signal?.aborted)
|
|
@@ -17298,8 +17418,8 @@ var GlobUtil = class {
|
|
|
17298
17418
|
};
|
|
17299
17419
|
var GlobWalker = class extends GlobUtil {
|
|
17300
17420
|
matches = /* @__PURE__ */ new Set();
|
|
17301
|
-
constructor(patterns,
|
|
17302
|
-
super(patterns,
|
|
17421
|
+
constructor(patterns, path13, opts) {
|
|
17422
|
+
super(patterns, path13, opts);
|
|
17303
17423
|
}
|
|
17304
17424
|
matchEmit(e) {
|
|
17305
17425
|
this.matches.add(e);
|
|
@@ -17336,8 +17456,8 @@ var GlobWalker = class extends GlobUtil {
|
|
|
17336
17456
|
};
|
|
17337
17457
|
var GlobStream = class extends GlobUtil {
|
|
17338
17458
|
results;
|
|
17339
|
-
constructor(patterns,
|
|
17340
|
-
super(patterns,
|
|
17459
|
+
constructor(patterns, path13, opts) {
|
|
17460
|
+
super(patterns, path13, opts);
|
|
17341
17461
|
this.results = new Minipass({
|
|
17342
17462
|
signal: this.signal,
|
|
17343
17463
|
objectMode: true
|
|
@@ -17454,13 +17574,13 @@ var Glob = class {
|
|
|
17454
17574
|
}
|
|
17455
17575
|
this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false;
|
|
17456
17576
|
if (this.windowsPathsNoEscape) {
|
|
17457
|
-
pattern = pattern.map((
|
|
17577
|
+
pattern = pattern.map((p13) => p13.replace(/\\/g, "/"));
|
|
17458
17578
|
}
|
|
17459
17579
|
if (this.matchBase) {
|
|
17460
17580
|
if (opts.noglobstar) {
|
|
17461
17581
|
throw new TypeError("base matching requires globstar");
|
|
17462
17582
|
}
|
|
17463
|
-
pattern = pattern.map((
|
|
17583
|
+
pattern = pattern.map((p13) => p13.includes("/") ? p13 : `./**/${p13}`);
|
|
17464
17584
|
}
|
|
17465
17585
|
this.pattern = pattern;
|
|
17466
17586
|
this.platform = opts.platform || defaultPlatform3;
|
|
@@ -17495,7 +17615,7 @@ var Glob = class {
|
|
|
17495
17615
|
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
17496
17616
|
debug: !!this.opts.debug
|
|
17497
17617
|
};
|
|
17498
|
-
const mms = this.pattern.map((
|
|
17618
|
+
const mms = this.pattern.map((p13) => new Minimatch(p13, mmo));
|
|
17499
17619
|
const [matchSet, globParts] = mms.reduce((set, m) => {
|
|
17500
17620
|
set[0].push(...m.set);
|
|
17501
17621
|
set[1].push(...m.globParts);
|
|
@@ -17575,8 +17695,8 @@ var hasMagic = (pattern, options = {}) => {
|
|
|
17575
17695
|
if (!Array.isArray(pattern)) {
|
|
17576
17696
|
pattern = [pattern];
|
|
17577
17697
|
}
|
|
17578
|
-
for (const
|
|
17579
|
-
if (new Minimatch(
|
|
17698
|
+
for (const p13 of pattern) {
|
|
17699
|
+
if (new Minimatch(p13, options).hasMagic())
|
|
17580
17700
|
return true;
|
|
17581
17701
|
}
|
|
17582
17702
|
return false;
|
|
@@ -17637,11 +17757,11 @@ async function findComponentDirectories(baseDir) {
|
|
|
17637
17757
|
const namedYmls = await glob(`${baseDir}/**/*.component.yml`);
|
|
17638
17758
|
const allComponentPaths = [...standardYmls, ...namedYmls];
|
|
17639
17759
|
const uniqueDirs = new Set(
|
|
17640
|
-
allComponentPaths.map((filePath) =>
|
|
17760
|
+
allComponentPaths.map((filePath) => path11.dirname(filePath))
|
|
17641
17761
|
);
|
|
17642
17762
|
let componentDirs = Array.from(uniqueDirs).sort();
|
|
17643
17763
|
let sdcs = await glob(`${baseDir}/**/*.twig`);
|
|
17644
|
-
sdcs = sdcs.map((sdc) =>
|
|
17764
|
+
sdcs = sdcs.map((sdc) => path11.dirname(sdc));
|
|
17645
17765
|
componentDirs = componentDirs.filter(
|
|
17646
17766
|
(componentDir) => !sdcs.includes(componentDir)
|
|
17647
17767
|
);
|
|
@@ -17674,7 +17794,7 @@ async function selectLocalComponents(allFlag, message = "Select components", bas
|
|
|
17674
17794
|
},
|
|
17675
17795
|
...componentDirs.map((dir) => ({
|
|
17676
17796
|
value: dir,
|
|
17677
|
-
label:
|
|
17797
|
+
label: path11.basename(dir)
|
|
17678
17798
|
}))
|
|
17679
17799
|
],
|
|
17680
17800
|
required: true
|
|
@@ -17704,7 +17824,7 @@ function buildCommand(program2) {
|
|
|
17704
17824
|
"-d, --dir <directory>",
|
|
17705
17825
|
"Component directory to build the components in"
|
|
17706
17826
|
).option("--all", "Build all components").option("--no-tailwind", "Skip Tailwind CSS building").option("--client-id <id>", "Client ID").option("--client-secret <secret>", "Client Secret").option("--site-url <url>", "Site URL").option("--verbose", "Enable verbose output").action(async (options) => {
|
|
17707
|
-
p9.intro("Drupal Canvas
|
|
17827
|
+
p9.intro(chalk2.bold("Drupal Canvas CLI: build"));
|
|
17708
17828
|
const allFlag = options.all || false;
|
|
17709
17829
|
const skipTailwind = !options.tailwind;
|
|
17710
17830
|
if (options.dir) setConfig({ componentDir: options.dir });
|
|
@@ -17762,7 +17882,7 @@ function buildCommand(program2) {
|
|
|
17762
17882
|
}
|
|
17763
17883
|
function downloadCommand(program2) {
|
|
17764
17884
|
program2.command("download").description("download components to your local filesystem").option("--client-id <id>", "Client ID").option("--client-secret <secret>", "Client Secret").option("--site-url <url>", "Site URL").option("--scope <scope>", "Scope").option("-d, --dir <directory>", "Component directory").option("-c, --component <name>", "Specific component to download").option("--all", "Download all components").option("--verbose", "Enable verbose output").action(async (options) => {
|
|
17765
|
-
p9.intro("Drupal Canvas
|
|
17885
|
+
p9.intro(chalk2.bold("Drupal Canvas CLI: download"));
|
|
17766
17886
|
try {
|
|
17767
17887
|
if (options.clientId) setConfig({ clientId: options.clientId });
|
|
17768
17888
|
if (options.clientSecret)
|
|
@@ -17851,7 +17971,7 @@ function downloadCommand(program2) {
|
|
|
17851
17971
|
for (const key in componentsToDownload) {
|
|
17852
17972
|
const component = componentsToDownload[key];
|
|
17853
17973
|
try {
|
|
17854
|
-
const componentDir =
|
|
17974
|
+
const componentDir = path11.join(
|
|
17855
17975
|
config2.componentDir,
|
|
17856
17976
|
component.machineName
|
|
17857
17977
|
);
|
|
@@ -17882,20 +18002,20 @@ function downloadCommand(program2) {
|
|
|
17882
18002
|
slots: component.slots || {}
|
|
17883
18003
|
};
|
|
17884
18004
|
await fs2.writeFile(
|
|
17885
|
-
|
|
18005
|
+
path11.join(componentDir, `component.yml`),
|
|
17886
18006
|
yaml__default.dump(metadata),
|
|
17887
18007
|
"utf-8"
|
|
17888
18008
|
);
|
|
17889
18009
|
if (component.sourceCodeJs) {
|
|
17890
18010
|
await fs2.writeFile(
|
|
17891
|
-
|
|
18011
|
+
path11.join(componentDir, `index.jsx`),
|
|
17892
18012
|
component.sourceCodeJs,
|
|
17893
18013
|
"utf-8"
|
|
17894
18014
|
);
|
|
17895
18015
|
}
|
|
17896
18016
|
if (component.sourceCodeCss) {
|
|
17897
18017
|
await fs2.writeFile(
|
|
17898
|
-
|
|
18018
|
+
path11.join(componentDir, `index.css`),
|
|
17899
18019
|
component.sourceCodeCss,
|
|
17900
18020
|
"utf-8"
|
|
17901
18021
|
);
|
|
@@ -17925,7 +18045,7 @@ function downloadCommand(program2) {
|
|
|
17925
18045
|
if (globalCss) {
|
|
17926
18046
|
let globalCssResult;
|
|
17927
18047
|
try {
|
|
17928
|
-
const globalCssPath =
|
|
18048
|
+
const globalCssPath = path11.join(config2.componentDir, "global.css");
|
|
17929
18049
|
await fs2.writeFile(globalCssPath, globalCss, "utf-8");
|
|
17930
18050
|
globalCssResult = {
|
|
17931
18051
|
itemName: "global.css",
|
|
@@ -17964,7 +18084,7 @@ function scaffoldCommand(program2) {
|
|
|
17964
18084
|
"-d, --dir <directory>",
|
|
17965
18085
|
"Component directory to create component in"
|
|
17966
18086
|
).option("--verbose", "Enable verbose output").action(async (options) => {
|
|
17967
|
-
p9.intro("Drupal Canvas
|
|
18087
|
+
p9.intro(chalk2.bold("Drupal Canvas CLI: scaffold"));
|
|
17968
18088
|
try {
|
|
17969
18089
|
if (options.dir) setConfig({ componentDir: options.dir });
|
|
17970
18090
|
if (options.verbose) setConfig({ verbose: options.verbose });
|
|
@@ -17988,13 +18108,13 @@ function scaffoldCommand(program2) {
|
|
|
17988
18108
|
}
|
|
17989
18109
|
componentName = name;
|
|
17990
18110
|
}
|
|
17991
|
-
const componentDir =
|
|
18111
|
+
const componentDir = path11.join(baseDir, componentName);
|
|
17992
18112
|
const s = p9.spinner();
|
|
17993
18113
|
s.start(`Creating component "${componentName}"`);
|
|
17994
18114
|
try {
|
|
17995
18115
|
await fs2.mkdir(componentDir, { recursive: true });
|
|
17996
|
-
const templateDir =
|
|
17997
|
-
|
|
18116
|
+
const templateDir = path11.join(
|
|
18117
|
+
path11.dirname(new URL(import.meta.url).pathname),
|
|
17998
18118
|
"templates/hello-world"
|
|
17999
18119
|
);
|
|
18000
18120
|
const files = await fs2.readdir(templateDir);
|
|
@@ -18010,8 +18130,8 @@ function scaffoldCommand(program2) {
|
|
|
18010
18130
|
}
|
|
18011
18131
|
}
|
|
18012
18132
|
for (const file of files) {
|
|
18013
|
-
const srcPath =
|
|
18014
|
-
const destPath =
|
|
18133
|
+
const srcPath = path11.join(templateDir, file);
|
|
18134
|
+
const destPath = path11.join(componentDir, file);
|
|
18015
18135
|
let content = await fs2.readFile(srcPath, "utf-8");
|
|
18016
18136
|
const { pascalCaseName, className, displayName, machineName } = generateComponentNameFormats(componentName);
|
|
18017
18137
|
content = content.replace(/HelloWorld/g, pascalCaseName).replace(/hello-world-component/g, className).replace(/Hello World/g, displayName).replace(/hello_world/g, machineName);
|
|
@@ -18020,9 +18140,9 @@ function scaffoldCommand(program2) {
|
|
|
18020
18140
|
s.stop(chalk2.green(`Created component "${componentName}"`));
|
|
18021
18141
|
p9.note(`Component "${componentName}" has been created:
|
|
18022
18142
|
- Directory: ${componentDir}
|
|
18023
|
-
- Component metadata: ${
|
|
18024
|
-
- Source file: ${
|
|
18025
|
-
- CSS file: ${
|
|
18143
|
+
- Component metadata: ${path11.join(componentDir, `component.yml`)}
|
|
18144
|
+
- Source file: ${path11.join(componentDir, `index.jsx`)}
|
|
18145
|
+
- CSS file: ${path11.join(componentDir, `index.css`)}`);
|
|
18026
18146
|
p9.outro("\u{1F3D7}\uFE0F Scaffold command completed");
|
|
18027
18147
|
} catch (error) {
|
|
18028
18148
|
s.stop(chalk2.red(`Failed to create component "${componentName}"`));
|
|
@@ -18100,20 +18220,20 @@ var getDataDependenciesFromAst = (ast) => ast.program.body.filter((d2) => d2.typ
|
|
|
18100
18220
|
async function processComponentFiles(componentDir) {
|
|
18101
18221
|
const metadataPath = await findMetadataPath(componentDir);
|
|
18102
18222
|
const metadata = await readComponentMetadata(metadataPath);
|
|
18103
|
-
const distDir =
|
|
18223
|
+
const distDir = path11.join(componentDir, "dist");
|
|
18104
18224
|
const sourceCodeJs = await promises.readFile(
|
|
18105
|
-
|
|
18225
|
+
path11.join(componentDir, "index.jsx"),
|
|
18106
18226
|
"utf-8"
|
|
18107
18227
|
);
|
|
18108
|
-
const compiledJs = await promises.readFile(
|
|
18228
|
+
const compiledJs = await promises.readFile(path11.join(distDir, "index.js"), "utf-8");
|
|
18109
18229
|
let sourceCodeCss = "";
|
|
18110
18230
|
let compiledCss = "";
|
|
18111
18231
|
try {
|
|
18112
18232
|
sourceCodeCss = await promises.readFile(
|
|
18113
|
-
|
|
18233
|
+
path11.join(componentDir, "index.css"),
|
|
18114
18234
|
"utf-8"
|
|
18115
18235
|
);
|
|
18116
|
-
compiledCss = await promises.readFile(
|
|
18236
|
+
compiledCss = await promises.readFile(path11.join(distDir, "index.css"), "utf-8");
|
|
18117
18237
|
} catch {
|
|
18118
18238
|
}
|
|
18119
18239
|
return {
|
|
@@ -18125,7 +18245,7 @@ async function processComponentFiles(componentDir) {
|
|
|
18125
18245
|
};
|
|
18126
18246
|
}
|
|
18127
18247
|
async function findMetadataPath(componentDir) {
|
|
18128
|
-
const metadataPath =
|
|
18248
|
+
const metadataPath = path11.join(componentDir, "component.yml");
|
|
18129
18249
|
try {
|
|
18130
18250
|
await promises.access(metadataPath);
|
|
18131
18251
|
return metadataPath;
|
|
@@ -18146,10 +18266,10 @@ async function readComponentMetadata(filePath) {
|
|
|
18146
18266
|
}
|
|
18147
18267
|
const metadata = rawMetadata;
|
|
18148
18268
|
if (!metadata.name) {
|
|
18149
|
-
metadata.name =
|
|
18269
|
+
metadata.name = path11.basename(path11.dirname(filePath));
|
|
18150
18270
|
}
|
|
18151
18271
|
if (!metadata.machineName) {
|
|
18152
|
-
metadata.machineName =
|
|
18272
|
+
metadata.machineName = path11.basename(path11.dirname(filePath));
|
|
18153
18273
|
}
|
|
18154
18274
|
if (!metadata.slots || typeof metadata.slots !== "object") {
|
|
18155
18275
|
metadata.slots = {};
|
|
@@ -18193,13 +18313,134 @@ function createComponentPayload(params) {
|
|
|
18193
18313
|
};
|
|
18194
18314
|
}
|
|
18195
18315
|
|
|
18316
|
+
// src/utils/request-pool.ts
|
|
18317
|
+
async function processInPool(items, processor, concurrency = 10) {
|
|
18318
|
+
const results = [];
|
|
18319
|
+
for (let i = 0; i < items.length; i += concurrency) {
|
|
18320
|
+
const batch = items.slice(i, i + concurrency);
|
|
18321
|
+
const batchStartIndex = i;
|
|
18322
|
+
const batchPromises = batch.map(async (item, batchIndex) => {
|
|
18323
|
+
const globalIndex = batchStartIndex + batchIndex;
|
|
18324
|
+
try {
|
|
18325
|
+
const result = await processor(item, globalIndex);
|
|
18326
|
+
return { success: true, result, index: globalIndex };
|
|
18327
|
+
} catch (error) {
|
|
18328
|
+
return {
|
|
18329
|
+
success: false,
|
|
18330
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
18331
|
+
index: globalIndex
|
|
18332
|
+
};
|
|
18333
|
+
}
|
|
18334
|
+
});
|
|
18335
|
+
const batchResults = await Promise.allSettled(batchPromises);
|
|
18336
|
+
for (const settledResult of batchResults) {
|
|
18337
|
+
if (settledResult.status === "fulfilled") {
|
|
18338
|
+
results.push(settledResult.value);
|
|
18339
|
+
} else {
|
|
18340
|
+
results.push({
|
|
18341
|
+
success: false,
|
|
18342
|
+
error: new Error(`Batch processing failed: ${settledResult.reason}`),
|
|
18343
|
+
index: results.length
|
|
18344
|
+
});
|
|
18345
|
+
}
|
|
18346
|
+
}
|
|
18347
|
+
}
|
|
18348
|
+
return results.sort((a, b) => a.index - b.index);
|
|
18349
|
+
}
|
|
18350
|
+
function createProgressCallback(spinner5, operation, total) {
|
|
18351
|
+
let completed = 0;
|
|
18352
|
+
return () => {
|
|
18353
|
+
completed++;
|
|
18354
|
+
const percentage = Math.round(completed / total * 100);
|
|
18355
|
+
spinner5.message(`${operation} (${completed}/${total} - ${percentage}%)`);
|
|
18356
|
+
};
|
|
18357
|
+
}
|
|
18358
|
+
|
|
18196
18359
|
// src/commands/upload.ts
|
|
18360
|
+
async function checkComponentsExist(machineNames, apiService, onProgress) {
|
|
18361
|
+
try {
|
|
18362
|
+
const existingComponents = await apiService.listComponents();
|
|
18363
|
+
const existingMachineNames = new Set(Object.keys(existingComponents));
|
|
18364
|
+
return machineNames.map((machineName) => {
|
|
18365
|
+
onProgress();
|
|
18366
|
+
return {
|
|
18367
|
+
machineName,
|
|
18368
|
+
exists: existingMachineNames.has(machineName)
|
|
18369
|
+
};
|
|
18370
|
+
});
|
|
18371
|
+
} catch (error) {
|
|
18372
|
+
return machineNames.map((machineName) => {
|
|
18373
|
+
onProgress();
|
|
18374
|
+
return {
|
|
18375
|
+
machineName,
|
|
18376
|
+
exists: false,
|
|
18377
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
18378
|
+
};
|
|
18379
|
+
});
|
|
18380
|
+
}
|
|
18381
|
+
}
|
|
18382
|
+
async function uploadComponents(uploadTasks, apiService, onProgress) {
|
|
18383
|
+
const results = await processInPool(uploadTasks, async (task) => {
|
|
18384
|
+
try {
|
|
18385
|
+
if (task.shouldUpdate) {
|
|
18386
|
+
await apiService.updateComponent(
|
|
18387
|
+
task.machineName,
|
|
18388
|
+
task.componentPayload
|
|
18389
|
+
);
|
|
18390
|
+
} else {
|
|
18391
|
+
await apiService.createComponent(task.componentPayload, true);
|
|
18392
|
+
}
|
|
18393
|
+
onProgress?.();
|
|
18394
|
+
return {
|
|
18395
|
+
machineName: task.machineName,
|
|
18396
|
+
success: true,
|
|
18397
|
+
operation: task.shouldUpdate ? "update" : "create"
|
|
18398
|
+
};
|
|
18399
|
+
} catch {
|
|
18400
|
+
try {
|
|
18401
|
+
if (task.shouldUpdate) {
|
|
18402
|
+
await apiService.updateComponent(
|
|
18403
|
+
task.machineName,
|
|
18404
|
+
task.componentPayload
|
|
18405
|
+
);
|
|
18406
|
+
} else {
|
|
18407
|
+
await apiService.createComponent(task.componentPayload);
|
|
18408
|
+
}
|
|
18409
|
+
onProgress?.();
|
|
18410
|
+
return {
|
|
18411
|
+
machineName: task.machineName,
|
|
18412
|
+
success: true,
|
|
18413
|
+
operation: task.shouldUpdate ? "update" : "create"
|
|
18414
|
+
};
|
|
18415
|
+
} catch (fallbackError) {
|
|
18416
|
+
onProgress?.();
|
|
18417
|
+
return {
|
|
18418
|
+
machineName: task.machineName,
|
|
18419
|
+
success: false,
|
|
18420
|
+
operation: task.shouldUpdate ? "update" : "create",
|
|
18421
|
+
error: fallbackError instanceof Error ? fallbackError : new Error(String(fallbackError))
|
|
18422
|
+
};
|
|
18423
|
+
}
|
|
18424
|
+
}
|
|
18425
|
+
});
|
|
18426
|
+
return results.map((result) => {
|
|
18427
|
+
if (result.success && result.result) {
|
|
18428
|
+
return result.result;
|
|
18429
|
+
}
|
|
18430
|
+
return {
|
|
18431
|
+
machineName: uploadTasks[result.index]?.machineName || "unknown",
|
|
18432
|
+
success: false,
|
|
18433
|
+
operation: "create",
|
|
18434
|
+
error: result.error || new Error("Unknown error during upload")
|
|
18435
|
+
};
|
|
18436
|
+
});
|
|
18437
|
+
}
|
|
18197
18438
|
function uploadCommand(program2) {
|
|
18198
18439
|
program2.command("upload").description("build and upload local components and global CSS assets").option("--client-id <id>", "Client ID").option("--client-secret <secret>", "Client Secret").option("--site-url <url>", "Site URL").option("--scope <scope>", "Scope").option("-d, --dir <directory>", "Component directory").option("--all", "Upload all components").option("--verbose", "Verbose output").option("--no-tailwind", "Skip Tailwind CSS building").action(async (options) => {
|
|
18199
18440
|
const allFlag = options.all || false;
|
|
18200
18441
|
const skipTailwind = !options.tailwind;
|
|
18201
18442
|
try {
|
|
18202
|
-
p9.intro("Drupal Canvas
|
|
18443
|
+
p9.intro(chalk2.bold("Drupal Canvas CLI: upload"));
|
|
18203
18444
|
if (options.clientId) setConfig({ clientId: options.clientId });
|
|
18204
18445
|
if (options.clientSecret)
|
|
18205
18446
|
setConfig({ clientSecret: options.clientSecret });
|
|
@@ -18267,24 +18508,16 @@ function uploadCommand(program2) {
|
|
|
18267
18508
|
}
|
|
18268
18509
|
});
|
|
18269
18510
|
}
|
|
18270
|
-
async function
|
|
18271
|
-
const
|
|
18272
|
-
const
|
|
18273
|
-
const successfulBuilds = buildResults.filter((build) => build.success);
|
|
18274
|
-
const failedBuilds = buildResults.filter((build) => !build.success);
|
|
18275
|
-
if (successfulBuilds.length === 0) {
|
|
18276
|
-
const message = "All component builds failed.";
|
|
18277
|
-
p9.note(chalk2.red(message));
|
|
18278
|
-
}
|
|
18279
|
-
const spinner5 = p9.spinner();
|
|
18280
|
-
spinner5.start("Uploading components");
|
|
18511
|
+
async function prepareComponentsForUpload(successfulBuilds, componentsToUpload) {
|
|
18512
|
+
const prepared = [];
|
|
18513
|
+
const failed = [];
|
|
18281
18514
|
for (const buildResult of successfulBuilds) {
|
|
18282
18515
|
const dir = buildResult.itemName ? componentsToUpload.find(
|
|
18283
|
-
(d2) =>
|
|
18516
|
+
(d2) => path11.basename(d2) === buildResult.itemName
|
|
18284
18517
|
) : void 0;
|
|
18285
18518
|
if (!dir) continue;
|
|
18286
18519
|
try {
|
|
18287
|
-
const componentName =
|
|
18520
|
+
const componentName = path11.basename(dir);
|
|
18288
18521
|
const { sourceCodeJs, compiledJs, sourceCodeCss, compiledCss, metadata } = await processComponentFiles(dir);
|
|
18289
18522
|
if (!metadata) {
|
|
18290
18523
|
throw new Error("Invalid metadata file");
|
|
@@ -18315,42 +18548,95 @@ async function getBuildAndUploadResults(componentsToUpload, apiService) {
|
|
|
18315
18548
|
dataDependencies
|
|
18316
18549
|
};
|
|
18317
18550
|
const componentPayload = createComponentPayload(componentPayloadArg);
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18551
|
+
prepared.push({
|
|
18552
|
+
machineName,
|
|
18553
|
+
componentName,
|
|
18554
|
+
componentPayload,
|
|
18555
|
+
dir,
|
|
18556
|
+
buildResult
|
|
18557
|
+
});
|
|
18558
|
+
} catch (error) {
|
|
18559
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
18560
|
+
failed.push({
|
|
18561
|
+
itemName: buildResult.itemName,
|
|
18562
|
+
success: false,
|
|
18563
|
+
details: [
|
|
18564
|
+
{
|
|
18565
|
+
content: errorMessage
|
|
18566
|
+
}
|
|
18567
|
+
]
|
|
18568
|
+
});
|
|
18569
|
+
}
|
|
18570
|
+
}
|
|
18571
|
+
return { prepared, failed };
|
|
18572
|
+
}
|
|
18573
|
+
async function getBuildAndUploadResults(componentsToUpload, apiService) {
|
|
18574
|
+
const results = [];
|
|
18575
|
+
const spinner5 = p9.spinner();
|
|
18576
|
+
spinner5.start("Building components");
|
|
18577
|
+
const buildResults = await buildSelectedComponents(componentsToUpload);
|
|
18578
|
+
const successfulBuilds = buildResults.filter((build) => build.success);
|
|
18579
|
+
const failedBuilds = buildResults.filter((build) => !build.success);
|
|
18580
|
+
if (successfulBuilds.length === 0) {
|
|
18581
|
+
const message = "All component builds failed.";
|
|
18582
|
+
spinner5.stop(chalk2.red(message));
|
|
18583
|
+
return failedBuilds;
|
|
18584
|
+
}
|
|
18585
|
+
spinner5.message("Preparing components for upload");
|
|
18586
|
+
const { prepared: preparedComponents, failed: preparationFailures } = await prepareComponentsForUpload(successfulBuilds, componentsToUpload);
|
|
18587
|
+
results.push(...preparationFailures);
|
|
18588
|
+
if (preparedComponents.length === 0) {
|
|
18589
|
+
spinner5.stop(chalk2.red("All component preparations failed"));
|
|
18590
|
+
return [...results, ...failedBuilds];
|
|
18591
|
+
}
|
|
18592
|
+
const machineNames = preparedComponents.map((c) => c.machineName);
|
|
18593
|
+
const existenceProgress = createProgressCallback(
|
|
18594
|
+
spinner5,
|
|
18595
|
+
"Checking component existence",
|
|
18596
|
+
machineNames.length
|
|
18597
|
+
);
|
|
18598
|
+
spinner5.message("Checking component existence");
|
|
18599
|
+
const existenceResults = await checkComponentsExist(
|
|
18600
|
+
machineNames,
|
|
18601
|
+
apiService,
|
|
18602
|
+
existenceProgress
|
|
18603
|
+
);
|
|
18604
|
+
const uploadTasks = preparedComponents.map((component, index) => ({
|
|
18605
|
+
machineName: component.machineName,
|
|
18606
|
+
componentPayload: component.componentPayload,
|
|
18607
|
+
shouldUpdate: existenceResults[index]?.exists || false
|
|
18608
|
+
}));
|
|
18609
|
+
const uploadProgress = createProgressCallback(
|
|
18610
|
+
spinner5,
|
|
18611
|
+
"Uploading components",
|
|
18612
|
+
uploadTasks.length
|
|
18613
|
+
);
|
|
18614
|
+
spinner5.message("Uploading components");
|
|
18615
|
+
const uploadResults = await uploadComponents(
|
|
18616
|
+
uploadTasks,
|
|
18617
|
+
apiService,
|
|
18618
|
+
uploadProgress
|
|
18619
|
+
);
|
|
18620
|
+
for (let i = 0; i < preparedComponents.length; i++) {
|
|
18621
|
+
const component = preparedComponents[i];
|
|
18622
|
+
const uploadResult = uploadResults[i];
|
|
18623
|
+
if (uploadResult.success) {
|
|
18337
18624
|
results.push({
|
|
18338
|
-
itemName: componentName,
|
|
18625
|
+
itemName: component.componentName,
|
|
18339
18626
|
success: true,
|
|
18340
18627
|
details: [
|
|
18341
18628
|
{
|
|
18342
|
-
content:
|
|
18629
|
+
content: uploadResult.operation === "update" ? "Updated" : "Created"
|
|
18343
18630
|
}
|
|
18344
18631
|
]
|
|
18345
18632
|
});
|
|
18346
|
-
}
|
|
18347
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
18633
|
+
} else {
|
|
18348
18634
|
results.push({
|
|
18349
|
-
itemName:
|
|
18635
|
+
itemName: component.componentName,
|
|
18350
18636
|
success: false,
|
|
18351
18637
|
details: [
|
|
18352
18638
|
{
|
|
18353
|
-
content:
|
|
18639
|
+
content: uploadResult.error?.message || "Unknown upload error"
|
|
18354
18640
|
}
|
|
18355
18641
|
]
|
|
18356
18642
|
});
|
|
@@ -18372,16 +18658,16 @@ async function buildSelectedComponents(componentDirs) {
|
|
|
18372
18658
|
}
|
|
18373
18659
|
async function uploadGlobalAssetLibrary(apiService, componentDir) {
|
|
18374
18660
|
try {
|
|
18375
|
-
const distDir =
|
|
18376
|
-
const globalCompiledCssPath =
|
|
18661
|
+
const distDir = path11.join(componentDir, "dist");
|
|
18662
|
+
const globalCompiledCssPath = path11.join(distDir, "index.css");
|
|
18377
18663
|
const globalCompiledCssExists = await fileExists(globalCompiledCssPath);
|
|
18378
18664
|
if (globalCompiledCssExists) {
|
|
18379
18665
|
const globalCompiledCss = await fs2.readFile(
|
|
18380
|
-
|
|
18666
|
+
path11.join(distDir, "index.css"),
|
|
18381
18667
|
"utf-8"
|
|
18382
18668
|
);
|
|
18383
18669
|
const classNameCandidateIndexFile = await fs2.readFile(
|
|
18384
|
-
|
|
18670
|
+
path11.join(distDir, "index.js"),
|
|
18385
18671
|
"utf-8"
|
|
18386
18672
|
);
|
|
18387
18673
|
const current = await apiService.getGlobalAssetLibrary();
|
|
@@ -18424,15 +18710,49 @@ async function uploadGlobalAssetLibrary(apiService, componentDir) {
|
|
|
18424
18710
|
};
|
|
18425
18711
|
}
|
|
18426
18712
|
}
|
|
18713
|
+
function validateCommand(program2) {
|
|
18714
|
+
program2.command("validate").description("validate local components").option(
|
|
18715
|
+
"-d, --dir <directory>",
|
|
18716
|
+
"Component directory to validate the components in"
|
|
18717
|
+
).option("--all", "Validate all components").option("--verbose", "Enable verbose output").option(
|
|
18718
|
+
"--fix",
|
|
18719
|
+
"Apply available automatic fixes for linting issues",
|
|
18720
|
+
false
|
|
18721
|
+
).action(async (options) => {
|
|
18722
|
+
p9.intro(chalk2.bold("Drupal Canvas CLI: validate"));
|
|
18723
|
+
const allFlag = options.all || false;
|
|
18724
|
+
if (options.dir) setConfig({ componentDir: options.dir });
|
|
18725
|
+
if (options.verbose) setConfig({ verbose: true });
|
|
18726
|
+
const selectedComponents = await selectLocalComponents(
|
|
18727
|
+
allFlag,
|
|
18728
|
+
"Select components to validate"
|
|
18729
|
+
);
|
|
18730
|
+
if (!selectedComponents || selectedComponents.length === 0) {
|
|
18731
|
+
return;
|
|
18732
|
+
}
|
|
18733
|
+
const results = [];
|
|
18734
|
+
for (const componentDir of selectedComponents) {
|
|
18735
|
+
results.push(await validateComponent(componentDir, options.fix));
|
|
18736
|
+
}
|
|
18737
|
+
reportResults(results, "Validation results");
|
|
18738
|
+
const hasErrors = results.some((r) => !r.success);
|
|
18739
|
+
if (hasErrors) {
|
|
18740
|
+
p9.outro(`\u274C Validation completed with errors`);
|
|
18741
|
+
process.exit(1);
|
|
18742
|
+
}
|
|
18743
|
+
p9.outro(`\u2705 Validation completed`);
|
|
18744
|
+
});
|
|
18745
|
+
}
|
|
18427
18746
|
|
|
18428
18747
|
// src/index.ts
|
|
18429
18748
|
var version = package_default.version;
|
|
18430
18749
|
var program = new Command();
|
|
18431
|
-
program.name("canvas").description("CLI tool for managing Drupal Canvas code components").version(version
|
|
18750
|
+
program.name("canvas").description("CLI tool for managing Drupal Canvas code components").version(version);
|
|
18432
18751
|
downloadCommand(program);
|
|
18433
18752
|
scaffoldCommand(program);
|
|
18434
18753
|
uploadCommand(program);
|
|
18435
18754
|
buildCommand(program);
|
|
18755
|
+
validateCommand(program);
|
|
18436
18756
|
program.showHelpAfterError();
|
|
18437
18757
|
program.showSuggestionAfterError(true);
|
|
18438
18758
|
try {
|
|
@@ -18443,3 +18763,5 @@ try {
|
|
|
18443
18763
|
process.exit(1);
|
|
18444
18764
|
}
|
|
18445
18765
|
}
|
|
18766
|
+
//# sourceMappingURL=index.js.map
|
|
18767
|
+
//# sourceMappingURL=index.js.map
|