@nuasite/cli 0.51.0 → 0.53.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/README.md +25 -3
- package/dist/index.js +1290 -473
- package/dist/types/check-code.d.ts +19 -0
- package/dist/types/check-code.d.ts.map +1 -0
- package/dist/types/check.d.ts +11 -0
- package/dist/types/check.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -3
- package/src/check-code.ts +133 -0
- package/src/check.ts +72 -9
- package/src/index.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -22648,7 +22648,8 @@ function formatCheckReport(report) {
|
|
|
22648
22648
|
for (const [file, findings] of byFile) {
|
|
22649
22649
|
lines.push(file);
|
|
22650
22650
|
for (const finding of findings) {
|
|
22651
|
-
|
|
22651
|
+
const at = finding.line === undefined ? "" : `${finding.line}:${finding.column ?? 0}`;
|
|
22652
|
+
lines.push(` ${at.padEnd(8)}${(finding.severity === "error" ? "error" : "warn").padEnd(6)} ${finding.message} [${finding.code}]`);
|
|
22652
22653
|
}
|
|
22653
22654
|
}
|
|
22654
22655
|
return lines.join(`
|
|
@@ -23826,40 +23827,878 @@ var init_src2 = __esm(() => {
|
|
|
23826
23827
|
init_project_config_ast();
|
|
23827
23828
|
});
|
|
23828
23829
|
|
|
23830
|
+
// ../../node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js
|
|
23831
|
+
import g from "crypto";
|
|
23832
|
+
import _ from "fs";
|
|
23833
|
+
import { TextDecoder as b, TextEncoder as v } from "util";
|
|
23834
|
+
var y, w, d = class {
|
|
23835
|
+
constructor() {
|
|
23836
|
+
this.argv = ["js"], this.env = {}, this.exit = (t) => {
|
|
23837
|
+
t !== 0 && console.warn("exit code:", t);
|
|
23838
|
+
}, this._exitPromise = new Promise((t) => {
|
|
23839
|
+
this._resolveExitPromise = t;
|
|
23840
|
+
}), this._pendingEvent = null, this._scheduledTimeouts = new Map, this._nextCallbackTimeoutID = 1;
|
|
23841
|
+
let o = (t, e) => {
|
|
23842
|
+
this.mem.setUint32(t + 0, e, true), this.mem.setUint32(t + 4, Math.floor(e / 4294967296), true);
|
|
23843
|
+
}, n = (t) => {
|
|
23844
|
+
let e = this.mem.getUint32(t + 0, true), s = this.mem.getInt32(t + 4, true);
|
|
23845
|
+
return e + s * 4294967296;
|
|
23846
|
+
}, r = (t) => {
|
|
23847
|
+
let e = this.mem.getFloat64(t, true);
|
|
23848
|
+
if (e === 0)
|
|
23849
|
+
return;
|
|
23850
|
+
if (!isNaN(e))
|
|
23851
|
+
return e;
|
|
23852
|
+
let s = this.mem.getUint32(t, true);
|
|
23853
|
+
return this._values[s];
|
|
23854
|
+
}, l = (t, e) => {
|
|
23855
|
+
if (typeof e == "number" && e !== 0) {
|
|
23856
|
+
if (isNaN(e)) {
|
|
23857
|
+
this.mem.setUint32(t + 4, 2146959360, true), this.mem.setUint32(t, 0, true);
|
|
23858
|
+
return;
|
|
23859
|
+
}
|
|
23860
|
+
this.mem.setFloat64(t, e, true);
|
|
23861
|
+
return;
|
|
23862
|
+
}
|
|
23863
|
+
if (e === undefined) {
|
|
23864
|
+
this.mem.setFloat64(t, 0, true);
|
|
23865
|
+
return;
|
|
23866
|
+
}
|
|
23867
|
+
let i = this._ids.get(e);
|
|
23868
|
+
i === undefined && (i = this._idPool.pop(), i === undefined && (i = this._values.length), this._values[i] = e, this._goRefCounts[i] = 0, this._ids.set(e, i)), this._goRefCounts[i]++;
|
|
23869
|
+
let a = 0;
|
|
23870
|
+
switch (typeof e) {
|
|
23871
|
+
case "object":
|
|
23872
|
+
e !== null && (a = 1);
|
|
23873
|
+
break;
|
|
23874
|
+
case "string":
|
|
23875
|
+
a = 2;
|
|
23876
|
+
break;
|
|
23877
|
+
case "symbol":
|
|
23878
|
+
a = 3;
|
|
23879
|
+
break;
|
|
23880
|
+
case "function":
|
|
23881
|
+
a = 4;
|
|
23882
|
+
break;
|
|
23883
|
+
}
|
|
23884
|
+
this.mem.setUint32(t + 4, 2146959360 | a, true), this.mem.setUint32(t, i, true);
|
|
23885
|
+
}, c = (t) => {
|
|
23886
|
+
let e = n(t + 0), s = n(t + 8);
|
|
23887
|
+
return new Uint8Array(this._inst.exports.mem.buffer, e, s);
|
|
23888
|
+
}, f = (t) => {
|
|
23889
|
+
let e = n(t + 0), s = n(t + 8), i = new Array(s);
|
|
23890
|
+
for (let a = 0;a < s; a++)
|
|
23891
|
+
i[a] = r(e + a * 8);
|
|
23892
|
+
return i;
|
|
23893
|
+
}, u = (t) => {
|
|
23894
|
+
let e = n(t + 0), s = n(t + 8);
|
|
23895
|
+
return w.decode(new DataView(this._inst.exports.mem.buffer, e, s));
|
|
23896
|
+
}, h = Date.now() - performance.now();
|
|
23897
|
+
this.importObject = { gojs: { "runtime.wasmExit": (t) => {
|
|
23898
|
+
t >>>= 0;
|
|
23899
|
+
let e = this.mem.getInt32(t + 8, true);
|
|
23900
|
+
this.exited = true, delete this._inst, delete this._values, delete this._goRefCounts, delete this._ids, delete this._idPool, this.exit(e);
|
|
23901
|
+
}, "runtime.wasmWrite": (t) => {
|
|
23902
|
+
t >>>= 0;
|
|
23903
|
+
let e = n(t + 8), s = n(t + 16), i = this.mem.getInt32(t + 24, true);
|
|
23904
|
+
_.writeSync(e, new Uint8Array(this._inst.exports.mem.buffer, s, i));
|
|
23905
|
+
}, "runtime.resetMemoryDataView": (t) => {
|
|
23906
|
+
t >>>= 0, this.mem = new DataView(this._inst.exports.mem.buffer);
|
|
23907
|
+
}, "runtime.nanotime1": (t) => {
|
|
23908
|
+
t >>>= 0, o(t + 8, (h + performance.now()) * 1e6);
|
|
23909
|
+
}, "runtime.walltime": (t) => {
|
|
23910
|
+
t >>>= 0;
|
|
23911
|
+
let e = new Date().getTime();
|
|
23912
|
+
o(t + 8, e / 1000), this.mem.setInt32(t + 16, e % 1000 * 1e6, true);
|
|
23913
|
+
}, "runtime.scheduleTimeoutEvent": (t) => {
|
|
23914
|
+
t >>>= 0;
|
|
23915
|
+
let e = this._nextCallbackTimeoutID;
|
|
23916
|
+
this._nextCallbackTimeoutID++, this._scheduledTimeouts.set(e, setTimeout(() => {
|
|
23917
|
+
for (this._resume();this._scheduledTimeouts.has(e); )
|
|
23918
|
+
console.warn("scheduleTimeoutEvent: missed timeout event"), this._resume();
|
|
23919
|
+
}, n(t + 8) + 1)), this.mem.setInt32(t + 16, e, true);
|
|
23920
|
+
}, "runtime.clearTimeoutEvent": (t) => {
|
|
23921
|
+
t >>>= 0;
|
|
23922
|
+
let e = this.mem.getInt32(t + 8, true);
|
|
23923
|
+
clearTimeout(this._scheduledTimeouts.get(e)), this._scheduledTimeouts.delete(e);
|
|
23924
|
+
}, "runtime.getRandomData": (t) => {
|
|
23925
|
+
t >>>= 0, globalThis.crypto.getRandomValues(c(t + 8));
|
|
23926
|
+
}, "syscall/js.finalizeRef": (t) => {
|
|
23927
|
+
t >>>= 0;
|
|
23928
|
+
let e = this.mem.getUint32(t + 8, true);
|
|
23929
|
+
if (this._goRefCounts[e]--, this._goRefCounts[e] === 0) {
|
|
23930
|
+
let s = this._values[e];
|
|
23931
|
+
this._values[e] = null, this._ids.delete(s), this._idPool.push(e);
|
|
23932
|
+
}
|
|
23933
|
+
}, "syscall/js.stringVal": (t) => {
|
|
23934
|
+
t >>>= 0, l(t + 24, u(t + 8));
|
|
23935
|
+
}, "syscall/js.valueGet": (t) => {
|
|
23936
|
+
t >>>= 0;
|
|
23937
|
+
let e = Reflect.get(r(t + 8), u(t + 16));
|
|
23938
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 32, e);
|
|
23939
|
+
}, "syscall/js.valueSet": (t) => {
|
|
23940
|
+
t >>>= 0, Reflect.set(r(t + 8), u(t + 16), r(t + 32));
|
|
23941
|
+
}, "syscall/js.valueDelete": (t) => {
|
|
23942
|
+
t >>>= 0, Reflect.deleteProperty(r(t + 8), u(t + 16));
|
|
23943
|
+
}, "syscall/js.valueIndex": (t) => {
|
|
23944
|
+
t >>>= 0, l(t + 24, Reflect.get(r(t + 8), n(t + 16)));
|
|
23945
|
+
}, "syscall/js.valueSetIndex": (t) => {
|
|
23946
|
+
t >>>= 0, Reflect.set(r(t + 8), n(t + 16), r(t + 24));
|
|
23947
|
+
}, "syscall/js.valueCall": (t) => {
|
|
23948
|
+
t >>>= 0;
|
|
23949
|
+
try {
|
|
23950
|
+
let e = r(t + 8), s = Reflect.get(e, u(t + 16)), i = f(t + 32), a = Reflect.apply(s, e, i);
|
|
23951
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 56, a), this.mem.setUint8(t + 64, 1);
|
|
23952
|
+
} catch (e) {
|
|
23953
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 56, e), this.mem.setUint8(t + 64, 0);
|
|
23954
|
+
}
|
|
23955
|
+
}, "syscall/js.valueInvoke": (t) => {
|
|
23956
|
+
t >>>= 0;
|
|
23957
|
+
try {
|
|
23958
|
+
let e = r(t + 8), s = f(t + 16), i = Reflect.apply(e, undefined, s);
|
|
23959
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 40, i), this.mem.setUint8(t + 48, 1);
|
|
23960
|
+
} catch (e) {
|
|
23961
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 40, e), this.mem.setUint8(t + 48, 0);
|
|
23962
|
+
}
|
|
23963
|
+
}, "syscall/js.valueNew": (t) => {
|
|
23964
|
+
t >>>= 0;
|
|
23965
|
+
try {
|
|
23966
|
+
let e = r(t + 8), s = f(t + 16), i = Reflect.construct(e, s);
|
|
23967
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 40, i), this.mem.setUint8(t + 48, 1);
|
|
23968
|
+
} catch (e) {
|
|
23969
|
+
t = this._inst.exports.getsp() >>> 0, l(t + 40, e), this.mem.setUint8(t + 48, 0);
|
|
23970
|
+
}
|
|
23971
|
+
}, "syscall/js.valueLength": (t) => {
|
|
23972
|
+
t >>>= 0, o(t + 16, Number.parseInt(r(t + 8).length));
|
|
23973
|
+
}, "syscall/js.valuePrepareString": (t) => {
|
|
23974
|
+
t >>>= 0;
|
|
23975
|
+
let e = y.encode(String(r(t + 8)));
|
|
23976
|
+
l(t + 16, e), o(t + 24, e.length);
|
|
23977
|
+
}, "syscall/js.valueLoadString": (t) => {
|
|
23978
|
+
t >>>= 0;
|
|
23979
|
+
let e = r(t + 8);
|
|
23980
|
+
c(t + 16).set(e);
|
|
23981
|
+
}, "syscall/js.valueInstanceOf": (t) => {
|
|
23982
|
+
t >>>= 0, this.mem.setUint8(t + 24, r(t + 8) instanceof r(t + 16) ? 1 : 0);
|
|
23983
|
+
}, "syscall/js.copyBytesToGo": (t) => {
|
|
23984
|
+
t >>>= 0;
|
|
23985
|
+
let e = c(t + 8), s = r(t + 32);
|
|
23986
|
+
if (!(s instanceof Uint8Array || s instanceof Uint8ClampedArray)) {
|
|
23987
|
+
this.mem.setUint8(t + 48, 0);
|
|
23988
|
+
return;
|
|
23989
|
+
}
|
|
23990
|
+
let i = s.subarray(0, e.length);
|
|
23991
|
+
e.set(i), o(t + 40, i.length), this.mem.setUint8(t + 48, 1);
|
|
23992
|
+
}, "syscall/js.copyBytesToJS": (t) => {
|
|
23993
|
+
t >>>= 0;
|
|
23994
|
+
let e = r(t + 8), s = c(t + 16);
|
|
23995
|
+
if (!(e instanceof Uint8Array || e instanceof Uint8ClampedArray)) {
|
|
23996
|
+
this.mem.setUint8(t + 48, 0);
|
|
23997
|
+
return;
|
|
23998
|
+
}
|
|
23999
|
+
let i = s.subarray(0, e.length);
|
|
24000
|
+
e.set(i), o(t + 40, i.length), this.mem.setUint8(t + 48, 1);
|
|
24001
|
+
}, debug: (t) => {
|
|
24002
|
+
console.log(t);
|
|
24003
|
+
} } };
|
|
24004
|
+
}
|
|
24005
|
+
async run(o) {
|
|
24006
|
+
if (!(o instanceof WebAssembly.Instance))
|
|
24007
|
+
throw new Error("Go.run: WebAssembly.Instance expected");
|
|
24008
|
+
this._inst = o, this.mem = new DataView(this._inst.exports.mem.buffer), this._values = [Number.NaN, 0, null, true, false, globalThis, this], this._goRefCounts = new Array(this._values.length).fill(Number.POSITIVE_INFINITY), this._ids = new Map([[0, 1], [null, 2], [true, 3], [false, 4], [globalThis, 5], [this, 6]]), this._idPool = [], this.exited = false;
|
|
24009
|
+
let n = 4096, r = (h) => {
|
|
24010
|
+
let t = n, e = y.encode(`${h}\x00`);
|
|
24011
|
+
return new Uint8Array(this.mem.buffer, n, e.length).set(e), n += e.length, n % 8 !== 0 && (n += 8 - n % 8), t;
|
|
24012
|
+
}, l = this.argv.length, c = [];
|
|
24013
|
+
this.argv.forEach((h) => {
|
|
24014
|
+
c.push(r(h));
|
|
24015
|
+
}), c.push(0), Object.keys(this.env).sort().forEach((h) => {
|
|
24016
|
+
c.push(r(`${h}=${this.env[h]}`));
|
|
24017
|
+
}), c.push(0);
|
|
24018
|
+
let u = n;
|
|
24019
|
+
c.forEach((h) => {
|
|
24020
|
+
this.mem.setUint32(n, h, true), this.mem.setUint32(n + 4, 0, true), n += 8;
|
|
24021
|
+
}), this._inst.exports.run(l, u), this.exited && this._resolveExitPromise(), await this._exitPromise;
|
|
24022
|
+
}
|
|
24023
|
+
_resume() {
|
|
24024
|
+
if (this.exited)
|
|
24025
|
+
throw new Error("Go program has already exited");
|
|
24026
|
+
this._inst.exports.resume(), this.exited && this._resolveExitPromise();
|
|
24027
|
+
}
|
|
24028
|
+
_makeFuncWrapper(o) {
|
|
24029
|
+
let n = this;
|
|
24030
|
+
return function() {
|
|
24031
|
+
let r = { id: o, this: this, args: arguments };
|
|
24032
|
+
return n._pendingEvent = r, n._resume(), r.result;
|
|
24033
|
+
};
|
|
24034
|
+
}
|
|
24035
|
+
};
|
|
24036
|
+
var init_chunk_W5DTLHV4 = __esm(() => {
|
|
24037
|
+
globalThis.fs || Object.defineProperty(globalThis, "fs", { value: _ });
|
|
24038
|
+
globalThis.process || Object.defineProperties(globalThis, "process", { value: process });
|
|
24039
|
+
globalThis.crypto || Object.defineProperty(globalThis, "crypto", { value: g.webcrypto ? g.webcrypto : { getRandomValues(m) {
|
|
24040
|
+
return g.randomFillSync(m);
|
|
24041
|
+
} } });
|
|
24042
|
+
globalThis.performance || Object.defineProperty(globalThis, "performance", { value: { now() {
|
|
24043
|
+
let [m, o] = process.hrtime();
|
|
24044
|
+
return m * 1000 + o / 1e6;
|
|
24045
|
+
} } });
|
|
24046
|
+
y = new v("utf-8");
|
|
24047
|
+
w = new b("utf-8");
|
|
24048
|
+
});
|
|
24049
|
+
|
|
24050
|
+
// ../../node_modules/@astrojs/compiler/dist/node/index.js
|
|
24051
|
+
import { promises as m } from "fs";
|
|
24052
|
+
import { fileURLToPath as f } from "url";
|
|
24053
|
+
var w2 = async (t, s) => i().then((r) => r.transform(t, s)), n, i = () => (n || (n = d2().catch((t) => {
|
|
24054
|
+
throw n = undefined, t;
|
|
24055
|
+
})), n), y2 = async (t, s) => {
|
|
24056
|
+
let r;
|
|
24057
|
+
return r = await (async () => {
|
|
24058
|
+
let o = await m.readFile(t).then((e) => e.buffer);
|
|
24059
|
+
return WebAssembly.instantiate(new Uint8Array(o), s);
|
|
24060
|
+
})(), r;
|
|
24061
|
+
}, d2 = async () => {
|
|
24062
|
+
let t = new d, s = await y2(f(new URL("../astro.wasm", import.meta.url)), t.importObject);
|
|
24063
|
+
t.run(s.instance);
|
|
24064
|
+
let r = globalThis["@astrojs/compiler"];
|
|
24065
|
+
return { transform: (a, o) => new Promise((e) => {
|
|
24066
|
+
try {
|
|
24067
|
+
e(r.transform(a, o || {}));
|
|
24068
|
+
} catch (p) {
|
|
24069
|
+
throw n = undefined, p;
|
|
24070
|
+
}
|
|
24071
|
+
}), parse: (a, o) => new Promise((e) => e(r.parse(a, o || {}))).catch((e) => {
|
|
24072
|
+
throw n = undefined, e;
|
|
24073
|
+
}).then((e) => ({ ...e, ast: JSON.parse(e.ast) })), convertToTSX: (a, o) => new Promise((e) => e(r.convertToTSX(a, o || {}))).catch((e) => {
|
|
24074
|
+
throw n = undefined, e;
|
|
24075
|
+
}).then((e) => ({ ...e, map: JSON.parse(e.map) })) };
|
|
24076
|
+
};
|
|
24077
|
+
var init_node = __esm(() => {
|
|
24078
|
+
init_chunk_W5DTLHV4();
|
|
24079
|
+
});
|
|
24080
|
+
|
|
24081
|
+
// ../../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
24082
|
+
function decodeInteger(reader, relative) {
|
|
24083
|
+
let value = 0;
|
|
24084
|
+
let shift = 0;
|
|
24085
|
+
let integer = 0;
|
|
24086
|
+
do {
|
|
24087
|
+
const c = reader.next();
|
|
24088
|
+
integer = charToInt[c];
|
|
24089
|
+
value |= (integer & 31) << shift;
|
|
24090
|
+
shift += 5;
|
|
24091
|
+
} while (integer & 32);
|
|
24092
|
+
const shouldNegate = value & 1;
|
|
24093
|
+
value >>>= 1;
|
|
24094
|
+
if (shouldNegate) {
|
|
24095
|
+
value = -2147483648 | -value;
|
|
24096
|
+
}
|
|
24097
|
+
return relative + value;
|
|
24098
|
+
}
|
|
24099
|
+
function hasMoreVlq(reader, max) {
|
|
24100
|
+
if (reader.pos >= max)
|
|
24101
|
+
return false;
|
|
24102
|
+
return reader.peek() !== comma;
|
|
24103
|
+
}
|
|
24104
|
+
function decode(mappings) {
|
|
24105
|
+
const { length } = mappings;
|
|
24106
|
+
const reader = new StringReader(mappings);
|
|
24107
|
+
const decoded = [];
|
|
24108
|
+
let genColumn = 0;
|
|
24109
|
+
let sourcesIndex = 0;
|
|
24110
|
+
let sourceLine = 0;
|
|
24111
|
+
let sourceColumn = 0;
|
|
24112
|
+
let namesIndex = 0;
|
|
24113
|
+
do {
|
|
24114
|
+
const semi = reader.indexOf(";");
|
|
24115
|
+
const line = [];
|
|
24116
|
+
let sorted = true;
|
|
24117
|
+
let lastCol = 0;
|
|
24118
|
+
genColumn = 0;
|
|
24119
|
+
while (reader.pos < semi) {
|
|
24120
|
+
let seg;
|
|
24121
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
24122
|
+
if (genColumn < lastCol)
|
|
24123
|
+
sorted = false;
|
|
24124
|
+
lastCol = genColumn;
|
|
24125
|
+
if (hasMoreVlq(reader, semi)) {
|
|
24126
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
24127
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
24128
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
24129
|
+
if (hasMoreVlq(reader, semi)) {
|
|
24130
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
24131
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
24132
|
+
} else {
|
|
24133
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
24134
|
+
}
|
|
24135
|
+
} else {
|
|
24136
|
+
seg = [genColumn];
|
|
24137
|
+
}
|
|
24138
|
+
line.push(seg);
|
|
24139
|
+
reader.pos++;
|
|
24140
|
+
}
|
|
24141
|
+
if (!sorted)
|
|
24142
|
+
sort(line);
|
|
24143
|
+
decoded.push(line);
|
|
24144
|
+
reader.pos = semi + 1;
|
|
24145
|
+
} while (reader.pos <= length);
|
|
24146
|
+
return decoded;
|
|
24147
|
+
}
|
|
24148
|
+
function sort(line) {
|
|
24149
|
+
line.sort(sortComparator);
|
|
24150
|
+
}
|
|
24151
|
+
function sortComparator(a, b2) {
|
|
24152
|
+
return a[0] - b2[0];
|
|
24153
|
+
}
|
|
24154
|
+
var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar, charToInt, bufLength, StringReader = class {
|
|
24155
|
+
constructor(buffer) {
|
|
24156
|
+
this.pos = 0;
|
|
24157
|
+
this.buffer = buffer;
|
|
24158
|
+
}
|
|
24159
|
+
next() {
|
|
24160
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
24161
|
+
}
|
|
24162
|
+
peek() {
|
|
24163
|
+
return this.buffer.charCodeAt(this.pos);
|
|
24164
|
+
}
|
|
24165
|
+
indexOf(char) {
|
|
24166
|
+
const { buffer, pos } = this;
|
|
24167
|
+
const idx = buffer.indexOf(char, pos);
|
|
24168
|
+
return idx === -1 ? buffer.length : idx;
|
|
24169
|
+
}
|
|
24170
|
+
};
|
|
24171
|
+
var init_sourcemap_codec = __esm(() => {
|
|
24172
|
+
intToChar = new Uint8Array(64);
|
|
24173
|
+
charToInt = new Uint8Array(128);
|
|
24174
|
+
for (let i2 = 0;i2 < chars.length; i2++) {
|
|
24175
|
+
const c = chars.charCodeAt(i2);
|
|
24176
|
+
intToChar[i2] = c;
|
|
24177
|
+
charToInt[c] = i2;
|
|
24178
|
+
}
|
|
24179
|
+
bufLength = 1024 * 16;
|
|
24180
|
+
});
|
|
24181
|
+
|
|
24182
|
+
// ../../node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs
|
|
24183
|
+
function isAbsoluteUrl(input) {
|
|
24184
|
+
return schemeRegex.test(input);
|
|
24185
|
+
}
|
|
24186
|
+
function isSchemeRelativeUrl(input) {
|
|
24187
|
+
return input.startsWith("//");
|
|
24188
|
+
}
|
|
24189
|
+
function isAbsolutePath(input) {
|
|
24190
|
+
return input.startsWith("/");
|
|
24191
|
+
}
|
|
24192
|
+
function isFileUrl(input) {
|
|
24193
|
+
return input.startsWith("file:");
|
|
24194
|
+
}
|
|
24195
|
+
function isRelative(input) {
|
|
24196
|
+
return /^[.?#]/.test(input);
|
|
24197
|
+
}
|
|
24198
|
+
function parseAbsoluteUrl(input) {
|
|
24199
|
+
const match = urlRegex.exec(input);
|
|
24200
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
24201
|
+
}
|
|
24202
|
+
function parseFileUrl(input) {
|
|
24203
|
+
const match = fileRegex.exec(input);
|
|
24204
|
+
const path4 = match[2];
|
|
24205
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
|
|
24206
|
+
}
|
|
24207
|
+
function makeUrl(scheme, user, host, port, path4, query, hash) {
|
|
24208
|
+
return {
|
|
24209
|
+
scheme,
|
|
24210
|
+
user,
|
|
24211
|
+
host,
|
|
24212
|
+
port,
|
|
24213
|
+
path: path4,
|
|
24214
|
+
query,
|
|
24215
|
+
hash,
|
|
24216
|
+
type: 7
|
|
24217
|
+
};
|
|
24218
|
+
}
|
|
24219
|
+
function parseUrl(input) {
|
|
24220
|
+
if (isSchemeRelativeUrl(input)) {
|
|
24221
|
+
const url2 = parseAbsoluteUrl("http:" + input);
|
|
24222
|
+
url2.scheme = "";
|
|
24223
|
+
url2.type = 6;
|
|
24224
|
+
return url2;
|
|
24225
|
+
}
|
|
24226
|
+
if (isAbsolutePath(input)) {
|
|
24227
|
+
const url2 = parseAbsoluteUrl("http://foo.com" + input);
|
|
24228
|
+
url2.scheme = "";
|
|
24229
|
+
url2.host = "";
|
|
24230
|
+
url2.type = 5;
|
|
24231
|
+
return url2;
|
|
24232
|
+
}
|
|
24233
|
+
if (isFileUrl(input))
|
|
24234
|
+
return parseFileUrl(input);
|
|
24235
|
+
if (isAbsoluteUrl(input))
|
|
24236
|
+
return parseAbsoluteUrl(input);
|
|
24237
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
24238
|
+
url.scheme = "";
|
|
24239
|
+
url.host = "";
|
|
24240
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
24241
|
+
return url;
|
|
24242
|
+
}
|
|
24243
|
+
function stripPathFilename(path4) {
|
|
24244
|
+
if (path4.endsWith("/.."))
|
|
24245
|
+
return path4;
|
|
24246
|
+
const index = path4.lastIndexOf("/");
|
|
24247
|
+
return path4.slice(0, index + 1);
|
|
24248
|
+
}
|
|
24249
|
+
function mergePaths(url, base) {
|
|
24250
|
+
normalizePath(base, base.type);
|
|
24251
|
+
if (url.path === "/") {
|
|
24252
|
+
url.path = base.path;
|
|
24253
|
+
} else {
|
|
24254
|
+
url.path = stripPathFilename(base.path) + url.path;
|
|
24255
|
+
}
|
|
24256
|
+
}
|
|
24257
|
+
function normalizePath(url, type) {
|
|
24258
|
+
const rel = type <= 4;
|
|
24259
|
+
const pieces = url.path.split("/");
|
|
24260
|
+
let pointer = 1;
|
|
24261
|
+
let positive = 0;
|
|
24262
|
+
let addTrailingSlash = false;
|
|
24263
|
+
for (let i2 = 1;i2 < pieces.length; i2++) {
|
|
24264
|
+
const piece = pieces[i2];
|
|
24265
|
+
if (!piece) {
|
|
24266
|
+
addTrailingSlash = true;
|
|
24267
|
+
continue;
|
|
24268
|
+
}
|
|
24269
|
+
addTrailingSlash = false;
|
|
24270
|
+
if (piece === ".")
|
|
24271
|
+
continue;
|
|
24272
|
+
if (piece === "..") {
|
|
24273
|
+
if (positive) {
|
|
24274
|
+
addTrailingSlash = true;
|
|
24275
|
+
positive--;
|
|
24276
|
+
pointer--;
|
|
24277
|
+
} else if (rel) {
|
|
24278
|
+
pieces[pointer++] = piece;
|
|
24279
|
+
}
|
|
24280
|
+
continue;
|
|
24281
|
+
}
|
|
24282
|
+
pieces[pointer++] = piece;
|
|
24283
|
+
positive++;
|
|
24284
|
+
}
|
|
24285
|
+
let path4 = "";
|
|
24286
|
+
for (let i2 = 1;i2 < pointer; i2++) {
|
|
24287
|
+
path4 += "/" + pieces[i2];
|
|
24288
|
+
}
|
|
24289
|
+
if (!path4 || addTrailingSlash && !path4.endsWith("/..")) {
|
|
24290
|
+
path4 += "/";
|
|
24291
|
+
}
|
|
24292
|
+
url.path = path4;
|
|
24293
|
+
}
|
|
24294
|
+
function resolve(input, base) {
|
|
24295
|
+
if (!input && !base)
|
|
24296
|
+
return "";
|
|
24297
|
+
const url = parseUrl(input);
|
|
24298
|
+
let inputType = url.type;
|
|
24299
|
+
if (base && inputType !== 7) {
|
|
24300
|
+
const baseUrl = parseUrl(base);
|
|
24301
|
+
const baseType = baseUrl.type;
|
|
24302
|
+
switch (inputType) {
|
|
24303
|
+
case 1:
|
|
24304
|
+
url.hash = baseUrl.hash;
|
|
24305
|
+
case 2:
|
|
24306
|
+
url.query = baseUrl.query;
|
|
24307
|
+
case 3:
|
|
24308
|
+
case 4:
|
|
24309
|
+
mergePaths(url, baseUrl);
|
|
24310
|
+
case 5:
|
|
24311
|
+
url.user = baseUrl.user;
|
|
24312
|
+
url.host = baseUrl.host;
|
|
24313
|
+
url.port = baseUrl.port;
|
|
24314
|
+
case 6:
|
|
24315
|
+
url.scheme = baseUrl.scheme;
|
|
24316
|
+
}
|
|
24317
|
+
if (baseType > inputType)
|
|
24318
|
+
inputType = baseType;
|
|
24319
|
+
}
|
|
24320
|
+
normalizePath(url, inputType);
|
|
24321
|
+
const queryHash = url.query + url.hash;
|
|
24322
|
+
switch (inputType) {
|
|
24323
|
+
case 2:
|
|
24324
|
+
case 3:
|
|
24325
|
+
return queryHash;
|
|
24326
|
+
case 4: {
|
|
24327
|
+
const path4 = url.path.slice(1);
|
|
24328
|
+
if (!path4)
|
|
24329
|
+
return queryHash || ".";
|
|
24330
|
+
if (isRelative(base || input) && !isRelative(path4)) {
|
|
24331
|
+
return "./" + path4 + queryHash;
|
|
24332
|
+
}
|
|
24333
|
+
return path4 + queryHash;
|
|
24334
|
+
}
|
|
24335
|
+
case 5:
|
|
24336
|
+
return url.path + queryHash;
|
|
24337
|
+
default:
|
|
24338
|
+
return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
24339
|
+
}
|
|
24340
|
+
}
|
|
24341
|
+
var schemeRegex, urlRegex, fileRegex;
|
|
24342
|
+
var init_resolve_uri = __esm(() => {
|
|
24343
|
+
schemeRegex = /^[\w+.-]+:\/\//;
|
|
24344
|
+
urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
24345
|
+
fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
24346
|
+
});
|
|
24347
|
+
|
|
24348
|
+
// ../../node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs
|
|
24349
|
+
function stripFilename(path4) {
|
|
24350
|
+
if (!path4)
|
|
24351
|
+
return "";
|
|
24352
|
+
const index = path4.lastIndexOf("/");
|
|
24353
|
+
return path4.slice(0, index + 1);
|
|
24354
|
+
}
|
|
24355
|
+
function resolver(mapUrl, sourceRoot) {
|
|
24356
|
+
const from = stripFilename(mapUrl);
|
|
24357
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
24358
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
24359
|
+
}
|
|
24360
|
+
function maybeSort(mappings, owned) {
|
|
24361
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
24362
|
+
if (unsortedIndex === mappings.length)
|
|
24363
|
+
return mappings;
|
|
24364
|
+
if (!owned)
|
|
24365
|
+
mappings = mappings.slice();
|
|
24366
|
+
for (let i2 = unsortedIndex;i2 < mappings.length; i2 = nextUnsortedSegmentLine(mappings, i2 + 1)) {
|
|
24367
|
+
mappings[i2] = sortSegments(mappings[i2], owned);
|
|
24368
|
+
}
|
|
24369
|
+
return mappings;
|
|
24370
|
+
}
|
|
24371
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
24372
|
+
for (let i2 = start;i2 < mappings.length; i2++) {
|
|
24373
|
+
if (!isSorted(mappings[i2]))
|
|
24374
|
+
return i2;
|
|
24375
|
+
}
|
|
24376
|
+
return mappings.length;
|
|
24377
|
+
}
|
|
24378
|
+
function isSorted(line) {
|
|
24379
|
+
for (let j = 1;j < line.length; j++) {
|
|
24380
|
+
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
|
|
24381
|
+
return false;
|
|
24382
|
+
}
|
|
24383
|
+
}
|
|
24384
|
+
return true;
|
|
24385
|
+
}
|
|
24386
|
+
function sortSegments(line, owned) {
|
|
24387
|
+
if (!owned)
|
|
24388
|
+
line = line.slice();
|
|
24389
|
+
return line.sort(sortComparator2);
|
|
24390
|
+
}
|
|
24391
|
+
function sortComparator2(a, b2) {
|
|
24392
|
+
return a[COLUMN] - b2[COLUMN];
|
|
24393
|
+
}
|
|
24394
|
+
function binarySearch(haystack, needle, low, high) {
|
|
24395
|
+
while (low <= high) {
|
|
24396
|
+
const mid = low + (high - low >> 1);
|
|
24397
|
+
const cmp = haystack[mid][COLUMN] - needle;
|
|
24398
|
+
if (cmp === 0) {
|
|
24399
|
+
found = true;
|
|
24400
|
+
return mid;
|
|
24401
|
+
}
|
|
24402
|
+
if (cmp < 0) {
|
|
24403
|
+
low = mid + 1;
|
|
24404
|
+
} else {
|
|
24405
|
+
high = mid - 1;
|
|
24406
|
+
}
|
|
24407
|
+
}
|
|
24408
|
+
found = false;
|
|
24409
|
+
return low - 1;
|
|
24410
|
+
}
|
|
24411
|
+
function upperBound(haystack, needle, index) {
|
|
24412
|
+
for (let i2 = index + 1;i2 < haystack.length; index = i2++) {
|
|
24413
|
+
if (haystack[i2][COLUMN] !== needle)
|
|
24414
|
+
break;
|
|
24415
|
+
}
|
|
24416
|
+
return index;
|
|
24417
|
+
}
|
|
24418
|
+
function lowerBound(haystack, needle, index) {
|
|
24419
|
+
for (let i2 = index - 1;i2 >= 0; index = i2--) {
|
|
24420
|
+
if (haystack[i2][COLUMN] !== needle)
|
|
24421
|
+
break;
|
|
24422
|
+
}
|
|
24423
|
+
return index;
|
|
24424
|
+
}
|
|
24425
|
+
function memoizedState() {
|
|
24426
|
+
return {
|
|
24427
|
+
lastKey: -1,
|
|
24428
|
+
lastNeedle: -1,
|
|
24429
|
+
lastIndex: -1
|
|
24430
|
+
};
|
|
24431
|
+
}
|
|
24432
|
+
function memoizedBinarySearch(haystack, needle, state, key) {
|
|
24433
|
+
const { lastKey, lastNeedle, lastIndex } = state;
|
|
24434
|
+
let low = 0;
|
|
24435
|
+
let high = haystack.length - 1;
|
|
24436
|
+
if (key === lastKey) {
|
|
24437
|
+
if (needle === lastNeedle) {
|
|
24438
|
+
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
|
|
24439
|
+
return lastIndex;
|
|
24440
|
+
}
|
|
24441
|
+
if (needle >= lastNeedle) {
|
|
24442
|
+
low = lastIndex === -1 ? 0 : lastIndex;
|
|
24443
|
+
} else {
|
|
24444
|
+
high = lastIndex;
|
|
24445
|
+
}
|
|
24446
|
+
}
|
|
24447
|
+
state.lastKey = key;
|
|
24448
|
+
state.lastNeedle = needle;
|
|
24449
|
+
return state.lastIndex = binarySearch(haystack, needle, low, high);
|
|
24450
|
+
}
|
|
24451
|
+
function parse2(map) {
|
|
24452
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
24453
|
+
}
|
|
24454
|
+
function cast(map) {
|
|
24455
|
+
return map;
|
|
24456
|
+
}
|
|
24457
|
+
function decodedMappings(map) {
|
|
24458
|
+
var _a;
|
|
24459
|
+
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
|
|
24460
|
+
}
|
|
24461
|
+
function originalPositionFor(map, needle) {
|
|
24462
|
+
let { line, column, bias } = needle;
|
|
24463
|
+
line--;
|
|
24464
|
+
if (line < 0)
|
|
24465
|
+
throw new Error(LINE_GTR_ZERO);
|
|
24466
|
+
if (column < 0)
|
|
24467
|
+
throw new Error(COL_GTR_EQ_ZERO);
|
|
24468
|
+
const decoded = decodedMappings(map);
|
|
24469
|
+
if (line >= decoded.length)
|
|
24470
|
+
return OMapping(null, null, null, null);
|
|
24471
|
+
const segments = decoded[line];
|
|
24472
|
+
const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
|
|
24473
|
+
if (index === -1)
|
|
24474
|
+
return OMapping(null, null, null, null);
|
|
24475
|
+
const segment = segments[index];
|
|
24476
|
+
if (segment.length === 1)
|
|
24477
|
+
return OMapping(null, null, null, null);
|
|
24478
|
+
const { names, resolvedSources } = map;
|
|
24479
|
+
return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], segment.length === 5 ? names[segment[NAMES_INDEX]] : null);
|
|
24480
|
+
}
|
|
24481
|
+
function OMapping(source, line, column, name) {
|
|
24482
|
+
return { source, line, column, name };
|
|
24483
|
+
}
|
|
24484
|
+
function traceSegmentInternal(segments, memo, line, column, bias) {
|
|
24485
|
+
let index = memoizedBinarySearch(segments, column, memo, line);
|
|
24486
|
+
if (found) {
|
|
24487
|
+
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
|
|
24488
|
+
} else if (bias === LEAST_UPPER_BOUND)
|
|
24489
|
+
index++;
|
|
24490
|
+
if (index === -1 || index === segments.length)
|
|
24491
|
+
return -1;
|
|
24492
|
+
return index;
|
|
24493
|
+
}
|
|
24494
|
+
var COLUMN = 0, SOURCES_INDEX = 1, SOURCE_LINE = 2, SOURCE_COLUMN = 3, NAMES_INDEX = 4, found = false, LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)", COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)", LEAST_UPPER_BOUND = -1, GREATEST_LOWER_BOUND = 1, TraceMap = class {
|
|
24495
|
+
constructor(map, mapUrl) {
|
|
24496
|
+
const isString = typeof map === "string";
|
|
24497
|
+
if (!isString && map._decodedMemo)
|
|
24498
|
+
return map;
|
|
24499
|
+
const parsed = parse2(map);
|
|
24500
|
+
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
|
|
24501
|
+
this.version = version;
|
|
24502
|
+
this.file = file;
|
|
24503
|
+
this.names = names || [];
|
|
24504
|
+
this.sourceRoot = sourceRoot;
|
|
24505
|
+
this.sources = sources;
|
|
24506
|
+
this.sourcesContent = sourcesContent;
|
|
24507
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || undefined;
|
|
24508
|
+
const resolve2 = resolver(mapUrl, sourceRoot);
|
|
24509
|
+
this.resolvedSources = sources.map(resolve2);
|
|
24510
|
+
const { mappings } = parsed;
|
|
24511
|
+
if (typeof mappings === "string") {
|
|
24512
|
+
this._encoded = mappings;
|
|
24513
|
+
this._decoded = undefined;
|
|
24514
|
+
} else if (Array.isArray(mappings)) {
|
|
24515
|
+
this._encoded = undefined;
|
|
24516
|
+
this._decoded = maybeSort(mappings, isString);
|
|
24517
|
+
} else if (parsed.sections) {
|
|
24518
|
+
throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
24519
|
+
} else {
|
|
24520
|
+
throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
24521
|
+
}
|
|
24522
|
+
this._decodedMemo = memoizedState();
|
|
24523
|
+
this._bySources = undefined;
|
|
24524
|
+
this._bySourceMemos = undefined;
|
|
24525
|
+
}
|
|
24526
|
+
};
|
|
24527
|
+
var init_trace_mapping = __esm(() => {
|
|
24528
|
+
init_sourcemap_codec();
|
|
24529
|
+
init_resolve_uri();
|
|
24530
|
+
});
|
|
24531
|
+
|
|
24532
|
+
// src/check-code.ts
|
|
24533
|
+
var {Glob } = globalThis.Bun;
|
|
24534
|
+
import path4 from "path";
|
|
24535
|
+
function buildPosition(error) {
|
|
24536
|
+
if (typeof error !== "object" || error === null || !("position" in error))
|
|
24537
|
+
return null;
|
|
24538
|
+
const position = error.position;
|
|
24539
|
+
return typeof position === "object" && position !== null ? position : null;
|
|
24540
|
+
}
|
|
24541
|
+
function messageOf(error) {
|
|
24542
|
+
const message = typeof error === "object" && error !== null && "message" in error ? error.message : undefined;
|
|
24543
|
+
return String(typeof message === "string" ? message : error).split(`
|
|
24544
|
+
`)[0];
|
|
24545
|
+
}
|
|
24546
|
+
function toSource(map, position) {
|
|
24547
|
+
if (!map || position?.line === undefined)
|
|
24548
|
+
return {};
|
|
24549
|
+
try {
|
|
24550
|
+
const traced = originalPositionFor(new TraceMap(JSON.parse(map)), {
|
|
24551
|
+
line: position.line,
|
|
24552
|
+
column: position.column ?? 0
|
|
24553
|
+
});
|
|
24554
|
+
if (traced.line === null)
|
|
24555
|
+
return {};
|
|
24556
|
+
return { line: traced.line, column: traced.column + 1 };
|
|
24557
|
+
} catch {
|
|
24558
|
+
return {};
|
|
24559
|
+
}
|
|
24560
|
+
}
|
|
24561
|
+
async function checkAstroFile(absolute, relative, source) {
|
|
24562
|
+
let emitted;
|
|
24563
|
+
try {
|
|
24564
|
+
emitted = await w2(source, { filename: absolute, sourcemap: "both" });
|
|
24565
|
+
} catch (error) {
|
|
24566
|
+
return { severity: "error", code: "code/astro-parse", file: relative, message: messageOf(error) };
|
|
24567
|
+
}
|
|
24568
|
+
try {
|
|
24569
|
+
new Bun.Transpiler({ loader: "ts" }).transformSync(emitted.code);
|
|
24570
|
+
return null;
|
|
24571
|
+
} catch (error) {
|
|
24572
|
+
const position = buildPosition(error);
|
|
24573
|
+
return {
|
|
24574
|
+
severity: "error",
|
|
24575
|
+
code: "code/syntax",
|
|
24576
|
+
file: relative,
|
|
24577
|
+
...toSource(emitted.map, position),
|
|
24578
|
+
message: messageOf(error)
|
|
24579
|
+
};
|
|
24580
|
+
}
|
|
24581
|
+
}
|
|
24582
|
+
function checkScriptFile(relative, source, loader) {
|
|
24583
|
+
try {
|
|
24584
|
+
new Bun.Transpiler({ loader }).transformSync(source);
|
|
24585
|
+
return null;
|
|
24586
|
+
} catch (error) {
|
|
24587
|
+
const position = buildPosition(error);
|
|
24588
|
+
return {
|
|
24589
|
+
severity: "error",
|
|
24590
|
+
code: "code/syntax",
|
|
24591
|
+
file: relative,
|
|
24592
|
+
line: position?.line,
|
|
24593
|
+
column: position?.column === undefined ? undefined : position.column + 1,
|
|
24594
|
+
message: messageOf(error)
|
|
24595
|
+
};
|
|
24596
|
+
}
|
|
24597
|
+
}
|
|
24598
|
+
async function checkCode(root) {
|
|
24599
|
+
const findings = [];
|
|
24600
|
+
let files = 0;
|
|
24601
|
+
const paths = [];
|
|
24602
|
+
for await (const relative of new Glob("**/*.{astro,ts,tsx,mts,cts}").scan({ cwd: root })) {
|
|
24603
|
+
if (!isIgnored(relative))
|
|
24604
|
+
paths.push(relative);
|
|
24605
|
+
}
|
|
24606
|
+
paths.sort();
|
|
24607
|
+
for (const relative of paths) {
|
|
24608
|
+
files++;
|
|
24609
|
+
const absolute = path4.join(root, relative);
|
|
24610
|
+
const source = await Bun.file(absolute).text();
|
|
24611
|
+
const finding = relative.endsWith(".astro") ? await checkAstroFile(absolute, relative, source) : checkScriptFile(relative, source, relative.endsWith(".tsx") ? "tsx" : "ts");
|
|
24612
|
+
if (finding)
|
|
24613
|
+
findings.push(finding);
|
|
24614
|
+
}
|
|
24615
|
+
return { findings, files };
|
|
24616
|
+
}
|
|
24617
|
+
var IGNORED, isIgnored = (relative) => /\.d\.[mc]?ts$/.test(relative) || relative.split(path4.sep).some((segment) => IGNORED.includes(segment));
|
|
24618
|
+
var init_check_code = __esm(() => {
|
|
24619
|
+
init_node();
|
|
24620
|
+
init_trace_mapping();
|
|
24621
|
+
IGNORED = ["node_modules", "dist", ".astro", ".git", ".output", ".vercel", ".netlify"];
|
|
24622
|
+
});
|
|
24623
|
+
|
|
23829
24624
|
// src/check.ts
|
|
23830
24625
|
var exports_check = {};
|
|
23831
24626
|
__export(exports_check, {
|
|
23832
|
-
check: () => check
|
|
24627
|
+
check: () => check,
|
|
24628
|
+
astroRoots: () => astroRoots
|
|
23833
24629
|
});
|
|
24630
|
+
import { existsSync, readdirSync } from "fs";
|
|
24631
|
+
import path5 from "path";
|
|
24632
|
+
function astroRoots(cwd) {
|
|
24633
|
+
if (hasAstroConfig(cwd))
|
|
24634
|
+
return ["."];
|
|
24635
|
+
const packagesDir = path5.join(cwd, "packages");
|
|
24636
|
+
if (!existsSync(packagesDir))
|
|
24637
|
+
return [];
|
|
24638
|
+
return readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().filter((name) => hasAstroConfig(path5.join(packagesDir, name))).map((name) => path5.join("packages", name));
|
|
24639
|
+
}
|
|
24640
|
+
function prefixed(report, root) {
|
|
24641
|
+
if (root === ".")
|
|
24642
|
+
return report;
|
|
24643
|
+
return {
|
|
24644
|
+
...report,
|
|
24645
|
+
findings: report.findings.map((finding) => ({ ...finding, file: path5.join(root, finding.file) }))
|
|
24646
|
+
};
|
|
24647
|
+
}
|
|
23834
24648
|
async function check(options) {
|
|
23835
|
-
const
|
|
24649
|
+
const roots = astroRoots(options.cwd);
|
|
24650
|
+
if (roots.length === 0) {
|
|
24651
|
+
console.error(`No astro.config.* found in ${options.cwd} or its packages/*. Run this in an Astro project.`);
|
|
24652
|
+
return 1;
|
|
24653
|
+
}
|
|
24654
|
+
const reports = await Promise.all(roots.map(async (root) => {
|
|
24655
|
+
const absolute = path5.join(options.cwd, root);
|
|
24656
|
+
const content = prefixed(await checkContent(createNodeFs(absolute)), root);
|
|
24657
|
+
if (options.contentOnly)
|
|
24658
|
+
return { ...content, files: 0 };
|
|
24659
|
+
const code = await checkCode(absolute);
|
|
24660
|
+
return {
|
|
24661
|
+
...content,
|
|
24662
|
+
findings: [...content.findings, ...code.findings.map((finding) => ({ ...finding, file: path5.join(root, finding.file) }))],
|
|
24663
|
+
files: code.files
|
|
24664
|
+
};
|
|
24665
|
+
}));
|
|
24666
|
+
const report = {
|
|
24667
|
+
findings: reports.flatMap((one) => one.findings),
|
|
24668
|
+
collections: reports.reduce((total, one) => total + one.collections, 0),
|
|
24669
|
+
entries: reports.reduce((total, one) => total + one.entries, 0)
|
|
24670
|
+
};
|
|
24671
|
+
const sourceFiles = reports.reduce((total, one) => total + one.files, 0);
|
|
24672
|
+
const errors = report.findings.filter((finding) => finding.severity === "error").length;
|
|
24673
|
+
const warnings = report.findings.length - errors;
|
|
23836
24674
|
if (options.json) {
|
|
23837
|
-
console.log(JSON.stringify(report, null, 2));
|
|
24675
|
+
console.log(JSON.stringify({ ...report, roots }, null, 2));
|
|
23838
24676
|
} else {
|
|
23839
24677
|
const formatted = formatCheckReport(report);
|
|
23840
24678
|
if (formatted)
|
|
23841
24679
|
console.log(formatted + `
|
|
23842
24680
|
`);
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
if (!options.json) {
|
|
23847
|
-
const counts = `${report.collections} collection(s), ${report.entries} entries`;
|
|
24681
|
+
const where = roots.length === 1 && roots[0] === "." ? "" : ` in ${roots.join(", ")}`;
|
|
24682
|
+
const code = options.contentOnly ? "" : `, ${sourceFiles} source file(s)`;
|
|
24683
|
+
const counts = `${report.collections} collection(s), ${report.entries} entries${code}${where}`;
|
|
23848
24684
|
console.log(errors === 0 && warnings === 0 ? `${counts} \u2014 no problems found` : `${counts} \u2014 ${errors} error(s), ${warnings} warning(s)`);
|
|
23849
24685
|
}
|
|
23850
24686
|
return errors > 0 || options.strict && warnings > 0 ? 1 : 0;
|
|
23851
24687
|
}
|
|
24688
|
+
var ASTRO_CONFIG_NAMES, hasAstroConfig = (dir) => ASTRO_CONFIG_NAMES.some((name) => existsSync(path5.join(dir, name)));
|
|
23852
24689
|
var init_check2 = __esm(() => {
|
|
23853
24690
|
init_src2();
|
|
24691
|
+
init_check_code();
|
|
24692
|
+
ASTRO_CONFIG_NAMES = ["astro.config.ts", "astro.config.mts", "astro.config.mjs", "astro.config.js"];
|
|
23854
24693
|
});
|
|
23855
24694
|
|
|
23856
24695
|
// src/utils.ts
|
|
23857
|
-
import { existsSync } from "fs";
|
|
24696
|
+
import { existsSync as existsSync2 } from "fs";
|
|
23858
24697
|
import { join } from "path";
|
|
23859
24698
|
function findAstroConfig(cwd = process.cwd()) {
|
|
23860
24699
|
for (const name of CONFIG_NAMES) {
|
|
23861
24700
|
const p = join(cwd, name);
|
|
23862
|
-
if (
|
|
24701
|
+
if (existsSync2(p))
|
|
23863
24702
|
return p;
|
|
23864
24703
|
}
|
|
23865
24704
|
return null;
|
|
@@ -23869,11 +24708,11 @@ function findMatchingClose(text, start) {
|
|
|
23869
24708
|
const close = open === "{" ? "}" : open === "[" ? "]" : ")";
|
|
23870
24709
|
let depth = 0;
|
|
23871
24710
|
let inString = false;
|
|
23872
|
-
for (let
|
|
23873
|
-
const ch = text[
|
|
24711
|
+
for (let i2 = start;i2 < text.length; i2++) {
|
|
24712
|
+
const ch = text[i2];
|
|
23874
24713
|
if (inString) {
|
|
23875
24714
|
if (ch === "\\") {
|
|
23876
|
-
|
|
24715
|
+
i2++;
|
|
23877
24716
|
continue;
|
|
23878
24717
|
}
|
|
23879
24718
|
if (ch === inString)
|
|
@@ -23889,7 +24728,7 @@ function findMatchingClose(text, start) {
|
|
|
23889
24728
|
if (ch === close) {
|
|
23890
24729
|
depth--;
|
|
23891
24730
|
if (depth === 0)
|
|
23892
|
-
return
|
|
24731
|
+
return i2;
|
|
23893
24732
|
}
|
|
23894
24733
|
}
|
|
23895
24734
|
return -1;
|
|
@@ -23911,20 +24750,20 @@ function removeProperty(body, propName) {
|
|
|
23911
24750
|
return body;
|
|
23912
24751
|
const propLineStart = match.index + 1;
|
|
23913
24752
|
const afterMatch = match.index + match[0].length;
|
|
23914
|
-
let
|
|
23915
|
-
while (
|
|
23916
|
-
|
|
24753
|
+
let i2 = afterMatch;
|
|
24754
|
+
while (i2 < body.length && (body[i2] === " " || body[i2] === "\t"))
|
|
24755
|
+
i2++;
|
|
23917
24756
|
let valueEnd;
|
|
23918
|
-
if (body[
|
|
23919
|
-
valueEnd = findMatchingClose(body,
|
|
24757
|
+
if (body[i2] === "{" || body[i2] === "[") {
|
|
24758
|
+
valueEnd = findMatchingClose(body, i2);
|
|
23920
24759
|
if (valueEnd === -1)
|
|
23921
24760
|
return body;
|
|
23922
24761
|
valueEnd++;
|
|
23923
24762
|
} else {
|
|
23924
|
-
while (
|
|
24763
|
+
while (i2 < body.length && body[i2] !== "," && body[i2] !== `
|
|
23925
24764
|
`)
|
|
23926
|
-
|
|
23927
|
-
valueEnd =
|
|
24765
|
+
i2++;
|
|
24766
|
+
valueEnd = i2;
|
|
23928
24767
|
}
|
|
23929
24768
|
let end = valueEnd;
|
|
23930
24769
|
while (end < body.length && (body[end] === " " || body[end] === "\t"))
|
|
@@ -23976,7 +24815,7 @@ __export(exports_init, {
|
|
|
23976
24815
|
detectNuaManagedImports: () => detectNuaManagedImports,
|
|
23977
24816
|
cleanEmptyStructures: () => cleanEmptyStructures
|
|
23978
24817
|
});
|
|
23979
|
-
import { existsSync as
|
|
24818
|
+
import { existsSync as existsSync3, readFileSync, writeFileSync } from "fs";
|
|
23980
24819
|
import { basename, join as join2 } from "path";
|
|
23981
24820
|
function detectNuaManagedImports(content) {
|
|
23982
24821
|
const managed = new Map;
|
|
@@ -24101,7 +24940,7 @@ function transformPackageJson(pkg, nuaVersion) {
|
|
|
24101
24940
|
if (!result.dependencies["@nuasite/nua"]) {
|
|
24102
24941
|
result.dependencies["@nuasite/nua"] = nuaVersion;
|
|
24103
24942
|
}
|
|
24104
|
-
result.dependencies = Object.fromEntries(Object.entries(result.dependencies).sort(([a], [
|
|
24943
|
+
result.dependencies = Object.fromEntries(Object.entries(result.dependencies).sort(([a], [b2]) => a.localeCompare(b2)));
|
|
24105
24944
|
return result;
|
|
24106
24945
|
}
|
|
24107
24946
|
async function init({ cwd = process.cwd(), dryRun = false, yes = false } = {}) {
|
|
@@ -24120,7 +24959,7 @@ async function init({ cwd = process.cwd(), dryRun = false, yes = false } = {}) {
|
|
|
24120
24959
|
process.exit(1);
|
|
24121
24960
|
}
|
|
24122
24961
|
const pkgPath = join2(cwd, "package.json");
|
|
24123
|
-
if (!
|
|
24962
|
+
if (!existsSync3(pkgPath)) {
|
|
24124
24963
|
console.error("No package.json found.");
|
|
24125
24964
|
process.exit(1);
|
|
24126
24965
|
}
|
|
@@ -24198,7 +25037,7 @@ __export(exports_clean, {
|
|
|
24198
25037
|
detectDisabledFeatures: () => detectDisabledFeatures,
|
|
24199
25038
|
clean: () => clean
|
|
24200
25039
|
});
|
|
24201
|
-
import { existsSync as
|
|
25040
|
+
import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
24202
25041
|
import { basename as basename2, join as join3 } from "path";
|
|
24203
25042
|
function detectDisabledFeatures(content) {
|
|
24204
25043
|
const disabled = new Set;
|
|
@@ -24211,9 +25050,9 @@ function detectDisabledFeatures(content) {
|
|
|
24211
25050
|
}
|
|
24212
25051
|
function prependToArrayProperty(lines, property, items) {
|
|
24213
25052
|
const pattern = new RegExp(`\\b${property}\\s*:\\s*\\[`);
|
|
24214
|
-
for (let
|
|
24215
|
-
if (pattern.test(lines[
|
|
24216
|
-
lines[
|
|
25053
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
25054
|
+
if (pattern.test(lines[i2])) {
|
|
25055
|
+
lines[i2] = lines[i2].replace(new RegExp(`(\\b${property}\\s*:\\s*\\[)`), `$1${items}, `);
|
|
24217
25056
|
return true;
|
|
24218
25057
|
}
|
|
24219
25058
|
}
|
|
@@ -24302,16 +25141,16 @@ function transformPackageJson2(pkg, disabled, usedRuntimePackages = []) {
|
|
|
24302
25141
|
result.dependencies[name] = nuaVersion ?? "^0.16.0";
|
|
24303
25142
|
}
|
|
24304
25143
|
}
|
|
24305
|
-
result.dependencies = Object.fromEntries(Object.entries(result.dependencies).sort(([a], [
|
|
25144
|
+
result.dependencies = Object.fromEntries(Object.entries(result.dependencies).sort(([a], [b2]) => a.localeCompare(b2)));
|
|
24306
25145
|
return result;
|
|
24307
25146
|
}
|
|
24308
25147
|
function scanForNuasiteUsage(cwd) {
|
|
24309
25148
|
const srcDir = join3(cwd, "src");
|
|
24310
|
-
if (!
|
|
25149
|
+
if (!existsSync4(srcDir))
|
|
24311
25150
|
return [];
|
|
24312
25151
|
const results = [];
|
|
24313
25152
|
try {
|
|
24314
|
-
const files =
|
|
25153
|
+
const files = readdirSync2(srcDir, { recursive: true });
|
|
24315
25154
|
for (const entry of files) {
|
|
24316
25155
|
const fileName = String(entry);
|
|
24317
25156
|
if (!/\.(astro|ts|tsx|js|jsx)$/.test(fileName))
|
|
@@ -24342,7 +25181,7 @@ async function clean({ cwd = process.cwd(), dryRun = false, yes = false } = {})
|
|
|
24342
25181
|
return;
|
|
24343
25182
|
}
|
|
24344
25183
|
const pkgPath = join3(cwd, "package.json");
|
|
24345
|
-
if (!
|
|
25184
|
+
if (!existsSync4(pkgPath)) {
|
|
24346
25185
|
console.error("No package.json found.");
|
|
24347
25186
|
process.exit(1);
|
|
24348
25187
|
}
|
|
@@ -24450,7 +25289,7 @@ var init_config = () => {};
|
|
|
24450
25289
|
|
|
24451
25290
|
// ../cms/src/component-registry.ts
|
|
24452
25291
|
import fs2 from "fs/promises";
|
|
24453
|
-
import
|
|
25292
|
+
import path6 from "path";
|
|
24454
25293
|
|
|
24455
25294
|
class ComponentRegistry {
|
|
24456
25295
|
components = new Map;
|
|
@@ -24460,7 +25299,7 @@ class ComponentRegistry {
|
|
|
24460
25299
|
}
|
|
24461
25300
|
async scan() {
|
|
24462
25301
|
for (const dir of this.componentDirs) {
|
|
24463
|
-
const fullPath =
|
|
25302
|
+
const fullPath = path6.join(getProjectRoot(), dir);
|
|
24464
25303
|
try {
|
|
24465
25304
|
await this.scanDirectory(fullPath, dir);
|
|
24466
25305
|
} catch {}
|
|
@@ -24475,8 +25314,8 @@ class ComponentRegistry {
|
|
|
24475
25314
|
async scanDirectory(dir, relativePath) {
|
|
24476
25315
|
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
24477
25316
|
for (const entry of entries) {
|
|
24478
|
-
const fullPath =
|
|
24479
|
-
const relPath =
|
|
25317
|
+
const fullPath = path6.join(dir, entry.name);
|
|
25318
|
+
const relPath = path6.join(relativePath, entry.name);
|
|
24480
25319
|
if (entry.isDirectory()) {
|
|
24481
25320
|
await this.scanDirectory(fullPath, relPath);
|
|
24482
25321
|
} else if (entry.isFile() && entry.name.endsWith(".astro")) {
|
|
@@ -24487,7 +25326,7 @@ class ComponentRegistry {
|
|
|
24487
25326
|
async parseComponent(filePath, relativePath) {
|
|
24488
25327
|
try {
|
|
24489
25328
|
const content = await fs2.readFile(filePath, "utf-8");
|
|
24490
|
-
const componentName =
|
|
25329
|
+
const componentName = path6.basename(filePath, ".astro");
|
|
24491
25330
|
const props = await this.extractProps(content);
|
|
24492
25331
|
const slots = this.extractSlots(content);
|
|
24493
25332
|
const description = this.extractDescription(content);
|
|
@@ -24633,18 +25472,18 @@ ${propsContent}
|
|
|
24633
25472
|
return null;
|
|
24634
25473
|
const startIndex = match.index + match[0].length;
|
|
24635
25474
|
let depth = 1;
|
|
24636
|
-
let
|
|
24637
|
-
while (
|
|
24638
|
-
if (text[
|
|
25475
|
+
let i2 = startIndex;
|
|
25476
|
+
while (i2 < text.length && depth > 0) {
|
|
25477
|
+
if (text[i2] === "{") {
|
|
24639
25478
|
depth++;
|
|
24640
|
-
} else if (text[
|
|
25479
|
+
} else if (text[i2] === "}") {
|
|
24641
25480
|
depth--;
|
|
24642
25481
|
}
|
|
24643
|
-
|
|
25482
|
+
i2++;
|
|
24644
25483
|
}
|
|
24645
25484
|
if (depth !== 0)
|
|
24646
25485
|
return null;
|
|
24647
|
-
return text.substring(startIndex,
|
|
25486
|
+
return text.substring(startIndex, i2 - 1);
|
|
24648
25487
|
}
|
|
24649
25488
|
async extractProps(content) {
|
|
24650
25489
|
const props = [];
|
|
@@ -24742,7 +25581,7 @@ function slugify2(text) {
|
|
|
24742
25581
|
|
|
24743
25582
|
// ../cms/src/utils.ts
|
|
24744
25583
|
import { createHash } from "crypto";
|
|
24745
|
-
import
|
|
25584
|
+
import path7 from "path";
|
|
24746
25585
|
function normalizePagePath(url) {
|
|
24747
25586
|
let pathname;
|
|
24748
25587
|
try {
|
|
@@ -24781,7 +25620,7 @@ function generateSourceFileHashes(entries) {
|
|
|
24781
25620
|
}
|
|
24782
25621
|
const hashes = {};
|
|
24783
25622
|
for (const [filePath, fileEntries] of Object.entries(entriesByFile)) {
|
|
24784
|
-
const sorted = fileEntries.sort((a,
|
|
25623
|
+
const sorted = fileEntries.sort((a, b2) => (a.sourceLine || 0) - (b2.sourceLine || 0));
|
|
24785
25624
|
const content = sorted.map((e) => `${e.sourceLine || 0}|${e.text}|${e.sourceSnippet || ""}`).join(`
|
|
24786
25625
|
`);
|
|
24787
25626
|
hashes[filePath] = sha256(content);
|
|
@@ -24795,27 +25634,27 @@ function escapeReplacement(str) {
|
|
|
24795
25634
|
return str.replace(/\$/g, "$$$$");
|
|
24796
25635
|
}
|
|
24797
25636
|
function resolveSourcePath(sourcePath) {
|
|
24798
|
-
return
|
|
25637
|
+
return path7.isAbsolute(sourcePath) ? sourcePath : path7.join(getProjectRoot(), sourcePath);
|
|
24799
25638
|
}
|
|
24800
25639
|
function resolveAndValidatePath(filePath) {
|
|
24801
25640
|
const projectRoot = getProjectRoot();
|
|
24802
|
-
const resolvedRoot =
|
|
25641
|
+
const resolvedRoot = path7.resolve(projectRoot);
|
|
24803
25642
|
const isAbsoluteFs = filePath.startsWith(resolvedRoot);
|
|
24804
25643
|
const normalizedPath = !isAbsoluteFs && filePath.startsWith("/") ? filePath.slice(1) : filePath;
|
|
24805
|
-
const fullPath =
|
|
24806
|
-
if (!fullPath.startsWith(resolvedRoot +
|
|
25644
|
+
const fullPath = path7.isAbsolute(normalizedPath) ? path7.resolve(normalizedPath) : path7.resolve(projectRoot, normalizedPath);
|
|
25645
|
+
if (!fullPath.startsWith(resolvedRoot + path7.sep) && fullPath !== resolvedRoot) {
|
|
24807
25646
|
throw new Error(`Path traversal detected: ${filePath}`);
|
|
24808
25647
|
}
|
|
24809
25648
|
return fullPath;
|
|
24810
25649
|
}
|
|
24811
25650
|
async function acquireFileLock(filePath) {
|
|
24812
|
-
const key =
|
|
25651
|
+
const key = path7.resolve(filePath);
|
|
24813
25652
|
while (fileLocks.has(key)) {
|
|
24814
25653
|
await fileLocks.get(key);
|
|
24815
25654
|
}
|
|
24816
25655
|
let release;
|
|
24817
|
-
const lockPromise = new Promise((
|
|
24818
|
-
release =
|
|
25656
|
+
const lockPromise = new Promise((resolve2) => {
|
|
25657
|
+
release = resolve2;
|
|
24819
25658
|
});
|
|
24820
25659
|
fileLocks.set(key, lockPromise);
|
|
24821
25660
|
return () => {
|
|
@@ -24827,8 +25666,8 @@ function escapeHtml2(text) {
|
|
|
24827
25666
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
24828
25667
|
}
|
|
24829
25668
|
function relativeImportPath2(fromFile, toFile) {
|
|
24830
|
-
const fromDir =
|
|
24831
|
-
let rel =
|
|
25669
|
+
const fromDir = path7.dirname(fromFile);
|
|
25670
|
+
let rel = path7.relative(fromDir, toFile).split(path7.sep).join("/");
|
|
24832
25671
|
if (!rel.startsWith("."))
|
|
24833
25672
|
rel = `./${rel}`;
|
|
24834
25673
|
return rel;
|
|
@@ -24841,7 +25680,7 @@ var init_utils2 = __esm(() => {
|
|
|
24841
25680
|
|
|
24842
25681
|
// ../cms/src/handlers/component-ops.ts
|
|
24843
25682
|
import fs3 from "fs/promises";
|
|
24844
|
-
import
|
|
25683
|
+
import path8 from "path";
|
|
24845
25684
|
async function handleInsertComponent(request, manifestWriter) {
|
|
24846
25685
|
const { position, referenceComponentId, componentName, props, meta } = request;
|
|
24847
25686
|
if (!meta?.url) {
|
|
@@ -24982,12 +25821,12 @@ async function handleRemoveComponent(request, manifestWriter) {
|
|
|
24982
25821
|
function findComponentBounds(lines, startLineIndex, componentName) {
|
|
24983
25822
|
const startLine = startLineIndex;
|
|
24984
25823
|
let tagClosed = false;
|
|
24985
|
-
for (let
|
|
24986
|
-
const currentLine = lines[
|
|
25824
|
+
for (let i2 = startLineIndex;i2 < lines.length; i2++) {
|
|
25825
|
+
const currentLine = lines[i2];
|
|
24987
25826
|
const selfCloseIdx = currentLine.indexOf("/>");
|
|
24988
25827
|
const openEndIdx = currentLine.indexOf(">");
|
|
24989
25828
|
if (selfCloseIdx >= 0 && (openEndIdx < 0 || selfCloseIdx <= openEndIdx)) {
|
|
24990
|
-
return { startLine, endLine:
|
|
25829
|
+
return { startLine, endLine: i2 };
|
|
24991
25830
|
}
|
|
24992
25831
|
if (openEndIdx >= 0) {
|
|
24993
25832
|
tagClosed = true;
|
|
@@ -25001,8 +25840,8 @@ function findComponentBounds(lines, startLineIndex, componentName) {
|
|
|
25001
25840
|
const closingTag = `</${componentName}>`;
|
|
25002
25841
|
let depth = 1;
|
|
25003
25842
|
let endLine = startLineIndex;
|
|
25004
|
-
for (let
|
|
25005
|
-
const currentLine = lines[
|
|
25843
|
+
for (let i2 = startLineIndex + 1;i2 < lines.length; i2++) {
|
|
25844
|
+
const currentLine = lines[i2];
|
|
25006
25845
|
const openingMatches = currentLine.match(new RegExp(`<${escapedName}(?:\\s|>)`, "g"));
|
|
25007
25846
|
if (openingMatches) {
|
|
25008
25847
|
for (const match of openingMatches) {
|
|
@@ -25018,7 +25857,7 @@ function findComponentBounds(lines, startLineIndex, componentName) {
|
|
|
25018
25857
|
depth -= closingMatches.length;
|
|
25019
25858
|
}
|
|
25020
25859
|
if (depth <= 0) {
|
|
25021
|
-
endLine =
|
|
25860
|
+
endLine = i2;
|
|
25022
25861
|
break;
|
|
25023
25862
|
}
|
|
25024
25863
|
}
|
|
@@ -25059,7 +25898,7 @@ function getComponentOccurrenceIndex(manifest, referenceComponent) {
|
|
|
25059
25898
|
async function findComponentInvocationFile(projectRoot, pageUrl, manifest, referenceComponent) {
|
|
25060
25899
|
if (referenceComponent.invocationSourcePath) {
|
|
25061
25900
|
const filePath = normalizeFilePath(referenceComponent.invocationSourcePath);
|
|
25062
|
-
const fullPath =
|
|
25901
|
+
const fullPath = path8.resolve(projectRoot, filePath);
|
|
25063
25902
|
try {
|
|
25064
25903
|
const content = await fs3.readFile(fullPath, "utf-8");
|
|
25065
25904
|
const lines = content.split(`
|
|
@@ -25073,7 +25912,7 @@ async function findComponentInvocationFile(projectRoot, pageUrl, manifest, refer
|
|
|
25073
25912
|
const candidates = getPageFileCandidates(pageUrl);
|
|
25074
25913
|
const occurrenceIndex = getComponentOccurrenceIndex(manifest, referenceComponent);
|
|
25075
25914
|
for (const candidate of candidates) {
|
|
25076
|
-
const fullPath =
|
|
25915
|
+
const fullPath = path8.resolve(projectRoot, candidate);
|
|
25077
25916
|
try {
|
|
25078
25917
|
const content = await fs3.readFile(fullPath, "utf-8");
|
|
25079
25918
|
const lines = content.split(`
|
|
@@ -25089,22 +25928,22 @@ async function findComponentInvocationFile(projectRoot, pageUrl, manifest, refer
|
|
|
25089
25928
|
function findComponentInvocationLine(lines, componentName, occurrenceIndex) {
|
|
25090
25929
|
const pattern = new RegExp(`<${escapeRegex(componentName)}(?:\\s|>|/>|$)`);
|
|
25091
25930
|
const startLine = findFrontmatterEnd(lines);
|
|
25092
|
-
let
|
|
25093
|
-
for (let
|
|
25094
|
-
if (pattern.test(lines[
|
|
25095
|
-
if (
|
|
25096
|
-
return
|
|
25097
|
-
|
|
25931
|
+
let found2 = 0;
|
|
25932
|
+
for (let i2 = startLine;i2 < lines.length; i2++) {
|
|
25933
|
+
if (pattern.test(lines[i2])) {
|
|
25934
|
+
if (found2 === occurrenceIndex)
|
|
25935
|
+
return i2;
|
|
25936
|
+
found2++;
|
|
25098
25937
|
}
|
|
25099
25938
|
}
|
|
25100
|
-
return
|
|
25939
|
+
return found2 > 0 ? findComponentInvocationLine(lines, componentName, 0) : -1;
|
|
25101
25940
|
}
|
|
25102
25941
|
function findFrontmatterEnd(lines) {
|
|
25103
25942
|
if (lines.length === 0 || lines[0].trim() !== "---")
|
|
25104
25943
|
return 0;
|
|
25105
|
-
for (let
|
|
25106
|
-
if (lines[
|
|
25107
|
-
return
|
|
25944
|
+
for (let i2 = 1;i2 < lines.length; i2++) {
|
|
25945
|
+
if (lines[i2].trim() === "---")
|
|
25946
|
+
return i2 + 1;
|
|
25108
25947
|
}
|
|
25109
25948
|
return 0;
|
|
25110
25949
|
}
|
|
@@ -25133,7 +25972,7 @@ function getIndentation(line) {
|
|
|
25133
25972
|
function normalizeFilePath(p) {
|
|
25134
25973
|
if (!p.startsWith("/"))
|
|
25135
25974
|
return p;
|
|
25136
|
-
const projectRoot =
|
|
25975
|
+
const projectRoot = path8.resolve(getProjectRoot());
|
|
25137
25976
|
if (p.startsWith(projectRoot))
|
|
25138
25977
|
return p;
|
|
25139
25978
|
return p.slice(1);
|
|
@@ -25141,17 +25980,17 @@ function normalizeFilePath(p) {
|
|
|
25141
25980
|
function ensureComponentImport(lines, componentName, componentFile, targetFile) {
|
|
25142
25981
|
const importPattern = new RegExp(`import\\s+${escapeRegex(componentName)}\\s+from\\s+['"]`);
|
|
25143
25982
|
const frontmatterEnd = findFrontmatterEnd(lines);
|
|
25144
|
-
for (let
|
|
25145
|
-
if (importPattern.test(lines[
|
|
25983
|
+
for (let i2 = 0;i2 < frontmatterEnd; i2++) {
|
|
25984
|
+
if (importPattern.test(lines[i2])) {
|
|
25146
25985
|
return;
|
|
25147
25986
|
}
|
|
25148
25987
|
}
|
|
25149
25988
|
const importStatement = `import ${componentName} from '${relativeImportPath2(targetFile, componentFile)}'`;
|
|
25150
25989
|
if (frontmatterEnd > 0) {
|
|
25151
25990
|
let insertAt = 1;
|
|
25152
|
-
for (let
|
|
25153
|
-
if (/^\s*import\s/.test(lines[
|
|
25154
|
-
insertAt =
|
|
25991
|
+
for (let i2 = 1;i2 < frontmatterEnd - 1; i2++) {
|
|
25992
|
+
if (/^\s*import\s/.test(lines[i2])) {
|
|
25993
|
+
insertAt = i2 + 1;
|
|
25155
25994
|
}
|
|
25156
25995
|
}
|
|
25157
25996
|
lines.splice(insertAt, 0, importStatement);
|
|
@@ -25188,11 +26027,11 @@ function buildMapPattern(varName) {
|
|
|
25188
26027
|
}
|
|
25189
26028
|
function detectArrayPattern(lines, invocationLineIndex) {
|
|
25190
26029
|
const searchStart = Math.max(0, invocationLineIndex - 5);
|
|
25191
|
-
for (let
|
|
25192
|
-
const line = lines[
|
|
26030
|
+
for (let i2 = invocationLineIndex;i2 >= searchStart; i2--) {
|
|
26031
|
+
const line = lines[i2];
|
|
25193
26032
|
const match = line.match(new RegExp(buildMapPattern()));
|
|
25194
26033
|
if (match) {
|
|
25195
|
-
return { arrayVarName: match[1], mapLineIndex:
|
|
26034
|
+
return { arrayVarName: match[1], mapLineIndex: i2 };
|
|
25196
26035
|
}
|
|
25197
26036
|
}
|
|
25198
26037
|
return null;
|
|
@@ -25254,10 +26093,10 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25254
26093
|
let mapLineIndex = -1;
|
|
25255
26094
|
let occurrencesSeen = 0;
|
|
25256
26095
|
const mapPattern = new RegExp(buildMapPattern(arrayVarName));
|
|
25257
|
-
for (let
|
|
25258
|
-
if (mapPattern.test(lines2[
|
|
26096
|
+
for (let i2 = fmEnd2;i2 < lines2.length; i2++) {
|
|
26097
|
+
if (mapPattern.test(lines2[i2])) {
|
|
25259
26098
|
if (occurrencesSeen === mapOccurrence) {
|
|
25260
|
-
mapLineIndex =
|
|
26099
|
+
mapLineIndex = i2;
|
|
25261
26100
|
break;
|
|
25262
26101
|
}
|
|
25263
26102
|
occurrencesSeen++;
|
|
@@ -25271,7 +26110,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25271
26110
|
const elementBounds2 = findArrayDeclaration(frontmatterContent2, frontmatterStartLine2, arrayVarName);
|
|
25272
26111
|
if (!elementBounds2 || elementBounds2.length === 0)
|
|
25273
26112
|
return null;
|
|
25274
|
-
const sameSourceComponents2 = Object.values(manifest.components).filter((c) => c.componentName === component.componentName && c.invocationSourcePath === component.invocationSourcePath).sort((a,
|
|
26113
|
+
const sameSourceComponents2 = Object.values(manifest.components).filter((c) => c.componentName === component.componentName && c.invocationSourcePath === component.invocationSourcePath).sort((a, b2) => (a.invocationIndex ?? 0) - (b2.invocationIndex ?? 0));
|
|
25275
26114
|
const arrayIndex2 = sameSourceComponents2.findIndex((c) => c.id === component.id);
|
|
25276
26115
|
if (arrayIndex2 < 0 || arrayIndex2 >= elementBounds2.length)
|
|
25277
26116
|
return null;
|
|
@@ -25318,7 +26157,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25318
26157
|
return null;
|
|
25319
26158
|
}
|
|
25320
26159
|
const occurrenceIndex = getComponentOccurrenceIndex(manifest, component);
|
|
25321
|
-
const sameSourceComponents = Object.values(manifest.components).filter((c) => c.componentName === component.componentName && c.invocationSourcePath === component.invocationSourcePath).sort((a,
|
|
26160
|
+
const sameSourceComponents = Object.values(manifest.components).filter((c) => c.componentName === component.componentName && c.invocationSourcePath === component.invocationSourcePath).sort((a, b2) => (a.invocationIndex ?? 0) - (b2.invocationIndex ?? 0));
|
|
25322
26161
|
const arrayIndex = sameSourceComponents.findIndex((c) => c.id === component.id);
|
|
25323
26162
|
if (arrayIndex < 0 || arrayIndex >= elementBounds.length) {
|
|
25324
26163
|
return null;
|
|
@@ -25450,8 +26289,8 @@ async function handleAddArrayItem(request, manifestWriter) {
|
|
|
25450
26289
|
const newElement = generateObjectLiteral(props);
|
|
25451
26290
|
const indentation = getIndentation(freshLines[refBounds.startLine]);
|
|
25452
26291
|
const indentedLines = newElement.split(`
|
|
25453
|
-
`).map((line,
|
|
25454
|
-
if (
|
|
26292
|
+
`).map((line, i2) => {
|
|
26293
|
+
if (i2 === 0)
|
|
25455
26294
|
return indentation + line;
|
|
25456
26295
|
if (line.trim())
|
|
25457
26296
|
return indentation + line;
|
|
@@ -25475,11 +26314,11 @@ async function handleAddArrayItem(request, manifestWriter) {
|
|
|
25475
26314
|
const addedLineCount = indentedLines.split(`
|
|
25476
26315
|
`).length;
|
|
25477
26316
|
const closingSearchStart = lastEl.endLine + addedLineCount + 1;
|
|
25478
|
-
for (let
|
|
25479
|
-
if (freshLines[
|
|
25480
|
-
const prev = freshLines[
|
|
26317
|
+
for (let i2 = closingSearchStart;i2 < closingSearchStart + 5 && i2 < freshLines.length; i2++) {
|
|
26318
|
+
if (freshLines[i2].trim().startsWith("]")) {
|
|
26319
|
+
const prev = freshLines[i2 - 1];
|
|
25481
26320
|
if (prev?.trimEnd().endsWith(",")) {
|
|
25482
|
-
freshLines[
|
|
26321
|
+
freshLines[i2 - 1] = prev.replace(/,(\s*)$/, "$1");
|
|
25483
26322
|
}
|
|
25484
26323
|
break;
|
|
25485
26324
|
}
|
|
@@ -25541,45 +26380,45 @@ var init_array_ops = __esm(() => {
|
|
|
25541
26380
|
// ../cms/src/astro-image-paths.ts
|
|
25542
26381
|
import { createHash as createHash2 } from "crypto";
|
|
25543
26382
|
import fs5 from "fs/promises";
|
|
25544
|
-
import
|
|
26383
|
+
import path9 from "path";
|
|
25545
26384
|
function isHugoStyleEntry(entryAbsPath) {
|
|
25546
|
-
return HUGO_INDEX_RE.test(
|
|
26385
|
+
return HUGO_INDEX_RE.test(path9.basename(entryAbsPath));
|
|
25547
26386
|
}
|
|
25548
26387
|
function shortContentHash(buf) {
|
|
25549
26388
|
return createHash2("sha256").update(buf).digest("hex").slice(0, 8);
|
|
25550
26389
|
}
|
|
25551
26390
|
async function pickAstroImageTarget(args) {
|
|
25552
|
-
const entryDir =
|
|
26391
|
+
const entryDir = path9.dirname(args.entryAbsPath);
|
|
25553
26392
|
const isHugoStyle = isHugoStyleEntry(args.entryAbsPath);
|
|
25554
|
-
const safeFilename =
|
|
26393
|
+
const safeFilename = path9.basename(args.originalFilename);
|
|
25555
26394
|
if (!safeFilename || safeFilename === "." || safeFilename === "..") {
|
|
25556
26395
|
throw new Error(`Invalid filename: ${args.originalFilename}`);
|
|
25557
26396
|
}
|
|
25558
26397
|
const baseName = isHugoStyle ? safeFilename : `${args.slug}-${safeFilename}`;
|
|
25559
|
-
const baseAbs =
|
|
26398
|
+
const baseAbs = path9.join(entryDir, baseName);
|
|
25560
26399
|
if (await isFreeOrMatching(baseAbs, args.compareBuffer)) {
|
|
25561
26400
|
return { absPath: baseAbs, relPath: `./${baseName}` };
|
|
25562
26401
|
}
|
|
25563
26402
|
const candidateAbs = await pickHashedSibling(entryDir, baseName, args.compareBuffer);
|
|
25564
|
-
return { absPath: candidateAbs, relPath: `./${
|
|
26403
|
+
return { absPath: candidateAbs, relPath: `./${path9.basename(candidateAbs)}` };
|
|
25565
26404
|
}
|
|
25566
26405
|
async function pickSiblingTarget(dir, filename, buf) {
|
|
25567
|
-
const safe =
|
|
26406
|
+
const safe = path9.basename(filename);
|
|
25568
26407
|
if (!safe || safe === "." || safe === "..") {
|
|
25569
26408
|
throw new Error(`Invalid filename: ${filename}`);
|
|
25570
26409
|
}
|
|
25571
|
-
const baseAbs =
|
|
26410
|
+
const baseAbs = path9.join(dir, safe);
|
|
25572
26411
|
if (await isFreeOrMatching(baseAbs, buf))
|
|
25573
26412
|
return baseAbs;
|
|
25574
26413
|
return pickHashedSibling(dir, safe, buf);
|
|
25575
26414
|
}
|
|
25576
26415
|
async function pickHashedSibling(dir, baseName, buf) {
|
|
25577
26416
|
const hash = shortContentHash(buf);
|
|
25578
|
-
const ext =
|
|
25579
|
-
const stem =
|
|
26417
|
+
const ext = path9.extname(baseName);
|
|
26418
|
+
const stem = path9.basename(baseName, ext);
|
|
25580
26419
|
for (let attempt = 0;attempt < 5; attempt++) {
|
|
25581
26420
|
const suffix = attempt === 0 ? hash : `${hash}-${attempt}`;
|
|
25582
|
-
const candidateAbs =
|
|
26421
|
+
const candidateAbs = path9.join(dir, `${stem}-${suffix}${ext}`);
|
|
25583
26422
|
if (await isFreeOrMatching(candidateAbs, buf))
|
|
25584
26423
|
return candidateAbs;
|
|
25585
26424
|
}
|
|
@@ -25603,7 +26442,7 @@ var init_astro_image_paths = __esm(() => {
|
|
|
25603
26442
|
|
|
25604
26443
|
// ../cms/src/handlers/astro-image-upload.ts
|
|
25605
26444
|
import fs6 from "fs/promises";
|
|
25606
|
-
import
|
|
26445
|
+
import path10 from "path";
|
|
25607
26446
|
async function tryAstroImageUpload(args) {
|
|
25608
26447
|
const { collection, entry, field } = args.context;
|
|
25609
26448
|
if (!collection || !entry || !field)
|
|
@@ -25612,7 +26451,7 @@ async function tryAstroImageUpload(args) {
|
|
|
25612
26451
|
const def = definitions[collection];
|
|
25613
26452
|
if (!def)
|
|
25614
26453
|
return null;
|
|
25615
|
-
const fieldDef = def.fields.find((
|
|
26454
|
+
const fieldDef = def.fields.find((f2) => f2.name === field);
|
|
25616
26455
|
if (!fieldDef?.astroImage)
|
|
25617
26456
|
return null;
|
|
25618
26457
|
const entryInfo = def.entries?.find((e) => e.slug === entry);
|
|
@@ -25625,12 +26464,12 @@ async function tryAstroImageUpload(args) {
|
|
|
25625
26464
|
originalFilename: args.originalFilename,
|
|
25626
26465
|
compareBuffer: args.fileBuffer
|
|
25627
26466
|
});
|
|
25628
|
-
await fs6.mkdir(
|
|
26467
|
+
await fs6.mkdir(path10.dirname(target.absPath), { recursive: true });
|
|
25629
26468
|
await fs6.writeFile(target.absPath, args.fileBuffer);
|
|
25630
26469
|
return {
|
|
25631
26470
|
success: true,
|
|
25632
26471
|
url: target.relPath,
|
|
25633
|
-
filename:
|
|
26472
|
+
filename: path10.basename(target.absPath)
|
|
25634
26473
|
};
|
|
25635
26474
|
}
|
|
25636
26475
|
var init_astro_image_upload = __esm(() => {
|
|
@@ -25644,8 +26483,8 @@ async function handleCheckSlugExists(slug) {
|
|
|
25644
26483
|
const normalizedSlug = slugify2(slug);
|
|
25645
26484
|
if (!normalizedSlug)
|
|
25646
26485
|
return { exists: false };
|
|
25647
|
-
const
|
|
25648
|
-
return
|
|
26486
|
+
const found2 = await findPageFile(`/${normalizedSlug}`);
|
|
26487
|
+
return found2 ? { exists: true, filePath: found2 } : { exists: false };
|
|
25649
26488
|
}
|
|
25650
26489
|
async function fileExists(fullPath) {
|
|
25651
26490
|
try {
|
|
@@ -25677,7 +26516,7 @@ var init_page_ops2 = __esm(() => {
|
|
|
25677
26516
|
|
|
25678
26517
|
// ../cms/src/handlers/request-utils.ts
|
|
25679
26518
|
function readBody(req, maxSize = MAX_BODY_SIZE) {
|
|
25680
|
-
return new Promise((
|
|
26519
|
+
return new Promise((resolve2, reject) => {
|
|
25681
26520
|
const chunks = [];
|
|
25682
26521
|
let totalSize = 0;
|
|
25683
26522
|
req.on("data", (chunk) => {
|
|
@@ -25689,7 +26528,7 @@ function readBody(req, maxSize = MAX_BODY_SIZE) {
|
|
|
25689
26528
|
}
|
|
25690
26529
|
chunks.push(chunk);
|
|
25691
26530
|
});
|
|
25692
|
-
req.on("end", () =>
|
|
26531
|
+
req.on("end", () => resolve2(Buffer.concat(chunks)));
|
|
25693
26532
|
req.on("error", reject);
|
|
25694
26533
|
});
|
|
25695
26534
|
}
|
|
@@ -25877,8 +26716,8 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25877
26716
|
var parseError = function(message) {
|
|
25878
26717
|
throw Error("Parse error: " + message);
|
|
25879
26718
|
};
|
|
25880
|
-
var
|
|
25881
|
-
options = merge(options,
|
|
26719
|
+
var encode2 = function(string, options) {
|
|
26720
|
+
options = merge(options, encode2.options);
|
|
25882
26721
|
var strict = options.strict;
|
|
25883
26722
|
if (strict && regexInvalidRawCodePoint.test(string)) {
|
|
25884
26723
|
parseError("forbidden code point");
|
|
@@ -25925,15 +26764,15 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25925
26764
|
return escapeCodePoint(codePoint);
|
|
25926
26765
|
}).replace(regexBmpWhitelist, escapeBmpSymbol);
|
|
25927
26766
|
};
|
|
25928
|
-
|
|
26767
|
+
encode2.options = {
|
|
25929
26768
|
allowUnsafeSymbols: false,
|
|
25930
26769
|
encodeEverything: false,
|
|
25931
26770
|
strict: false,
|
|
25932
26771
|
useNamedReferences: false,
|
|
25933
26772
|
decimal: false
|
|
25934
26773
|
};
|
|
25935
|
-
var
|
|
25936
|
-
options = merge(options,
|
|
26774
|
+
var decode2 = function(html, options) {
|
|
26775
|
+
options = merge(options, decode2.options);
|
|
25937
26776
|
var strict = options.strict;
|
|
25938
26777
|
if (strict && regexInvalidEntity.test(html)) {
|
|
25939
26778
|
parseError("malformed character reference");
|
|
@@ -25988,7 +26827,7 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25988
26827
|
return $0;
|
|
25989
26828
|
});
|
|
25990
26829
|
};
|
|
25991
|
-
|
|
26830
|
+
decode2.options = {
|
|
25992
26831
|
isAttributeValue: false,
|
|
25993
26832
|
strict: false
|
|
25994
26833
|
};
|
|
@@ -25999,10 +26838,10 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25999
26838
|
};
|
|
26000
26839
|
var he = {
|
|
26001
26840
|
version: "1.2.0",
|
|
26002
|
-
encode,
|
|
26003
|
-
decode,
|
|
26841
|
+
encode: encode2,
|
|
26842
|
+
decode: decode2,
|
|
26004
26843
|
escape,
|
|
26005
|
-
unescape:
|
|
26844
|
+
unescape: decode2
|
|
26006
26845
|
};
|
|
26007
26846
|
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
|
|
26008
26847
|
define(function() {
|
|
@@ -26136,30 +26975,30 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
26136
26975
|
// ../../node_modules/domhandler/lib/node.js
|
|
26137
26976
|
var require_node2 = __commonJS((exports) => {
|
|
26138
26977
|
var __extends = exports && exports.__extends || function() {
|
|
26139
|
-
var extendStatics = function(
|
|
26140
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
26141
|
-
|
|
26142
|
-
} || function(
|
|
26143
|
-
for (var p in
|
|
26144
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
26145
|
-
|
|
26978
|
+
var extendStatics = function(d3, b2) {
|
|
26979
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d4, b3) {
|
|
26980
|
+
d4.__proto__ = b3;
|
|
26981
|
+
} || function(d4, b3) {
|
|
26982
|
+
for (var p in b3)
|
|
26983
|
+
if (Object.prototype.hasOwnProperty.call(b3, p))
|
|
26984
|
+
d4[p] = b3[p];
|
|
26146
26985
|
};
|
|
26147
|
-
return extendStatics(
|
|
26986
|
+
return extendStatics(d3, b2);
|
|
26148
26987
|
};
|
|
26149
|
-
return function(
|
|
26150
|
-
if (typeof
|
|
26151
|
-
throw new TypeError("Class extends value " + String(
|
|
26152
|
-
extendStatics(
|
|
26988
|
+
return function(d3, b2) {
|
|
26989
|
+
if (typeof b2 !== "function" && b2 !== null)
|
|
26990
|
+
throw new TypeError("Class extends value " + String(b2) + " is not a constructor or null");
|
|
26991
|
+
extendStatics(d3, b2);
|
|
26153
26992
|
function __() {
|
|
26154
|
-
this.constructor =
|
|
26993
|
+
this.constructor = d3;
|
|
26155
26994
|
}
|
|
26156
|
-
|
|
26995
|
+
d3.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __);
|
|
26157
26996
|
};
|
|
26158
26997
|
}();
|
|
26159
26998
|
var __assign = exports && exports.__assign || function() {
|
|
26160
26999
|
__assign = Object.assign || function(t) {
|
|
26161
|
-
for (var s,
|
|
26162
|
-
s = arguments[
|
|
27000
|
+
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
27001
|
+
s = arguments[i2];
|
|
26163
27002
|
for (var p in s)
|
|
26164
27003
|
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
26165
27004
|
t[p] = s[p];
|
|
@@ -26503,9 +27342,9 @@ var require_node2 = __commonJS((exports) => {
|
|
|
26503
27342
|
var children = childs.map(function(child) {
|
|
26504
27343
|
return cloneNode(child, true);
|
|
26505
27344
|
});
|
|
26506
|
-
for (var
|
|
26507
|
-
children[
|
|
26508
|
-
children[
|
|
27345
|
+
for (var i2 = 1;i2 < children.length; i2++) {
|
|
27346
|
+
children[i2].prev = children[i2 - 1];
|
|
27347
|
+
children[i2 - 1].next = children[i2];
|
|
26509
27348
|
}
|
|
26510
27349
|
return children;
|
|
26511
27350
|
}
|
|
@@ -26513,25 +27352,25 @@ var require_node2 = __commonJS((exports) => {
|
|
|
26513
27352
|
|
|
26514
27353
|
// ../../node_modules/domhandler/lib/index.js
|
|
26515
27354
|
var require_lib3 = __commonJS((exports) => {
|
|
26516
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
27355
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
26517
27356
|
if (k2 === undefined)
|
|
26518
27357
|
k2 = k;
|
|
26519
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
26520
|
-
if (!desc || ("get" in desc ? !
|
|
27358
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
27359
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
26521
27360
|
desc = { enumerable: true, get: function() {
|
|
26522
|
-
return
|
|
27361
|
+
return m2[k];
|
|
26523
27362
|
} };
|
|
26524
27363
|
}
|
|
26525
27364
|
Object.defineProperty(o, k2, desc);
|
|
26526
|
-
} : function(o,
|
|
27365
|
+
} : function(o, m2, k, k2) {
|
|
26527
27366
|
if (k2 === undefined)
|
|
26528
27367
|
k2 = k;
|
|
26529
|
-
o[k2] =
|
|
27368
|
+
o[k2] = m2[k];
|
|
26530
27369
|
});
|
|
26531
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
26532
|
-
for (var p in
|
|
27370
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
27371
|
+
for (var p in m2)
|
|
26533
27372
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
26534
|
-
__createBinding(exports2,
|
|
27373
|
+
__createBinding(exports2, m2, p);
|
|
26535
27374
|
};
|
|
26536
27375
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26537
27376
|
exports.DomHandler = undefined;
|
|
@@ -26745,25 +27584,25 @@ var require_decode_codepoint = __commonJS((exports) => {
|
|
|
26745
27584
|
|
|
26746
27585
|
// ../../node_modules/dom-serializer/node_modules/entities/lib/decode.js
|
|
26747
27586
|
var require_decode = __commonJS((exports) => {
|
|
26748
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
27587
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
26749
27588
|
if (k2 === undefined)
|
|
26750
27589
|
k2 = k;
|
|
26751
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
26752
|
-
if (!desc || ("get" in desc ? !
|
|
27590
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
27591
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
26753
27592
|
desc = { enumerable: true, get: function() {
|
|
26754
|
-
return
|
|
27593
|
+
return m2[k];
|
|
26755
27594
|
} };
|
|
26756
27595
|
}
|
|
26757
27596
|
Object.defineProperty(o, k2, desc);
|
|
26758
|
-
} : function(o,
|
|
27597
|
+
} : function(o, m2, k, k2) {
|
|
26759
27598
|
if (k2 === undefined)
|
|
26760
27599
|
k2 = k;
|
|
26761
|
-
o[k2] =
|
|
27600
|
+
o[k2] = m2[k];
|
|
26762
27601
|
});
|
|
26763
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
26764
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
26765
|
-
} : function(o,
|
|
26766
|
-
o["default"] =
|
|
27602
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
27603
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
27604
|
+
} : function(o, v2) {
|
|
27605
|
+
o["default"] = v2;
|
|
26767
27606
|
});
|
|
26768
27607
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
26769
27608
|
if (mod && mod.__esModule)
|
|
@@ -27097,8 +27936,8 @@ var require_decode = __commonJS((exports) => {
|
|
|
27097
27936
|
var require_encode_html = __commonJS((exports) => {
|
|
27098
27937
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27099
27938
|
function restoreDiff(arr) {
|
|
27100
|
-
for (var
|
|
27101
|
-
arr[
|
|
27939
|
+
for (var i2 = 1;i2 < arr.length; i2++) {
|
|
27940
|
+
arr[i2][0] += arr[i2 - 1][0] + 1;
|
|
27102
27941
|
}
|
|
27103
27942
|
return arr;
|
|
27104
27943
|
}
|
|
@@ -27127,14 +27966,14 @@ var require_escape = __commonJS((exports) => {
|
|
|
27127
27966
|
var lastIdx = 0;
|
|
27128
27967
|
var match;
|
|
27129
27968
|
while ((match = exports.xmlReplacer.exec(str)) !== null) {
|
|
27130
|
-
var
|
|
27131
|
-
var char = str.charCodeAt(
|
|
27969
|
+
var i2 = match.index;
|
|
27970
|
+
var char = str.charCodeAt(i2);
|
|
27132
27971
|
var next = xmlCodeMap.get(char);
|
|
27133
27972
|
if (next !== undefined) {
|
|
27134
|
-
ret += str.substring(lastIdx,
|
|
27135
|
-
lastIdx =
|
|
27973
|
+
ret += str.substring(lastIdx, i2) + next;
|
|
27974
|
+
lastIdx = i2 + 1;
|
|
27136
27975
|
} else {
|
|
27137
|
-
ret += "".concat(str.substring(lastIdx,
|
|
27976
|
+
ret += "".concat(str.substring(lastIdx, i2), "&#x").concat((0, exports.getCodePoint)(str, i2).toString(16), ";");
|
|
27138
27977
|
lastIdx = exports.xmlReplacer.lastIndex += Number((char & 64512) === 55296);
|
|
27139
27978
|
}
|
|
27140
27979
|
}
|
|
@@ -27194,13 +28033,13 @@ var require_encode = __commonJS((exports) => {
|
|
|
27194
28033
|
var lastIdx = 0;
|
|
27195
28034
|
var match;
|
|
27196
28035
|
while ((match = regExp.exec(str)) !== null) {
|
|
27197
|
-
var
|
|
27198
|
-
ret += str.substring(lastIdx,
|
|
27199
|
-
var char = str.charCodeAt(
|
|
28036
|
+
var i2 = match.index;
|
|
28037
|
+
ret += str.substring(lastIdx, i2);
|
|
28038
|
+
var char = str.charCodeAt(i2);
|
|
27200
28039
|
var next = encode_html_js_1.default.get(char);
|
|
27201
28040
|
if (typeof next === "object") {
|
|
27202
|
-
if (
|
|
27203
|
-
var nextChar = str.charCodeAt(
|
|
28041
|
+
if (i2 + 1 < str.length) {
|
|
28042
|
+
var nextChar = str.charCodeAt(i2 + 1);
|
|
27204
28043
|
var value = typeof next.n === "number" ? next.n === nextChar ? next.o : undefined : next.n.get(nextChar);
|
|
27205
28044
|
if (value !== undefined) {
|
|
27206
28045
|
ret += value;
|
|
@@ -27212,9 +28051,9 @@ var require_encode = __commonJS((exports) => {
|
|
|
27212
28051
|
}
|
|
27213
28052
|
if (next !== undefined) {
|
|
27214
28053
|
ret += next;
|
|
27215
|
-
lastIdx =
|
|
28054
|
+
lastIdx = i2 + 1;
|
|
27216
28055
|
} else {
|
|
27217
|
-
var cp = (0, escape_js_1.getCodePoint)(str,
|
|
28056
|
+
var cp = (0, escape_js_1.getCodePoint)(str, i2);
|
|
27218
28057
|
ret += "&#x".concat(cp.toString(16), ";");
|
|
27219
28058
|
lastIdx = regExp.lastIndex += Number(cp !== char);
|
|
27220
28059
|
}
|
|
@@ -27243,7 +28082,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27243
28082
|
EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
|
|
27244
28083
|
EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
|
|
27245
28084
|
})(EncodingMode = exports.EncodingMode || (exports.EncodingMode = {}));
|
|
27246
|
-
function
|
|
28085
|
+
function decode2(data, options) {
|
|
27247
28086
|
if (options === undefined) {
|
|
27248
28087
|
options = EntityLevel.XML;
|
|
27249
28088
|
}
|
|
@@ -27254,7 +28093,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27254
28093
|
}
|
|
27255
28094
|
return (0, decode_js_1.decodeXML)(data);
|
|
27256
28095
|
}
|
|
27257
|
-
exports.decode =
|
|
28096
|
+
exports.decode = decode2;
|
|
27258
28097
|
function decodeStrict(data, options) {
|
|
27259
28098
|
var _a;
|
|
27260
28099
|
if (options === undefined) {
|
|
@@ -27262,10 +28101,10 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27262
28101
|
}
|
|
27263
28102
|
var opts = typeof options === "number" ? { level: options } : options;
|
|
27264
28103
|
(_a = opts.mode) !== null && _a !== undefined || (opts.mode = decode_js_1.DecodingMode.Strict);
|
|
27265
|
-
return
|
|
28104
|
+
return decode2(data, opts);
|
|
27266
28105
|
}
|
|
27267
28106
|
exports.decodeStrict = decodeStrict;
|
|
27268
|
-
function
|
|
28107
|
+
function encode2(data, options) {
|
|
27269
28108
|
if (options === undefined) {
|
|
27270
28109
|
options = EntityLevel.XML;
|
|
27271
28110
|
}
|
|
@@ -27284,7 +28123,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27284
28123
|
}
|
|
27285
28124
|
return (0, escape_js_1.encodeXML)(data);
|
|
27286
28125
|
}
|
|
27287
|
-
exports.encode =
|
|
28126
|
+
exports.encode = encode2;
|
|
27288
28127
|
var escape_js_2 = require_escape();
|
|
27289
28128
|
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function() {
|
|
27290
28129
|
return escape_js_2.encodeXML;
|
|
@@ -27464,8 +28303,8 @@ var require_foreignNames = __commonJS((exports) => {
|
|
|
27464
28303
|
var require_lib5 = __commonJS((exports) => {
|
|
27465
28304
|
var __assign = exports && exports.__assign || function() {
|
|
27466
28305
|
__assign = Object.assign || function(t) {
|
|
27467
|
-
for (var s,
|
|
27468
|
-
s = arguments[
|
|
28306
|
+
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
28307
|
+
s = arguments[i2];
|
|
27469
28308
|
for (var p in s)
|
|
27470
28309
|
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
27471
28310
|
t[p] = s[p];
|
|
@@ -27474,25 +28313,25 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27474
28313
|
};
|
|
27475
28314
|
return __assign.apply(this, arguments);
|
|
27476
28315
|
};
|
|
27477
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
28316
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
27478
28317
|
if (k2 === undefined)
|
|
27479
28318
|
k2 = k;
|
|
27480
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
27481
|
-
if (!desc || ("get" in desc ? !
|
|
28319
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
28320
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
27482
28321
|
desc = { enumerable: true, get: function() {
|
|
27483
|
-
return
|
|
28322
|
+
return m2[k];
|
|
27484
28323
|
} };
|
|
27485
28324
|
}
|
|
27486
28325
|
Object.defineProperty(o, k2, desc);
|
|
27487
|
-
} : function(o,
|
|
28326
|
+
} : function(o, m2, k, k2) {
|
|
27488
28327
|
if (k2 === undefined)
|
|
27489
28328
|
k2 = k;
|
|
27490
|
-
o[k2] =
|
|
28329
|
+
o[k2] = m2[k];
|
|
27491
28330
|
});
|
|
27492
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
27493
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
27494
|
-
} : function(o,
|
|
27495
|
-
o["default"] =
|
|
28331
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
28332
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
28333
|
+
} : function(o, v2) {
|
|
28334
|
+
o["default"] = v2;
|
|
27496
28335
|
});
|
|
27497
28336
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
27498
28337
|
if (mod && mod.__esModule)
|
|
@@ -27528,7 +28367,7 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27528
28367
|
var _a;
|
|
27529
28368
|
if (!attributes)
|
|
27530
28369
|
return;
|
|
27531
|
-
var
|
|
28370
|
+
var encode2 = ((_a = opts.encodeEntities) !== null && _a !== undefined ? _a : opts.decodeEntities) === false ? replaceQuotes : opts.xmlMode || opts.encodeEntities !== "utf8" ? entities_1.encodeXML : entities_1.escapeAttribute;
|
|
27532
28371
|
return Object.keys(attributes).map(function(key) {
|
|
27533
28372
|
var _a2, _b;
|
|
27534
28373
|
var value = (_a2 = attributes[key]) !== null && _a2 !== undefined ? _a2 : "";
|
|
@@ -27538,7 +28377,7 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27538
28377
|
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
|
27539
28378
|
return key;
|
|
27540
28379
|
}
|
|
27541
|
-
return "".concat(key, '="').concat(
|
|
28380
|
+
return "".concat(key, '="').concat(encode2(value), '"');
|
|
27542
28381
|
}).join(" ");
|
|
27543
28382
|
}
|
|
27544
28383
|
var singleTag = new Set([
|
|
@@ -27568,8 +28407,8 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27568
28407
|
}
|
|
27569
28408
|
var nodes = "length" in node ? node : [node];
|
|
27570
28409
|
var output = "";
|
|
27571
|
-
for (var
|
|
27572
|
-
output += renderNode(nodes[
|
|
28410
|
+
for (var i2 = 0;i2 < nodes.length; i2++) {
|
|
28411
|
+
output += renderNode(nodes[i2], options);
|
|
27573
28412
|
}
|
|
27574
28413
|
return output;
|
|
27575
28414
|
}
|
|
@@ -27925,15 +28764,15 @@ var require_querying = __commonJS((exports) => {
|
|
|
27925
28764
|
recurse = true;
|
|
27926
28765
|
}
|
|
27927
28766
|
var searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
|
|
27928
|
-
for (var
|
|
27929
|
-
var node = searchedNodes[
|
|
28767
|
+
for (var i2 = 0;i2 < searchedNodes.length; i2++) {
|
|
28768
|
+
var node = searchedNodes[i2];
|
|
27930
28769
|
if ((0, domhandler_1.isTag)(node) && test(node)) {
|
|
27931
28770
|
return node;
|
|
27932
28771
|
}
|
|
27933
28772
|
if (recurse && (0, domhandler_1.hasChildren)(node) && node.children.length > 0) {
|
|
27934
|
-
var
|
|
27935
|
-
if (
|
|
27936
|
-
return
|
|
28773
|
+
var found2 = findOne(test, node.children, true);
|
|
28774
|
+
if (found2)
|
|
28775
|
+
return found2;
|
|
27937
28776
|
}
|
|
27938
28777
|
}
|
|
27939
28778
|
return null;
|
|
@@ -28022,9 +28861,9 @@ var require_legacy = __commonJS((exports) => {
|
|
|
28022
28861
|
return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value;
|
|
28023
28862
|
};
|
|
28024
28863
|
}
|
|
28025
|
-
function combineFuncs(a,
|
|
28864
|
+
function combineFuncs(a, b2) {
|
|
28026
28865
|
return function(elem) {
|
|
28027
|
-
return a(elem) ||
|
|
28866
|
+
return a(elem) || b2(elem);
|
|
28028
28867
|
};
|
|
28029
28868
|
}
|
|
28030
28869
|
function compileTest(options) {
|
|
@@ -28155,11 +28994,11 @@ var require_helpers = __commonJS((exports) => {
|
|
|
28155
28994
|
return DocumentPosition.PRECEDING;
|
|
28156
28995
|
}
|
|
28157
28996
|
function uniqueSort(nodes) {
|
|
28158
|
-
nodes = nodes.filter(function(node,
|
|
28159
|
-
return !arr.includes(node,
|
|
28997
|
+
nodes = nodes.filter(function(node, i2, arr) {
|
|
28998
|
+
return !arr.includes(node, i2 + 1);
|
|
28160
28999
|
});
|
|
28161
|
-
nodes.sort(function(a,
|
|
28162
|
-
var relative = compareDocumentPosition(a,
|
|
29000
|
+
nodes.sort(function(a, b2) {
|
|
29001
|
+
var relative = compareDocumentPosition(a, b2);
|
|
28163
29002
|
if (relative & DocumentPosition.PRECEDING) {
|
|
28164
29003
|
return -1;
|
|
28165
29004
|
} else if (relative & DocumentPosition.FOLLOWING) {
|
|
@@ -28310,25 +29149,25 @@ var require_feeds = __commonJS((exports) => {
|
|
|
28310
29149
|
|
|
28311
29150
|
// ../../node_modules/domutils/lib/index.js
|
|
28312
29151
|
var require_lib6 = __commonJS((exports) => {
|
|
28313
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
29152
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
28314
29153
|
if (k2 === undefined)
|
|
28315
29154
|
k2 = k;
|
|
28316
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
28317
|
-
if (!desc || ("get" in desc ? !
|
|
29155
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
29156
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
28318
29157
|
desc = { enumerable: true, get: function() {
|
|
28319
|
-
return
|
|
29158
|
+
return m2[k];
|
|
28320
29159
|
} };
|
|
28321
29160
|
}
|
|
28322
29161
|
Object.defineProperty(o, k2, desc);
|
|
28323
|
-
} : function(o,
|
|
29162
|
+
} : function(o, m2, k, k2) {
|
|
28324
29163
|
if (k2 === undefined)
|
|
28325
29164
|
k2 = k;
|
|
28326
|
-
o[k2] =
|
|
29165
|
+
o[k2] = m2[k];
|
|
28327
29166
|
});
|
|
28328
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
28329
|
-
for (var p in
|
|
29167
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
29168
|
+
for (var p in m2)
|
|
28330
29169
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
28331
|
-
__createBinding(exports2,
|
|
29170
|
+
__createBinding(exports2, m2, p);
|
|
28332
29171
|
};
|
|
28333
29172
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28334
29173
|
exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = undefined;
|
|
@@ -28448,7 +29287,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28448
29287
|
}
|
|
28449
29288
|
exports.isTraversal = isTraversal;
|
|
28450
29289
|
var stripQuotesFromPseudos = new Set(["contains", "icontains"]);
|
|
28451
|
-
function funescape(
|
|
29290
|
+
function funescape(_2, escaped, escapedWhitespace) {
|
|
28452
29291
|
var high = parseInt(escaped, 16) - 65536;
|
|
28453
29292
|
return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
|
|
28454
29293
|
}
|
|
@@ -28461,7 +29300,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28461
29300
|
function isWhitespace(c) {
|
|
28462
29301
|
return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
|
|
28463
29302
|
}
|
|
28464
|
-
function
|
|
29303
|
+
function parse3(selector) {
|
|
28465
29304
|
var subselects = [];
|
|
28466
29305
|
var endIndex = parseSelector(subselects, "".concat(selector), 0);
|
|
28467
29306
|
if (endIndex < selector.length) {
|
|
@@ -28469,7 +29308,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28469
29308
|
}
|
|
28470
29309
|
return subselects;
|
|
28471
29310
|
}
|
|
28472
|
-
exports.parse =
|
|
29311
|
+
exports.parse = parse3;
|
|
28473
29312
|
function parseSelector(subselects, selector, selectorIndex) {
|
|
28474
29313
|
var tokens = [];
|
|
28475
29314
|
function getName(offset) {
|
|
@@ -28757,11 +29596,11 @@ var require_parse = __commonJS((exports) => {
|
|
|
28757
29596
|
var require_stringify3 = __commonJS((exports) => {
|
|
28758
29597
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
28759
29598
|
if (pack || arguments.length === 2)
|
|
28760
|
-
for (var
|
|
28761
|
-
if (ar || !(
|
|
29599
|
+
for (var i2 = 0, l = from.length, ar;i2 < l; i2++) {
|
|
29600
|
+
if (ar || !(i2 in from)) {
|
|
28762
29601
|
if (!ar)
|
|
28763
|
-
ar = Array.prototype.slice.call(from, 0,
|
|
28764
|
-
ar[
|
|
29602
|
+
ar = Array.prototype.slice.call(from, 0, i2);
|
|
29603
|
+
ar[i2] = from[i2];
|
|
28765
29604
|
}
|
|
28766
29605
|
}
|
|
28767
29606
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
@@ -28865,10 +29704,10 @@ var require_stringify3 = __commonJS((exports) => {
|
|
|
28865
29704
|
function escapeName(str, charsToEscape) {
|
|
28866
29705
|
var lastIdx = 0;
|
|
28867
29706
|
var ret = "";
|
|
28868
|
-
for (var
|
|
28869
|
-
if (charsToEscape.has(str.charCodeAt(
|
|
28870
|
-
ret += "".concat(str.slice(lastIdx,
|
|
28871
|
-
lastIdx =
|
|
29707
|
+
for (var i2 = 0;i2 < str.length; i2++) {
|
|
29708
|
+
if (charsToEscape.has(str.charCodeAt(i2))) {
|
|
29709
|
+
ret += "".concat(str.slice(lastIdx, i2), "\\").concat(str.charAt(i2));
|
|
29710
|
+
lastIdx = i2 + 1;
|
|
28872
29711
|
}
|
|
28873
29712
|
}
|
|
28874
29713
|
return ret.length > 0 ? ret + str.slice(lastIdx) : str;
|
|
@@ -28877,25 +29716,25 @@ var require_stringify3 = __commonJS((exports) => {
|
|
|
28877
29716
|
|
|
28878
29717
|
// ../../node_modules/css-what/lib/commonjs/index.js
|
|
28879
29718
|
var require_commonjs = __commonJS((exports) => {
|
|
28880
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
29719
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
28881
29720
|
if (k2 === undefined)
|
|
28882
29721
|
k2 = k;
|
|
28883
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
28884
|
-
if (!desc || ("get" in desc ? !
|
|
29722
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
29723
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
28885
29724
|
desc = { enumerable: true, get: function() {
|
|
28886
|
-
return
|
|
29725
|
+
return m2[k];
|
|
28887
29726
|
} };
|
|
28888
29727
|
}
|
|
28889
29728
|
Object.defineProperty(o, k2, desc);
|
|
28890
|
-
} : function(o,
|
|
29729
|
+
} : function(o, m2, k, k2) {
|
|
28891
29730
|
if (k2 === undefined)
|
|
28892
29731
|
k2 = k;
|
|
28893
|
-
o[k2] =
|
|
29732
|
+
o[k2] = m2[k];
|
|
28894
29733
|
});
|
|
28895
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
28896
|
-
for (var p in
|
|
29734
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
29735
|
+
for (var p in m2)
|
|
28897
29736
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
28898
|
-
__createBinding(exports2,
|
|
29737
|
+
__createBinding(exports2, m2, p);
|
|
28899
29738
|
};
|
|
28900
29739
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28901
29740
|
exports.stringify = exports.parse = exports.isTraversal = undefined;
|
|
@@ -28938,11 +29777,11 @@ var require_sort = __commonJS((exports) => {
|
|
|
28938
29777
|
]);
|
|
28939
29778
|
function sortByProcedure(arr) {
|
|
28940
29779
|
var procs = arr.map(getProcedure);
|
|
28941
|
-
for (var
|
|
28942
|
-
var procNew = procs[
|
|
29780
|
+
for (var i2 = 1;i2 < arr.length; i2++) {
|
|
29781
|
+
var procNew = procs[i2];
|
|
28943
29782
|
if (procNew < 0)
|
|
28944
29783
|
continue;
|
|
28945
|
-
for (var j =
|
|
29784
|
+
for (var j = i2 - 1;j >= 0 && procNew < procs[j]; j--) {
|
|
28946
29785
|
var token = arr[j + 1];
|
|
28947
29786
|
arr[j + 1] = arr[j];
|
|
28948
29787
|
arr[j] = token;
|
|
@@ -28969,8 +29808,8 @@ var require_sort = __commonJS((exports) => {
|
|
|
28969
29808
|
} else if (token.name === "has" || token.name === "contains") {
|
|
28970
29809
|
proc = 0;
|
|
28971
29810
|
} else if (Array.isArray(token.data)) {
|
|
28972
|
-
proc = Math.min.apply(Math, token.data.map(function(
|
|
28973
|
-
return Math.min.apply(Math,
|
|
29811
|
+
proc = Math.min.apply(Math, token.data.map(function(d3) {
|
|
29812
|
+
return Math.min.apply(Math, d3.map(getProcedure));
|
|
28974
29813
|
}));
|
|
28975
29814
|
if (proc < 0) {
|
|
28976
29815
|
proc = 0;
|
|
@@ -29185,7 +30024,7 @@ var require_parse2 = __commonJS((exports) => {
|
|
|
29185
30024
|
var whitespace = new Set([9, 10, 12, 13, 32]);
|
|
29186
30025
|
var ZERO = 48;
|
|
29187
30026
|
var NINE = 57;
|
|
29188
|
-
function
|
|
30027
|
+
function parse3(formula) {
|
|
29189
30028
|
formula = formula.trim().toLowerCase();
|
|
29190
30029
|
if (formula === "even") {
|
|
29191
30030
|
return [2, 0];
|
|
@@ -29237,7 +30076,7 @@ var require_parse2 = __commonJS((exports) => {
|
|
|
29237
30076
|
}
|
|
29238
30077
|
}
|
|
29239
30078
|
}
|
|
29240
|
-
exports.parse =
|
|
30079
|
+
exports.parse = parse3;
|
|
29241
30080
|
});
|
|
29242
30081
|
|
|
29243
30082
|
// ../../node_modules/nth-check/lib/compile.js
|
|
@@ -29250,53 +30089,53 @@ var require_compile = __commonJS((exports) => {
|
|
|
29250
30089
|
var boolbase_1 = __importDefault(require_boolbase());
|
|
29251
30090
|
function compile(parsed) {
|
|
29252
30091
|
var a = parsed[0];
|
|
29253
|
-
var
|
|
29254
|
-
if (
|
|
30092
|
+
var b2 = parsed[1] - 1;
|
|
30093
|
+
if (b2 < 0 && a <= 0)
|
|
29255
30094
|
return boolbase_1.default.falseFunc;
|
|
29256
30095
|
if (a === -1)
|
|
29257
30096
|
return function(index) {
|
|
29258
|
-
return index <=
|
|
30097
|
+
return index <= b2;
|
|
29259
30098
|
};
|
|
29260
30099
|
if (a === 0)
|
|
29261
30100
|
return function(index) {
|
|
29262
|
-
return index ===
|
|
30101
|
+
return index === b2;
|
|
29263
30102
|
};
|
|
29264
30103
|
if (a === 1)
|
|
29265
|
-
return
|
|
29266
|
-
return index >=
|
|
30104
|
+
return b2 < 0 ? boolbase_1.default.trueFunc : function(index) {
|
|
30105
|
+
return index >= b2;
|
|
29267
30106
|
};
|
|
29268
30107
|
var absA = Math.abs(a);
|
|
29269
|
-
var bMod = (
|
|
30108
|
+
var bMod = (b2 % absA + absA) % absA;
|
|
29270
30109
|
return a > 1 ? function(index) {
|
|
29271
|
-
return index >=
|
|
30110
|
+
return index >= b2 && index % absA === bMod;
|
|
29272
30111
|
} : function(index) {
|
|
29273
|
-
return index <=
|
|
30112
|
+
return index <= b2 && index % absA === bMod;
|
|
29274
30113
|
};
|
|
29275
30114
|
}
|
|
29276
30115
|
exports.compile = compile;
|
|
29277
30116
|
function generate(parsed) {
|
|
29278
30117
|
var a = parsed[0];
|
|
29279
|
-
var
|
|
29280
|
-
var
|
|
30118
|
+
var b2 = parsed[1] - 1;
|
|
30119
|
+
var n2 = 0;
|
|
29281
30120
|
if (a < 0) {
|
|
29282
30121
|
var aPos_1 = -a;
|
|
29283
|
-
var minValue_1 = (
|
|
30122
|
+
var minValue_1 = (b2 % aPos_1 + aPos_1) % aPos_1;
|
|
29284
30123
|
return function() {
|
|
29285
|
-
var val = minValue_1 + aPos_1 *
|
|
29286
|
-
return val >
|
|
30124
|
+
var val = minValue_1 + aPos_1 * n2++;
|
|
30125
|
+
return val > b2 ? null : val;
|
|
29287
30126
|
};
|
|
29288
30127
|
}
|
|
29289
30128
|
if (a === 0)
|
|
29290
|
-
return
|
|
30129
|
+
return b2 < 0 ? function() {
|
|
29291
30130
|
return null;
|
|
29292
30131
|
} : function() {
|
|
29293
|
-
return
|
|
30132
|
+
return n2++ === 0 ? b2 : null;
|
|
29294
30133
|
};
|
|
29295
|
-
if (
|
|
29296
|
-
|
|
30134
|
+
if (b2 < 0) {
|
|
30135
|
+
b2 += a * Math.ceil(-b2 / a);
|
|
29297
30136
|
}
|
|
29298
30137
|
return function() {
|
|
29299
|
-
return a *
|
|
30138
|
+
return a * n2++ + b2;
|
|
29300
30139
|
};
|
|
29301
30140
|
}
|
|
29302
30141
|
exports.generate = generate;
|
|
@@ -29366,10 +30205,10 @@ var require_filters = __commonJS((exports) => {
|
|
|
29366
30205
|
return function nthChild(elem) {
|
|
29367
30206
|
var siblings = adapter.getSiblings(elem);
|
|
29368
30207
|
var pos = 0;
|
|
29369
|
-
for (var
|
|
29370
|
-
if (equals(elem, siblings[
|
|
30208
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30209
|
+
if (equals(elem, siblings[i2]))
|
|
29371
30210
|
break;
|
|
29372
|
-
if (adapter.isTag(siblings[
|
|
30211
|
+
if (adapter.isTag(siblings[i2])) {
|
|
29373
30212
|
pos++;
|
|
29374
30213
|
}
|
|
29375
30214
|
}
|
|
@@ -29386,10 +30225,10 @@ var require_filters = __commonJS((exports) => {
|
|
|
29386
30225
|
return function nthLastChild(elem) {
|
|
29387
30226
|
var siblings = adapter.getSiblings(elem);
|
|
29388
30227
|
var pos = 0;
|
|
29389
|
-
for (var
|
|
29390
|
-
if (equals(elem, siblings[
|
|
30228
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30229
|
+
if (equals(elem, siblings[i2]))
|
|
29391
30230
|
break;
|
|
29392
|
-
if (adapter.isTag(siblings[
|
|
30231
|
+
if (adapter.isTag(siblings[i2])) {
|
|
29393
30232
|
pos++;
|
|
29394
30233
|
}
|
|
29395
30234
|
}
|
|
@@ -29406,8 +30245,8 @@ var require_filters = __commonJS((exports) => {
|
|
|
29406
30245
|
return function nthOfType(elem) {
|
|
29407
30246
|
var siblings = adapter.getSiblings(elem);
|
|
29408
30247
|
var pos = 0;
|
|
29409
|
-
for (var
|
|
29410
|
-
var currentSibling = siblings[
|
|
30248
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30249
|
+
var currentSibling = siblings[i2];
|
|
29411
30250
|
if (equals(elem, currentSibling))
|
|
29412
30251
|
break;
|
|
29413
30252
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === adapter.getName(elem)) {
|
|
@@ -29427,8 +30266,8 @@ var require_filters = __commonJS((exports) => {
|
|
|
29427
30266
|
return function nthLastOfType(elem) {
|
|
29428
30267
|
var siblings = adapter.getSiblings(elem);
|
|
29429
30268
|
var pos = 0;
|
|
29430
|
-
for (var
|
|
29431
|
-
var currentSibling = siblings[
|
|
30269
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30270
|
+
var currentSibling = siblings[i2];
|
|
29432
30271
|
if (equals(elem, currentSibling))
|
|
29433
30272
|
break;
|
|
29434
30273
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === adapter.getName(elem)) {
|
|
@@ -29501,10 +30340,10 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29501
30340
|
"last-child": function(elem, _a) {
|
|
29502
30341
|
var { adapter, equals } = _a;
|
|
29503
30342
|
var siblings = adapter.getSiblings(elem);
|
|
29504
|
-
for (var
|
|
29505
|
-
if (equals(elem, siblings[
|
|
30343
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30344
|
+
if (equals(elem, siblings[i2]))
|
|
29506
30345
|
return true;
|
|
29507
|
-
if (adapter.isTag(siblings[
|
|
30346
|
+
if (adapter.isTag(siblings[i2]))
|
|
29508
30347
|
break;
|
|
29509
30348
|
}
|
|
29510
30349
|
return false;
|
|
@@ -29513,8 +30352,8 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29513
30352
|
var { adapter, equals } = _a;
|
|
29514
30353
|
var siblings = adapter.getSiblings(elem);
|
|
29515
30354
|
var elemName = adapter.getName(elem);
|
|
29516
|
-
for (var
|
|
29517
|
-
var currentSibling = siblings[
|
|
30355
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30356
|
+
var currentSibling = siblings[i2];
|
|
29518
30357
|
if (equals(elem, currentSibling))
|
|
29519
30358
|
return true;
|
|
29520
30359
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elemName) {
|
|
@@ -29527,8 +30366,8 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29527
30366
|
var { adapter, equals } = _a;
|
|
29528
30367
|
var siblings = adapter.getSiblings(elem);
|
|
29529
30368
|
var elemName = adapter.getName(elem);
|
|
29530
|
-
for (var
|
|
29531
|
-
var currentSibling = siblings[
|
|
30369
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30370
|
+
var currentSibling = siblings[i2];
|
|
29532
30371
|
if (equals(elem, currentSibling))
|
|
29533
30372
|
return true;
|
|
29534
30373
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elemName) {
|
|
@@ -29599,11 +30438,11 @@ var require_aliases = __commonJS((exports) => {
|
|
|
29599
30438
|
var require_subselects = __commonJS((exports) => {
|
|
29600
30439
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
29601
30440
|
if (pack || arguments.length === 2)
|
|
29602
|
-
for (var
|
|
29603
|
-
if (ar || !(
|
|
30441
|
+
for (var i2 = 0, l = from.length, ar;i2 < l; i2++) {
|
|
30442
|
+
if (ar || !(i2 in from)) {
|
|
29604
30443
|
if (!ar)
|
|
29605
|
-
ar = Array.prototype.slice.call(from, 0,
|
|
29606
|
-
ar[
|
|
30444
|
+
ar = Array.prototype.slice.call(from, 0, i2);
|
|
30445
|
+
ar[i2] = from[i2];
|
|
29607
30446
|
}
|
|
29608
30447
|
}
|
|
29609
30448
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
@@ -29847,8 +30686,8 @@ var require_general = __commonJS((exports) => {
|
|
|
29847
30686
|
case css_what_1.SelectorType.Sibling: {
|
|
29848
30687
|
return function sibling(elem) {
|
|
29849
30688
|
var siblings = adapter.getSiblings(elem);
|
|
29850
|
-
for (var
|
|
29851
|
-
var currentSibling = siblings[
|
|
30689
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30690
|
+
var currentSibling = siblings[i2];
|
|
29852
30691
|
if (equals(elem, currentSibling))
|
|
29853
30692
|
break;
|
|
29854
30693
|
if (adapter.isTag(currentSibling) && next(currentSibling)) {
|
|
@@ -29868,8 +30707,8 @@ var require_general = __commonJS((exports) => {
|
|
|
29868
30707
|
return function adjacent(elem) {
|
|
29869
30708
|
var siblings = adapter.getSiblings(elem);
|
|
29870
30709
|
var lastElement;
|
|
29871
|
-
for (var
|
|
29872
|
-
var currentSibling = siblings[
|
|
30710
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30711
|
+
var currentSibling = siblings[i2];
|
|
29873
30712
|
if (equals(elem, currentSibling))
|
|
29874
30713
|
break;
|
|
29875
30714
|
if (adapter.isTag(currentSibling)) {
|
|
@@ -29892,25 +30731,25 @@ var require_general = __commonJS((exports) => {
|
|
|
29892
30731
|
|
|
29893
30732
|
// ../../node_modules/css-select/lib/compile.js
|
|
29894
30733
|
var require_compile2 = __commonJS((exports) => {
|
|
29895
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
30734
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
29896
30735
|
if (k2 === undefined)
|
|
29897
30736
|
k2 = k;
|
|
29898
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
29899
|
-
if (!desc || ("get" in desc ? !
|
|
30737
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
30738
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
29900
30739
|
desc = { enumerable: true, get: function() {
|
|
29901
|
-
return
|
|
30740
|
+
return m2[k];
|
|
29902
30741
|
} };
|
|
29903
30742
|
}
|
|
29904
30743
|
Object.defineProperty(o, k2, desc);
|
|
29905
|
-
} : function(o,
|
|
30744
|
+
} : function(o, m2, k, k2) {
|
|
29906
30745
|
if (k2 === undefined)
|
|
29907
30746
|
k2 = k;
|
|
29908
|
-
o[k2] =
|
|
30747
|
+
o[k2] = m2[k];
|
|
29909
30748
|
});
|
|
29910
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
29911
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
29912
|
-
} : function(o,
|
|
29913
|
-
o["default"] =
|
|
30749
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
30750
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
30751
|
+
} : function(o, v2) {
|
|
30752
|
+
o["default"] = v2;
|
|
29914
30753
|
});
|
|
29915
30754
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
29916
30755
|
if (mod && mod.__esModule)
|
|
@@ -30009,40 +30848,40 @@ var require_compile2 = __commonJS((exports) => {
|
|
|
30009
30848
|
return previous === boolbase_1.default.falseFunc ? boolbase_1.default.falseFunc : (0, general_js_1.compileGeneralSelector)(previous, rule, options, context, compileToken);
|
|
30010
30849
|
}, (_a = options.rootFunc) !== null && _a !== undefined ? _a : boolbase_1.default.trueFunc);
|
|
30011
30850
|
}
|
|
30012
|
-
function reduceRules(a,
|
|
30013
|
-
if (
|
|
30851
|
+
function reduceRules(a, b2) {
|
|
30852
|
+
if (b2 === boolbase_1.default.falseFunc || a === boolbase_1.default.trueFunc) {
|
|
30014
30853
|
return a;
|
|
30015
30854
|
}
|
|
30016
|
-
if (a === boolbase_1.default.falseFunc ||
|
|
30017
|
-
return
|
|
30855
|
+
if (a === boolbase_1.default.falseFunc || b2 === boolbase_1.default.trueFunc) {
|
|
30856
|
+
return b2;
|
|
30018
30857
|
}
|
|
30019
30858
|
return function combine(elem) {
|
|
30020
|
-
return a(elem) ||
|
|
30859
|
+
return a(elem) || b2(elem);
|
|
30021
30860
|
};
|
|
30022
30861
|
}
|
|
30023
30862
|
});
|
|
30024
30863
|
|
|
30025
30864
|
// ../../node_modules/css-select/lib/index.js
|
|
30026
30865
|
var require_lib8 = __commonJS((exports) => {
|
|
30027
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
30866
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
30028
30867
|
if (k2 === undefined)
|
|
30029
30868
|
k2 = k;
|
|
30030
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
30031
|
-
if (!desc || ("get" in desc ? !
|
|
30869
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
30870
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
30032
30871
|
desc = { enumerable: true, get: function() {
|
|
30033
|
-
return
|
|
30872
|
+
return m2[k];
|
|
30034
30873
|
} };
|
|
30035
30874
|
}
|
|
30036
30875
|
Object.defineProperty(o, k2, desc);
|
|
30037
|
-
} : function(o,
|
|
30876
|
+
} : function(o, m2, k, k2) {
|
|
30038
30877
|
if (k2 === undefined)
|
|
30039
30878
|
k2 = k;
|
|
30040
|
-
o[k2] =
|
|
30879
|
+
o[k2] = m2[k];
|
|
30041
30880
|
});
|
|
30042
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
30043
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
30044
|
-
} : function(o,
|
|
30045
|
-
o["default"] =
|
|
30881
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
30882
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
30883
|
+
} : function(o, v2) {
|
|
30884
|
+
o["default"] = v2;
|
|
30046
30885
|
});
|
|
30047
30886
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
30048
30887
|
if (mod && mod.__esModule)
|
|
@@ -30065,8 +30904,8 @@ var require_lib8 = __commonJS((exports) => {
|
|
|
30065
30904
|
var boolbase_1 = __importDefault(require_boolbase());
|
|
30066
30905
|
var compile_js_1 = require_compile2();
|
|
30067
30906
|
var subselects_js_1 = require_subselects();
|
|
30068
|
-
var defaultEquals = function(a,
|
|
30069
|
-
return a ===
|
|
30907
|
+
var defaultEquals = function(a, b2) {
|
|
30908
|
+
return a === b2;
|
|
30070
30909
|
};
|
|
30071
30910
|
var defaultOptions = {
|
|
30072
30911
|
adapter: DomUtils,
|
|
@@ -30111,8 +30950,8 @@ var require_lib8 = __commonJS((exports) => {
|
|
|
30111
30950
|
function appendNextSiblings(elem, adapter) {
|
|
30112
30951
|
var elems = Array.isArray(elem) ? elem.slice(0) : [elem];
|
|
30113
30952
|
var elemsLength = elems.length;
|
|
30114
|
-
for (var
|
|
30115
|
-
var nextSiblings = (0, subselects_js_1.getNextSiblings)(elems[
|
|
30953
|
+
for (var i2 = 0;i2 < elemsLength; i2++) {
|
|
30954
|
+
var nextSiblings = (0, subselects_js_1.getNextSiblings)(elems[i2], adapter);
|
|
30116
30955
|
elems.push.apply(elems, nextSiblings);
|
|
30117
30956
|
}
|
|
30118
30957
|
return elems;
|
|
@@ -30212,8 +31051,8 @@ var require_matcher = __commonJS((exports) => {
|
|
|
30212
31051
|
}
|
|
30213
31052
|
function findOne(test, elems) {
|
|
30214
31053
|
let elem = null;
|
|
30215
|
-
for (let
|
|
30216
|
-
const el = elems[
|
|
31054
|
+
for (let i2 = 0, l = elems === null || elems === undefined ? undefined : elems.length;i2 < l && !elem; i2++) {
|
|
31055
|
+
const el = elems[i2];
|
|
30217
31056
|
if (test(el)) {
|
|
30218
31057
|
elem = el;
|
|
30219
31058
|
} else {
|
|
@@ -30227,12 +31066,12 @@ var require_matcher = __commonJS((exports) => {
|
|
|
30227
31066
|
}
|
|
30228
31067
|
function findAll(test, nodes) {
|
|
30229
31068
|
let result = [];
|
|
30230
|
-
for (let
|
|
30231
|
-
if (!isTag(nodes[
|
|
31069
|
+
for (let i2 = 0, j = nodes.length;i2 < j; i2++) {
|
|
31070
|
+
if (!isTag(nodes[i2]))
|
|
30232
31071
|
continue;
|
|
30233
|
-
if (test(nodes[
|
|
30234
|
-
result.push(nodes[
|
|
30235
|
-
const childs = getChildren(nodes[
|
|
31072
|
+
if (test(nodes[i2]))
|
|
31073
|
+
result.push(nodes[i2]);
|
|
31074
|
+
const childs = getChildren(nodes[i2]);
|
|
30236
31075
|
if (childs)
|
|
30237
31076
|
result = result.concat(findAll(test, childs));
|
|
30238
31077
|
}
|
|
@@ -30336,23 +31175,23 @@ var require_text = __commonJS((exports) => {
|
|
|
30336
31175
|
}
|
|
30337
31176
|
exports.default = TextNode;
|
|
30338
31177
|
function trimText(text) {
|
|
30339
|
-
let
|
|
31178
|
+
let i2 = 0;
|
|
30340
31179
|
let startPos;
|
|
30341
31180
|
let endPos;
|
|
30342
|
-
while (
|
|
30343
|
-
if (/\S/.test(text[
|
|
31181
|
+
while (i2 >= 0 && i2 < text.length) {
|
|
31182
|
+
if (/\S/.test(text[i2])) {
|
|
30344
31183
|
if (startPos === undefined) {
|
|
30345
|
-
startPos =
|
|
30346
|
-
|
|
31184
|
+
startPos = i2;
|
|
31185
|
+
i2 = text.length;
|
|
30347
31186
|
} else {
|
|
30348
|
-
endPos =
|
|
30349
|
-
|
|
31187
|
+
endPos = i2;
|
|
31188
|
+
i2 = undefined;
|
|
30350
31189
|
}
|
|
30351
31190
|
}
|
|
30352
31191
|
if (startPos === undefined)
|
|
30353
|
-
|
|
31192
|
+
i2++;
|
|
30354
31193
|
else
|
|
30355
|
-
|
|
31194
|
+
i2--;
|
|
30356
31195
|
}
|
|
30357
31196
|
if (startPos === undefined)
|
|
30358
31197
|
startPos = 0;
|
|
@@ -30380,7 +31219,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30380
31219
|
var node_1 = __importDefault(require_node());
|
|
30381
31220
|
var text_1 = __importDefault(require_text());
|
|
30382
31221
|
var type_1 = __importDefault(require_type());
|
|
30383
|
-
function
|
|
31222
|
+
function decode2(val) {
|
|
30384
31223
|
return JSON.parse(JSON.stringify(he_1.default.decode(val)));
|
|
30385
31224
|
}
|
|
30386
31225
|
var Htags = ["h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup"];
|
|
@@ -30530,14 +31369,14 @@ var require_html = __commonJS((exports) => {
|
|
|
30530
31369
|
}, "");
|
|
30531
31370
|
}
|
|
30532
31371
|
get textContent() {
|
|
30533
|
-
return
|
|
31372
|
+
return decode2(this.rawText);
|
|
30534
31373
|
}
|
|
30535
31374
|
set textContent(val) {
|
|
30536
31375
|
const content = [new text_1.default(val, this)];
|
|
30537
31376
|
this.childNodes = content;
|
|
30538
31377
|
}
|
|
30539
31378
|
get text() {
|
|
30540
|
-
return
|
|
31379
|
+
return decode2(this.rawText);
|
|
30541
31380
|
}
|
|
30542
31381
|
get structuredText() {
|
|
30543
31382
|
let currentBlock = [];
|
|
@@ -30588,7 +31427,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30588
31427
|
}).join("");
|
|
30589
31428
|
}
|
|
30590
31429
|
set innerHTML(content) {
|
|
30591
|
-
const r =
|
|
31430
|
+
const r = parse3(content, this._parseOptions);
|
|
30592
31431
|
const nodes = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];
|
|
30593
31432
|
resetParent(nodes, this);
|
|
30594
31433
|
resetParent(this.childNodes, null);
|
|
@@ -30599,7 +31438,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30599
31438
|
content = [content];
|
|
30600
31439
|
} else if (typeof content == "string") {
|
|
30601
31440
|
options = Object.assign(Object.assign({}, this._parseOptions), options);
|
|
30602
|
-
const r =
|
|
31441
|
+
const r = parse3(content, options);
|
|
30603
31442
|
content = r.childNodes.length ? r.childNodes : [new text_1.default(r.innerHTML, this)];
|
|
30604
31443
|
}
|
|
30605
31444
|
resetParent(this.childNodes, null);
|
|
@@ -30613,7 +31452,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30613
31452
|
if (node instanceof node_1.default) {
|
|
30614
31453
|
return [node];
|
|
30615
31454
|
} else if (typeof node == "string") {
|
|
30616
|
-
const r =
|
|
31455
|
+
const r = parse3(node, this._parseOptions);
|
|
30617
31456
|
return r.childNodes.length ? r.childNodes : [new text_1.default(node, this)];
|
|
30618
31457
|
}
|
|
30619
31458
|
return [];
|
|
@@ -30629,15 +31468,15 @@ var require_html = __commonJS((exports) => {
|
|
|
30629
31468
|
return this.toString();
|
|
30630
31469
|
}
|
|
30631
31470
|
trimRight(pattern) {
|
|
30632
|
-
for (let
|
|
30633
|
-
const childNode = this.childNodes[
|
|
31471
|
+
for (let i2 = 0;i2 < this.childNodes.length; i2++) {
|
|
31472
|
+
const childNode = this.childNodes[i2];
|
|
30634
31473
|
if (childNode.nodeType === type_1.default.ELEMENT_NODE) {
|
|
30635
31474
|
childNode.trimRight(pattern);
|
|
30636
31475
|
} else {
|
|
30637
31476
|
const index = childNode.rawText.search(pattern);
|
|
30638
31477
|
if (index > -1) {
|
|
30639
31478
|
childNode.rawText = childNode.rawText.substr(0, index);
|
|
30640
|
-
this.childNodes.length =
|
|
31479
|
+
this.childNodes.length = i2 + 1;
|
|
30641
31480
|
}
|
|
30642
31481
|
}
|
|
30643
31482
|
}
|
|
@@ -30770,8 +31609,8 @@ var require_html = __commonJS((exports) => {
|
|
|
30770
31609
|
let old = null;
|
|
30771
31610
|
function findOne(test, elems) {
|
|
30772
31611
|
let elem = null;
|
|
30773
|
-
for (let
|
|
30774
|
-
const el2 = elems[
|
|
31612
|
+
for (let i2 = 0, l = elems.length;i2 < l && !elem; i2++) {
|
|
31613
|
+
const el2 = elems[i2];
|
|
30775
31614
|
if (test(el2)) {
|
|
30776
31615
|
elem = el2;
|
|
30777
31616
|
} else {
|
|
@@ -30825,7 +31664,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30825
31664
|
const attrs = this.rawAttributes;
|
|
30826
31665
|
for (const key in attrs) {
|
|
30827
31666
|
const val = attrs[key] || "";
|
|
30828
|
-
this._attrs[key.toLowerCase()] =
|
|
31667
|
+
this._attrs[key.toLowerCase()] = decode2(val);
|
|
30829
31668
|
}
|
|
30830
31669
|
return this._attrs;
|
|
30831
31670
|
}
|
|
@@ -30834,7 +31673,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30834
31673
|
const attrs = this.rawAttributes;
|
|
30835
31674
|
for (const key in attrs) {
|
|
30836
31675
|
const val = attrs[key] || "";
|
|
30837
|
-
ret_attrs[key] =
|
|
31676
|
+
ret_attrs[key] = decode2(val);
|
|
30838
31677
|
}
|
|
30839
31678
|
return ret_attrs;
|
|
30840
31679
|
}
|
|
@@ -30894,7 +31733,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30894
31733
|
}
|
|
30895
31734
|
attrs[key] = String(value);
|
|
30896
31735
|
if (this._attrs) {
|
|
30897
|
-
this._attrs[k2] =
|
|
31736
|
+
this._attrs[k2] = decode2(attrs[key]);
|
|
30898
31737
|
}
|
|
30899
31738
|
this.rawAttrs = Object.keys(attrs).map((name) => {
|
|
30900
31739
|
const val = this.quoteAttribute(attrs[name]);
|
|
@@ -30929,7 +31768,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30929
31768
|
if (arguments.length < 2) {
|
|
30930
31769
|
throw new Error("2 arguments required");
|
|
30931
31770
|
}
|
|
30932
|
-
const p =
|
|
31771
|
+
const p = parse3(html, this._parseOptions);
|
|
30933
31772
|
if (where === "afterend") {
|
|
30934
31773
|
this.after(...p.childNodes);
|
|
30935
31774
|
} else if (where === "afterbegin") {
|
|
@@ -30968,11 +31807,11 @@ var require_html = __commonJS((exports) => {
|
|
|
30968
31807
|
get nextSibling() {
|
|
30969
31808
|
if (this.parentNode) {
|
|
30970
31809
|
const children = this.parentNode.childNodes;
|
|
30971
|
-
let
|
|
30972
|
-
while (
|
|
30973
|
-
const child = children[
|
|
31810
|
+
let i2 = 0;
|
|
31811
|
+
while (i2 < children.length) {
|
|
31812
|
+
const child = children[i2++];
|
|
30974
31813
|
if (this === child)
|
|
30975
|
-
return children[
|
|
31814
|
+
return children[i2] || null;
|
|
30976
31815
|
}
|
|
30977
31816
|
return null;
|
|
30978
31817
|
}
|
|
@@ -30980,10 +31819,10 @@ var require_html = __commonJS((exports) => {
|
|
|
30980
31819
|
get nextElementSibling() {
|
|
30981
31820
|
if (this.parentNode) {
|
|
30982
31821
|
const children = this.parentNode.childNodes;
|
|
30983
|
-
let
|
|
31822
|
+
let i2 = 0;
|
|
30984
31823
|
let find = false;
|
|
30985
|
-
while (
|
|
30986
|
-
const child = children[
|
|
31824
|
+
while (i2 < children.length) {
|
|
31825
|
+
const child = children[i2++];
|
|
30987
31826
|
if (find) {
|
|
30988
31827
|
if (child instanceof HTMLElement) {
|
|
30989
31828
|
return child || null;
|
|
@@ -30998,11 +31837,11 @@ var require_html = __commonJS((exports) => {
|
|
|
30998
31837
|
get previousSibling() {
|
|
30999
31838
|
if (this.parentNode) {
|
|
31000
31839
|
const children = this.parentNode.childNodes;
|
|
31001
|
-
let
|
|
31002
|
-
while (
|
|
31003
|
-
const child = children[--
|
|
31840
|
+
let i2 = children.length;
|
|
31841
|
+
while (i2 > 0) {
|
|
31842
|
+
const child = children[--i2];
|
|
31004
31843
|
if (this === child)
|
|
31005
|
-
return children[
|
|
31844
|
+
return children[i2 - 1] || null;
|
|
31006
31845
|
}
|
|
31007
31846
|
return null;
|
|
31008
31847
|
}
|
|
@@ -31010,10 +31849,10 @@ var require_html = __commonJS((exports) => {
|
|
|
31010
31849
|
get previousElementSibling() {
|
|
31011
31850
|
if (this.parentNode) {
|
|
31012
31851
|
const children = this.parentNode.childNodes;
|
|
31013
|
-
let
|
|
31852
|
+
let i2 = children.length;
|
|
31014
31853
|
let find = false;
|
|
31015
|
-
while (
|
|
31016
|
-
const child = children[--
|
|
31854
|
+
while (i2 > 0) {
|
|
31855
|
+
const child = children[--i2];
|
|
31017
31856
|
if (find) {
|
|
31018
31857
|
if (child instanceof HTMLElement) {
|
|
31019
31858
|
return child || null;
|
|
@@ -31053,7 +31892,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31053
31892
|
return this.classList.toString();
|
|
31054
31893
|
}
|
|
31055
31894
|
clone() {
|
|
31056
|
-
return
|
|
31895
|
+
return parse3(this.toString(), this._parseOptions).firstChild;
|
|
31057
31896
|
}
|
|
31058
31897
|
}
|
|
31059
31898
|
exports.default = HTMLElement;
|
|
@@ -31230,13 +32069,13 @@ var require_html = __commonJS((exports) => {
|
|
|
31230
32069
|
}
|
|
31231
32070
|
}
|
|
31232
32071
|
if (options.closeAllByClosing === true) {
|
|
31233
|
-
let
|
|
31234
|
-
for (
|
|
31235
|
-
if (stack[
|
|
32072
|
+
let i2;
|
|
32073
|
+
for (i2 = stack.length - 2;i2 >= 0; i2--) {
|
|
32074
|
+
if (stack[i2].rawTagName === tagName)
|
|
31236
32075
|
break;
|
|
31237
32076
|
}
|
|
31238
|
-
if (
|
|
31239
|
-
while (stack.length >
|
|
32077
|
+
if (i2 >= 0) {
|
|
32078
|
+
while (stack.length > i2) {
|
|
31240
32079
|
currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];
|
|
31241
32080
|
stack.pop();
|
|
31242
32081
|
currentParent = (0, back_1.default)(stack);
|
|
@@ -31252,7 +32091,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31252
32091
|
return stack;
|
|
31253
32092
|
}
|
|
31254
32093
|
exports.base_parse = base_parse;
|
|
31255
|
-
function
|
|
32094
|
+
function parse3(data, options = {}) {
|
|
31256
32095
|
const stack = base_parse(data, options);
|
|
31257
32096
|
const [root] = stack;
|
|
31258
32097
|
while (stack.length > 1) {
|
|
@@ -31279,7 +32118,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31279
32118
|
}
|
|
31280
32119
|
return root;
|
|
31281
32120
|
}
|
|
31282
|
-
exports.parse =
|
|
32121
|
+
exports.parse = parse3;
|
|
31283
32122
|
function resolveInsertable(insertable) {
|
|
31284
32123
|
return insertable.map((val) => {
|
|
31285
32124
|
if (typeof val === "string") {
|
|
@@ -31338,41 +32177,18 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
31338
32177
|
var parse_1 = __importDefault(require_parse3());
|
|
31339
32178
|
var valid_1 = __importDefault(require_valid());
|
|
31340
32179
|
exports.valid = valid_1.default;
|
|
31341
|
-
function
|
|
32180
|
+
function parse3(data, options = {}) {
|
|
31342
32181
|
return (0, parse_1.default)(data, options);
|
|
31343
32182
|
}
|
|
31344
|
-
exports.default =
|
|
31345
|
-
exports.parse =
|
|
31346
|
-
|
|
31347
|
-
|
|
31348
|
-
|
|
31349
|
-
|
|
31350
|
-
|
|
31351
|
-
|
|
31352
|
-
|
|
31353
|
-
});
|
|
31354
|
-
// ../../node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js
|
|
31355
|
-
import g from "crypto";
|
|
31356
|
-
import _ from "fs";
|
|
31357
|
-
import { TextDecoder as b, TextEncoder as v } from "util";
|
|
31358
|
-
var y, w;
|
|
31359
|
-
var init_chunk_W5DTLHV4 = __esm(() => {
|
|
31360
|
-
globalThis.fs || Object.defineProperty(globalThis, "fs", { value: _ });
|
|
31361
|
-
globalThis.process || Object.defineProperties(globalThis, "process", { value: process });
|
|
31362
|
-
globalThis.crypto || Object.defineProperty(globalThis, "crypto", { value: g.webcrypto ? g.webcrypto : { getRandomValues(m) {
|
|
31363
|
-
return g.randomFillSync(m);
|
|
31364
|
-
} } });
|
|
31365
|
-
globalThis.performance || Object.defineProperty(globalThis, "performance", { value: { now() {
|
|
31366
|
-
let [m, o] = process.hrtime();
|
|
31367
|
-
return m * 1000 + o / 1e6;
|
|
31368
|
-
} } });
|
|
31369
|
-
y = new v("utf-8");
|
|
31370
|
-
w = new b("utf-8");
|
|
31371
|
-
});
|
|
31372
|
-
|
|
31373
|
-
// ../../node_modules/@astrojs/compiler/dist/node/index.js
|
|
31374
|
-
var init_node = __esm(() => {
|
|
31375
|
-
init_chunk_W5DTLHV4();
|
|
32183
|
+
exports.default = parse3;
|
|
32184
|
+
exports.parse = parse3;
|
|
32185
|
+
parse3.parse = parse_1.default;
|
|
32186
|
+
parse3.HTMLElement = html_1.default;
|
|
32187
|
+
parse3.CommentNode = comment_1.default;
|
|
32188
|
+
parse3.valid = valid_1.default;
|
|
32189
|
+
parse3.Node = node_1.default;
|
|
32190
|
+
parse3.TextNode = text_1.default;
|
|
32191
|
+
parse3.NodeType = type_1.default;
|
|
31376
32192
|
});
|
|
31377
32193
|
// ../cms/src/source-finder/cache.ts
|
|
31378
32194
|
var parsedFileCache, directoryCache, markdownFileCache, declaredUrlIndexCache, dirtyFiles;
|
|
@@ -31459,9 +32275,9 @@ function extractAstroImageOriginalUrl(src) {
|
|
|
31459
32275
|
return href;
|
|
31460
32276
|
}
|
|
31461
32277
|
if (url.pathname.startsWith("/@image/")) {
|
|
31462
|
-
const
|
|
31463
|
-
if (
|
|
31464
|
-
return
|
|
32278
|
+
const f2 = url.searchParams.get("f");
|
|
32279
|
+
if (f2)
|
|
32280
|
+
return f2;
|
|
31465
32281
|
}
|
|
31466
32282
|
} catch {}
|
|
31467
32283
|
return;
|
|
@@ -31481,7 +32297,7 @@ var init_snippet_utils = __esm(() => {
|
|
|
31481
32297
|
|
|
31482
32298
|
// ../cms/src/handlers/source-writer.ts
|
|
31483
32299
|
import fs8 from "fs/promises";
|
|
31484
|
-
import
|
|
32300
|
+
import path11 from "path";
|
|
31485
32301
|
async function handleUpdate(request, manifestWriter) {
|
|
31486
32302
|
const { changes, meta } = request;
|
|
31487
32303
|
const errors = [];
|
|
@@ -31518,7 +32334,7 @@ async function handleUpdate(request, manifestWriter) {
|
|
|
31518
32334
|
}
|
|
31519
32335
|
if (appliedCount > 0 && newContent !== currentContent) {
|
|
31520
32336
|
for (const op of fileOps) {
|
|
31521
|
-
await fs8.mkdir(
|
|
32337
|
+
await fs8.mkdir(path11.dirname(op.target), { recursive: true });
|
|
31522
32338
|
await fs8.writeFile(op.target, op.bytes);
|
|
31523
32339
|
}
|
|
31524
32340
|
await fs8.writeFile(fullPath, newContent, "utf-8");
|
|
@@ -31752,28 +32568,28 @@ function findFrontmatterAssetImport(content, varName) {
|
|
|
31752
32568
|
return null;
|
|
31753
32569
|
const fmStart = fmMatch[0].indexOf(fmMatch[1]);
|
|
31754
32570
|
const importRe = /^\s*import\s+(?!type\b)([\s\S]+?)\s+from\s+(['"])([^'"]+)\2/gm;
|
|
31755
|
-
let
|
|
31756
|
-
while ((
|
|
31757
|
-
const source =
|
|
32571
|
+
let m2;
|
|
32572
|
+
while ((m2 = importRe.exec(fmMatch[1])) !== null) {
|
|
32573
|
+
const source = m2[3];
|
|
31758
32574
|
if (!source.startsWith(".") || !ASSET_IMPORT_EXT_RE.test(source))
|
|
31759
32575
|
continue;
|
|
31760
|
-
const tokens =
|
|
32576
|
+
const tokens = m2[1].replace(/[{}]/g, ",").split(",").map((s) => s.trim()).filter((t) => t && !t.startsWith("type "));
|
|
31761
32577
|
const matches = tokens.some((tok) => {
|
|
31762
32578
|
const aliasMatch = tok.match(/^\S+\s+as\s+(\S+)$/);
|
|
31763
32579
|
return (aliasMatch ? aliasMatch[1] : tok) === varName;
|
|
31764
32580
|
});
|
|
31765
32581
|
if (!matches)
|
|
31766
32582
|
continue;
|
|
31767
|
-
const matchStart = fmStart +
|
|
31768
|
-
const sourceStart = matchStart +
|
|
32583
|
+
const matchStart = fmStart + m2.index;
|
|
32584
|
+
const sourceStart = matchStart + m2[0].indexOf(m2[2]) + 1;
|
|
31769
32585
|
return { localName: varName, source, sourceStart, sourceEnd: sourceStart + source.length };
|
|
31770
32586
|
}
|
|
31771
32587
|
return null;
|
|
31772
32588
|
}
|
|
31773
32589
|
function inlineJsxLiteralReplace(content, lines, regionStart, exprMatch, newSrc) {
|
|
31774
32590
|
let regionStartOffset = 0;
|
|
31775
|
-
for (let
|
|
31776
|
-
regionStartOffset += lines[
|
|
32591
|
+
for (let i2 = 0;i2 < regionStart; i2++)
|
|
32592
|
+
regionStartOffset += lines[i2].length + 1;
|
|
31777
32593
|
const absIndex = regionStartOffset + exprMatch.index;
|
|
31778
32594
|
return {
|
|
31779
32595
|
content: content.slice(0, absIndex) + `src="${escapeReplacement(newSrc)}"` + content.slice(absIndex + exprMatch.length),
|
|
@@ -31784,8 +32600,8 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
|
|
|
31784
32600
|
const resolved = await resolveNewSrcBytes(newSrc, originUrl);
|
|
31785
32601
|
if (!resolved)
|
|
31786
32602
|
return null;
|
|
31787
|
-
const originalAssetAbs =
|
|
31788
|
-
const targetAbs = await pickSiblingTarget(
|
|
32603
|
+
const originalAssetAbs = path11.resolve(path11.dirname(absFilePath), importInfo.source);
|
|
32604
|
+
const targetAbs = await pickSiblingTarget(path11.dirname(originalAssetAbs), resolved.filename, resolved.bytes);
|
|
31789
32605
|
const newRelImport = relativeImportPath2(absFilePath, targetAbs);
|
|
31790
32606
|
const newContent = content.slice(0, importInfo.sourceStart) + newRelImport + content.slice(importInfo.sourceEnd);
|
|
31791
32607
|
return {
|
|
@@ -31795,8 +32611,8 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
|
|
|
31795
32611
|
};
|
|
31796
32612
|
}
|
|
31797
32613
|
async function resolveNewSrcBytes(newSrc, originUrl) {
|
|
31798
|
-
const filenameFromPath = (p) =>
|
|
31799
|
-
const diskPath = newSrc.startsWith("/src/") ?
|
|
32614
|
+
const filenameFromPath = (p) => path11.basename(p.split("?")[0] ?? p);
|
|
32615
|
+
const diskPath = newSrc.startsWith("/src/") ? path11.join(getProjectRoot(), newSrc.slice(1)) : newSrc.startsWith("/") && !newSrc.startsWith("//") ? path11.join(getProjectRoot(), "public", newSrc.replace(/^\/+/, "")) : null;
|
|
31800
32616
|
if (diskPath) {
|
|
31801
32617
|
try {
|
|
31802
32618
|
return { bytes: await fs8.readFile(diskPath), filename: filenameFromPath(newSrc) };
|
|
@@ -31886,10 +32702,10 @@ function replaceClassInAttribute(content, oldClass, newClass, sourceLine) {
|
|
|
31886
32702
|
}
|
|
31887
32703
|
const lines = content.split(`
|
|
31888
32704
|
`);
|
|
31889
|
-
for (let
|
|
31890
|
-
const result = replaceOnLine(lines[
|
|
32705
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
32706
|
+
const result = replaceOnLine(lines[i2]);
|
|
31891
32707
|
if (result !== null) {
|
|
31892
|
-
lines[
|
|
32708
|
+
lines[i2] = result;
|
|
31893
32709
|
return { success: true, content: lines.join(`
|
|
31894
32710
|
`) };
|
|
31895
32711
|
}
|
|
@@ -31929,10 +32745,10 @@ function appendClassToAttribute(content, newClass, sourceLine) {
|
|
|
31929
32745
|
}
|
|
31930
32746
|
const lines = content.split(`
|
|
31931
32747
|
`);
|
|
31932
|
-
for (let
|
|
31933
|
-
const result = doAppendOnLine(lines[
|
|
32748
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
32749
|
+
const result = doAppendOnLine(lines[i2]);
|
|
31934
32750
|
if (result !== null) {
|
|
31935
|
-
lines[
|
|
32751
|
+
lines[i2] = result;
|
|
31936
32752
|
return { success: true, content: lines.join(`
|
|
31937
32753
|
`) };
|
|
31938
32754
|
}
|
|
@@ -32091,9 +32907,9 @@ function applyTextChangeWithPlaceholders(content, sourceSnippet, originalValue,
|
|
|
32091
32907
|
}
|
|
32092
32908
|
let updatedSnippet = sourceSnippet;
|
|
32093
32909
|
let anyChange = false;
|
|
32094
|
-
for (let
|
|
32095
|
-
const oldPart = originalParts[
|
|
32096
|
-
let newPart = newParts[
|
|
32910
|
+
for (let i2 = 0;i2 < originalParts.length; i2++) {
|
|
32911
|
+
const oldPart = originalParts[i2];
|
|
32912
|
+
let newPart = newParts[i2];
|
|
32097
32913
|
if (oldPart === newPart || oldPart.length === 0) {
|
|
32098
32914
|
continue;
|
|
32099
32915
|
}
|
|
@@ -32140,8 +32956,8 @@ function findTextInSnippet(snippet, decodedText) {
|
|
|
32140
32956
|
const match = snippet.match(regex);
|
|
32141
32957
|
if (match)
|
|
32142
32958
|
return match[0];
|
|
32143
|
-
const
|
|
32144
|
-
const brAwarePattern =
|
|
32959
|
+
const chars2 = [...decodedText].map((ch) => escapeRegex(ch));
|
|
32960
|
+
const brAwarePattern = chars2.join("(?:<br\\b[^>]*\\/?>)*");
|
|
32145
32961
|
const brRegex = new RegExp(brAwarePattern);
|
|
32146
32962
|
const brMatch = snippet.match(brRegex);
|
|
32147
32963
|
return brMatch && brMatch[0] !== decodedText ? brMatch[0] : null;
|
|
@@ -32185,19 +33001,19 @@ function findExpressionAttribute(text, attr) {
|
|
|
32185
33001
|
return null;
|
|
32186
33002
|
const braceStart = match.index + match[0].length - 1;
|
|
32187
33003
|
let depth = 1;
|
|
32188
|
-
let
|
|
32189
|
-
while (
|
|
32190
|
-
if (text[
|
|
33004
|
+
let i2 = braceStart + 1;
|
|
33005
|
+
while (i2 < text.length && depth > 0) {
|
|
33006
|
+
if (text[i2] === "{")
|
|
32191
33007
|
depth++;
|
|
32192
|
-
else if (text[
|
|
33008
|
+
else if (text[i2] === "}")
|
|
32193
33009
|
depth--;
|
|
32194
|
-
|
|
33010
|
+
i2++;
|
|
32195
33011
|
}
|
|
32196
33012
|
if (depth !== 0)
|
|
32197
33013
|
return null;
|
|
32198
33014
|
return {
|
|
32199
33015
|
index: match.index,
|
|
32200
|
-
length:
|
|
33016
|
+
length: i2 - match.index
|
|
32201
33017
|
};
|
|
32202
33018
|
}
|
|
32203
33019
|
function findExpressionSrcAttribute(text) {
|
|
@@ -32293,16 +33109,16 @@ function tryBrNormalizedChange(sourceSnippet, resolvedOriginal, resolvedNewText)
|
|
|
32293
33109
|
if (originalSegments.length !== newSegments.length)
|
|
32294
33110
|
return null;
|
|
32295
33111
|
const root = import_node_html_parser.parse(sourceSnippet, { blockTextElements: {} });
|
|
32296
|
-
const outerElement = root.childNodes.find((
|
|
33112
|
+
const outerElement = root.childNodes.find((n2) => n2.nodeType === import_node_html_parser.NodeType.ELEMENT_NODE);
|
|
32297
33113
|
if (!outerElement)
|
|
32298
33114
|
return null;
|
|
32299
33115
|
const groups = [[]];
|
|
32300
|
-
for (let
|
|
32301
|
-
const child = outerElement.childNodes[
|
|
33116
|
+
for (let i2 = 0;i2 < outerElement.childNodes.length; i2++) {
|
|
33117
|
+
const child = outerElement.childNodes[i2];
|
|
32302
33118
|
if (child.nodeType === import_node_html_parser.NodeType.ELEMENT_NODE && child.rawTagName === "br") {
|
|
32303
33119
|
groups.push([]);
|
|
32304
33120
|
} else if (child.nodeType === import_node_html_parser.NodeType.TEXT_NODE) {
|
|
32305
|
-
groups[groups.length - 1].push({ node: child, index:
|
|
33121
|
+
groups[groups.length - 1].push({ node: child, index: i2 });
|
|
32306
33122
|
}
|
|
32307
33123
|
}
|
|
32308
33124
|
if (groups.length !== originalSegments.length)
|
|
@@ -32344,7 +33160,7 @@ var init_source_writer = __esm(() => {
|
|
|
32344
33160
|
});
|
|
32345
33161
|
|
|
32346
33162
|
// ../cms/src/handlers/api-routes.ts
|
|
32347
|
-
import
|
|
33163
|
+
import path12 from "path";
|
|
32348
33164
|
function requireMedia(ctx) {
|
|
32349
33165
|
if (!ctx.mediaAdapter) {
|
|
32350
33166
|
sendError(ctx.res, "Media storage not configured", 501);
|
|
@@ -32507,7 +33323,7 @@ var init_api_routes = __esm(() => {
|
|
|
32507
33323
|
sendJson(res, { success: false, error: `Invalid content path: ${body.filePath}` }, 400);
|
|
32508
33324
|
return;
|
|
32509
33325
|
}
|
|
32510
|
-
const fullPath =
|
|
33326
|
+
const fullPath = path12.resolve(getProjectRoot(), body.filePath.replace(/^\//, ""));
|
|
32511
33327
|
expectedDeletions.add(fullPath);
|
|
32512
33328
|
const result = await core.deleteEntry(entry.collection, entry.slug);
|
|
32513
33329
|
if (result.success) {
|
|
@@ -32614,7 +33430,7 @@ var init_api_routes = __esm(() => {
|
|
|
32614
33430
|
const body = await parseJsonBody(req);
|
|
32615
33431
|
const result = await core.deletePage(body);
|
|
32616
33432
|
if (result.success && result.filePath) {
|
|
32617
|
-
expectedDeletions.add(
|
|
33433
|
+
expectedDeletions.add(path12.resolve(getProjectRoot(), result.filePath));
|
|
32618
33434
|
}
|
|
32619
33435
|
if (result.success && body.createRedirect && body.redirectTo) {
|
|
32620
33436
|
await core.addRedirect({ source: body.pagePath, destination: body.redirectTo, statusCode: 307 });
|
|
@@ -32719,7 +33535,7 @@ var init_color_patterns = __esm(() => {
|
|
|
32719
33535
|
|
|
32720
33536
|
// ../cms/src/tailwind-colors.ts
|
|
32721
33537
|
import fs9 from "fs/promises";
|
|
32722
|
-
import
|
|
33538
|
+
import path13 from "path";
|
|
32723
33539
|
async function parseTailwindConfig(projectRoot = getProjectRoot()) {
|
|
32724
33540
|
const cssFiles = [
|
|
32725
33541
|
"src/styles/global.css",
|
|
@@ -32733,7 +33549,7 @@ async function parseTailwindConfig(projectRoot = getProjectRoot()) {
|
|
|
32733
33549
|
];
|
|
32734
33550
|
let customColors = [];
|
|
32735
33551
|
for (const cssFile of cssFiles) {
|
|
32736
|
-
const fullPath =
|
|
33552
|
+
const fullPath = path13.join(projectRoot, cssFile);
|
|
32737
33553
|
try {
|
|
32738
33554
|
const content = await fs9.readFile(fullPath, "utf-8");
|
|
32739
33555
|
customColors = extractColorsFromCss(content);
|
|
@@ -32806,7 +33622,7 @@ async function parseTextStyles(projectRoot = getProjectRoot()) {
|
|
|
32806
33622
|
];
|
|
32807
33623
|
let customTextStyles = {};
|
|
32808
33624
|
for (const cssFile of cssFiles) {
|
|
32809
|
-
const fullPath =
|
|
33625
|
+
const fullPath = path13.join(projectRoot, cssFile);
|
|
32810
33626
|
try {
|
|
32811
33627
|
const content = await fs9.readFile(fullPath, "utf-8");
|
|
32812
33628
|
customTextStyles = extractTextStylesFromCss(content);
|
|
@@ -33274,7 +34090,7 @@ var init_local_admin = __esm(() => {
|
|
|
33274
34090
|
|
|
33275
34091
|
// ../cms/src/manifest-writer.ts
|
|
33276
34092
|
import fs10 from "fs/promises";
|
|
33277
|
-
import
|
|
34093
|
+
import path14 from "path";
|
|
33278
34094
|
|
|
33279
34095
|
class ManifestWriter {
|
|
33280
34096
|
globalManifest;
|
|
@@ -33345,10 +34161,10 @@ class ManifestWriter {
|
|
|
33345
34161
|
}
|
|
33346
34162
|
getPageManifestPath(pagePath) {
|
|
33347
34163
|
if (pagePath === "/" || pagePath === "") {
|
|
33348
|
-
return
|
|
34164
|
+
return path14.join(this.outDir, "index.json");
|
|
33349
34165
|
}
|
|
33350
34166
|
const cleanPath = pagePath.replace(/^\//, "");
|
|
33351
|
-
return
|
|
34167
|
+
return path14.join(this.outDir, `${cleanPath}.json`);
|
|
33352
34168
|
}
|
|
33353
34169
|
addPage(pagePath, entries, components, collection, seo) {
|
|
33354
34170
|
this.pageManifests.set(pagePath, { entries, components, collection, seo });
|
|
@@ -33374,7 +34190,7 @@ class ManifestWriter {
|
|
|
33374
34190
|
}
|
|
33375
34191
|
async writePageManifest(pagePath, entries, components, collection, seo) {
|
|
33376
34192
|
const manifestPath = this.getPageManifestPath(pagePath);
|
|
33377
|
-
const manifestDir =
|
|
34193
|
+
const manifestDir = path14.dirname(manifestPath);
|
|
33378
34194
|
await fs10.mkdir(manifestDir, { recursive: true });
|
|
33379
34195
|
const metadata = {
|
|
33380
34196
|
version: MANIFEST_VERSION,
|
|
@@ -33430,7 +34246,7 @@ class ManifestWriter {
|
|
|
33430
34246
|
}
|
|
33431
34247
|
}
|
|
33432
34248
|
if (this.outDir) {
|
|
33433
|
-
const globalManifestPath =
|
|
34249
|
+
const globalManifestPath = path14.join(this.outDir, this.manifestFile);
|
|
33434
34250
|
const globalSettings = {
|
|
33435
34251
|
componentDefinitions: this.componentDefinitions,
|
|
33436
34252
|
pages
|
|
@@ -33540,8 +34356,8 @@ function $constructor(name, initializer, params) {
|
|
|
33540
34356
|
initializer(inst, def);
|
|
33541
34357
|
const proto = _2.prototype;
|
|
33542
34358
|
const keys = Object.keys(proto);
|
|
33543
|
-
for (let
|
|
33544
|
-
const k = keys[
|
|
34359
|
+
for (let i2 = 0;i2 < keys.length; i2++) {
|
|
34360
|
+
const k = keys[i2];
|
|
33545
34361
|
if (!(k in inst)) {
|
|
33546
34362
|
inst[k] = proto[k].bind(inst);
|
|
33547
34363
|
}
|
|
@@ -33692,10 +34508,10 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
33692
34508
|
fieldErrors._errors.push(mapper(issue));
|
|
33693
34509
|
} else {
|
|
33694
34510
|
let curr = fieldErrors;
|
|
33695
|
-
let
|
|
33696
|
-
while (
|
|
33697
|
-
const el = issue.path[
|
|
33698
|
-
const terminal =
|
|
34511
|
+
let i2 = 0;
|
|
34512
|
+
while (i2 < issue.path.length) {
|
|
34513
|
+
const el = issue.path[i2];
|
|
34514
|
+
const terminal = i2 === issue.path.length - 1;
|
|
33699
34515
|
if (!terminal) {
|
|
33700
34516
|
curr[el] = curr[el] || { _errors: [] };
|
|
33701
34517
|
} else {
|
|
@@ -33703,7 +34519,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
33703
34519
|
curr[el]._errors.push(mapper(issue));
|
|
33704
34520
|
}
|
|
33705
34521
|
curr = curr[el];
|
|
33706
|
-
|
|
34522
|
+
i2++;
|
|
33707
34523
|
}
|
|
33708
34524
|
}
|
|
33709
34525
|
}
|
|
@@ -33897,8 +34713,8 @@ class $ZodRegistry {
|
|
|
33897
34713
|
if (p) {
|
|
33898
34714
|
const pm = { ...this.get(p) ?? {} };
|
|
33899
34715
|
delete pm.id;
|
|
33900
|
-
const
|
|
33901
|
-
return Object.keys(
|
|
34716
|
+
const f2 = { ...pm, ...this._map.get(schema) };
|
|
34717
|
+
return Object.keys(f2).length ? f2 : undefined;
|
|
33902
34718
|
}
|
|
33903
34719
|
return this._map.get(schema);
|
|
33904
34720
|
}
|
|
@@ -34042,7 +34858,7 @@ var init_field_types = __esm(() => {
|
|
|
34042
34858
|
|
|
34043
34859
|
// ../cms/src/migrate-astro-image.ts
|
|
34044
34860
|
import fs11 from "fs/promises";
|
|
34045
|
-
import
|
|
34861
|
+
import path15 from "path";
|
|
34046
34862
|
async function migrateAstroImages(options = {}) {
|
|
34047
34863
|
const projectRoot = options.projectRoot ?? getProjectRoot();
|
|
34048
34864
|
const dryRun = options.dryRun ?? false;
|
|
@@ -34050,11 +34866,11 @@ async function migrateAstroImages(options = {}) {
|
|
|
34050
34866
|
const migrations = [];
|
|
34051
34867
|
const skipped = [];
|
|
34052
34868
|
for (const def of Object.values(collections)) {
|
|
34053
|
-
const astroFields = def.fields.filter((
|
|
34869
|
+
const astroFields = def.fields.filter((f2) => f2.astroImage);
|
|
34054
34870
|
if (astroFields.length === 0 || !def.entries)
|
|
34055
34871
|
continue;
|
|
34056
34872
|
for (const entry of def.entries) {
|
|
34057
|
-
const entryAbs =
|
|
34873
|
+
const entryAbs = path15.isAbsolute(entry.sourcePath) ? entry.sourcePath : path15.join(projectRoot, entry.sourcePath);
|
|
34058
34874
|
let raw;
|
|
34059
34875
|
try {
|
|
34060
34876
|
raw = await fs11.readFile(entryAbs, "utf-8");
|
|
@@ -34079,7 +34895,7 @@ async function migrateAstroImages(options = {}) {
|
|
|
34079
34895
|
}
|
|
34080
34896
|
if (!current.startsWith("/") || current.startsWith("//"))
|
|
34081
34897
|
continue;
|
|
34082
|
-
const sourceAbs =
|
|
34898
|
+
const sourceAbs = path15.join(projectRoot, "public", current.replace(/^\/+/, ""));
|
|
34083
34899
|
let sourceBuf;
|
|
34084
34900
|
try {
|
|
34085
34901
|
sourceBuf = await fs11.readFile(sourceAbs);
|
|
@@ -34090,11 +34906,11 @@ async function migrateAstroImages(options = {}) {
|
|
|
34090
34906
|
const target = await pickAstroImageTarget({
|
|
34091
34907
|
entryAbsPath: entryAbs,
|
|
34092
34908
|
slug: entry.slug,
|
|
34093
|
-
originalFilename:
|
|
34909
|
+
originalFilename: path15.basename(current),
|
|
34094
34910
|
compareBuffer: sourceBuf
|
|
34095
34911
|
});
|
|
34096
34912
|
if (!dryRun) {
|
|
34097
|
-
await fs11.mkdir(
|
|
34913
|
+
await fs11.mkdir(path15.dirname(target.absPath), { recursive: true });
|
|
34098
34914
|
await fs11.writeFile(target.absPath, sourceBuf);
|
|
34099
34915
|
}
|
|
34100
34916
|
doc2.set(field.name, target.relPath);
|
|
@@ -34157,7 +34973,7 @@ var exports_migrate = {};
|
|
|
34157
34973
|
__export(exports_migrate, {
|
|
34158
34974
|
migrate: () => migrate
|
|
34159
34975
|
});
|
|
34160
|
-
import
|
|
34976
|
+
import path16 from "path";
|
|
34161
34977
|
async function migrate(args) {
|
|
34162
34978
|
if (args.target !== "astro-image") {
|
|
34163
34979
|
console.error(`Unknown migrate target: ${args.target}`);
|
|
@@ -34173,10 +34989,10 @@ async function migrate(args) {
|
|
|
34173
34989
|
} else {
|
|
34174
34990
|
console.log(`${result.migrations.length} field(s) to migrate:
|
|
34175
34991
|
`);
|
|
34176
|
-
for (const
|
|
34177
|
-
console.log(` ${
|
|
34178
|
-
console.log(` ${
|
|
34179
|
-
console.log(` copy: ${
|
|
34992
|
+
for (const m2 of result.migrations) {
|
|
34993
|
+
console.log(` ${m2.entrySourcePath}`);
|
|
34994
|
+
console.log(` ${m2.fieldName}: ${m2.originalValue} \u2192 ${m2.newValue}`);
|
|
34995
|
+
console.log(` copy: ${path16.relative(process.cwd(), m2.copiedFrom)} \u2192 ${path16.relative(process.cwd(), m2.copiedTo)}`);
|
|
34180
34996
|
}
|
|
34181
34997
|
}
|
|
34182
34998
|
if (result.skipped.length > 0) {
|
|
@@ -34218,7 +35034,7 @@ Commands:`);
|
|
|
34218
35034
|
console.log(" build Run astro build with the Nua defaults");
|
|
34219
35035
|
console.log(" dev Run astro dev with the Nua defaults");
|
|
34220
35036
|
console.log(" preview Run astro preview with the Nua defaults");
|
|
34221
|
-
console.log(" check Validate the
|
|
35037
|
+
console.log(" check Validate collections and parse the source (no build). --json, --strict, --content-only");
|
|
34222
35038
|
console.log(" init Convert a standard Astro project to use Nua");
|
|
34223
35039
|
console.log(" clean Eject to a standard Astro project (remove @nuasite/* deps)");
|
|
34224
35040
|
console.log(" migrate <target> Run a content migration. Targets: astro-image");
|
|
@@ -34236,7 +35052,8 @@ if (command && ["build", "dev", "preview"].includes(command)) {
|
|
|
34236
35052
|
process.exit(await check2({
|
|
34237
35053
|
cwd: process.cwd(),
|
|
34238
35054
|
json: args.includes("--json"),
|
|
34239
|
-
strict: args.includes("--strict")
|
|
35055
|
+
strict: args.includes("--strict"),
|
|
35056
|
+
contentOnly: args.includes("--content-only")
|
|
34240
35057
|
}));
|
|
34241
35058
|
break;
|
|
34242
35059
|
}
|