@nuasite/cli 0.52.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 +11 -3
- package/dist/index.js +1251 -464
- 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 +2 -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 +17 -4
- 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,6 +23827,800 @@ 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, {
|
|
@@ -23833,21 +24628,21 @@ __export(exports_check, {
|
|
|
23833
24628
|
astroRoots: () => astroRoots
|
|
23834
24629
|
});
|
|
23835
24630
|
import { existsSync, readdirSync } from "fs";
|
|
23836
|
-
import
|
|
24631
|
+
import path5 from "path";
|
|
23837
24632
|
function astroRoots(cwd) {
|
|
23838
24633
|
if (hasAstroConfig(cwd))
|
|
23839
24634
|
return ["."];
|
|
23840
|
-
const packagesDir =
|
|
24635
|
+
const packagesDir = path5.join(cwd, "packages");
|
|
23841
24636
|
if (!existsSync(packagesDir))
|
|
23842
24637
|
return [];
|
|
23843
|
-
return readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort().filter((name) => hasAstroConfig(
|
|
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));
|
|
23844
24639
|
}
|
|
23845
24640
|
function prefixed(report, root) {
|
|
23846
24641
|
if (root === ".")
|
|
23847
24642
|
return report;
|
|
23848
24643
|
return {
|
|
23849
24644
|
...report,
|
|
23850
|
-
findings: report.findings.map((finding) => ({ ...finding, file:
|
|
24645
|
+
findings: report.findings.map((finding) => ({ ...finding, file: path5.join(root, finding.file) }))
|
|
23851
24646
|
};
|
|
23852
24647
|
}
|
|
23853
24648
|
async function check(options) {
|
|
@@ -23856,12 +24651,24 @@ async function check(options) {
|
|
|
23856
24651
|
console.error(`No astro.config.* found in ${options.cwd} or its packages/*. Run this in an Astro project.`);
|
|
23857
24652
|
return 1;
|
|
23858
24653
|
}
|
|
23859
|
-
const reports = await Promise.all(roots.map(async (root) =>
|
|
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
|
+
}));
|
|
23860
24666
|
const report = {
|
|
23861
24667
|
findings: reports.flatMap((one) => one.findings),
|
|
23862
24668
|
collections: reports.reduce((total, one) => total + one.collections, 0),
|
|
23863
24669
|
entries: reports.reduce((total, one) => total + one.entries, 0)
|
|
23864
24670
|
};
|
|
24671
|
+
const sourceFiles = reports.reduce((total, one) => total + one.files, 0);
|
|
23865
24672
|
const errors = report.findings.filter((finding) => finding.severity === "error").length;
|
|
23866
24673
|
const warnings = report.findings.length - errors;
|
|
23867
24674
|
if (options.json) {
|
|
@@ -23872,14 +24679,16 @@ async function check(options) {
|
|
|
23872
24679
|
console.log(formatted + `
|
|
23873
24680
|
`);
|
|
23874
24681
|
const where = roots.length === 1 && roots[0] === "." ? "" : ` in ${roots.join(", ")}`;
|
|
23875
|
-
const
|
|
24682
|
+
const code = options.contentOnly ? "" : `, ${sourceFiles} source file(s)`;
|
|
24683
|
+
const counts = `${report.collections} collection(s), ${report.entries} entries${code}${where}`;
|
|
23876
24684
|
console.log(errors === 0 && warnings === 0 ? `${counts} \u2014 no problems found` : `${counts} \u2014 ${errors} error(s), ${warnings} warning(s)`);
|
|
23877
24685
|
}
|
|
23878
24686
|
return errors > 0 || options.strict && warnings > 0 ? 1 : 0;
|
|
23879
24687
|
}
|
|
23880
|
-
var ASTRO_CONFIG_NAMES, hasAstroConfig = (dir) => ASTRO_CONFIG_NAMES.some((name) => existsSync(
|
|
24688
|
+
var ASTRO_CONFIG_NAMES, hasAstroConfig = (dir) => ASTRO_CONFIG_NAMES.some((name) => existsSync(path5.join(dir, name)));
|
|
23881
24689
|
var init_check2 = __esm(() => {
|
|
23882
24690
|
init_src2();
|
|
24691
|
+
init_check_code();
|
|
23883
24692
|
ASTRO_CONFIG_NAMES = ["astro.config.ts", "astro.config.mts", "astro.config.mjs", "astro.config.js"];
|
|
23884
24693
|
});
|
|
23885
24694
|
|
|
@@ -23899,11 +24708,11 @@ function findMatchingClose(text, start) {
|
|
|
23899
24708
|
const close = open === "{" ? "}" : open === "[" ? "]" : ")";
|
|
23900
24709
|
let depth = 0;
|
|
23901
24710
|
let inString = false;
|
|
23902
|
-
for (let
|
|
23903
|
-
const ch = text[
|
|
24711
|
+
for (let i2 = start;i2 < text.length; i2++) {
|
|
24712
|
+
const ch = text[i2];
|
|
23904
24713
|
if (inString) {
|
|
23905
24714
|
if (ch === "\\") {
|
|
23906
|
-
|
|
24715
|
+
i2++;
|
|
23907
24716
|
continue;
|
|
23908
24717
|
}
|
|
23909
24718
|
if (ch === inString)
|
|
@@ -23919,7 +24728,7 @@ function findMatchingClose(text, start) {
|
|
|
23919
24728
|
if (ch === close) {
|
|
23920
24729
|
depth--;
|
|
23921
24730
|
if (depth === 0)
|
|
23922
|
-
return
|
|
24731
|
+
return i2;
|
|
23923
24732
|
}
|
|
23924
24733
|
}
|
|
23925
24734
|
return -1;
|
|
@@ -23941,20 +24750,20 @@ function removeProperty(body, propName) {
|
|
|
23941
24750
|
return body;
|
|
23942
24751
|
const propLineStart = match.index + 1;
|
|
23943
24752
|
const afterMatch = match.index + match[0].length;
|
|
23944
|
-
let
|
|
23945
|
-
while (
|
|
23946
|
-
|
|
24753
|
+
let i2 = afterMatch;
|
|
24754
|
+
while (i2 < body.length && (body[i2] === " " || body[i2] === "\t"))
|
|
24755
|
+
i2++;
|
|
23947
24756
|
let valueEnd;
|
|
23948
|
-
if (body[
|
|
23949
|
-
valueEnd = findMatchingClose(body,
|
|
24757
|
+
if (body[i2] === "{" || body[i2] === "[") {
|
|
24758
|
+
valueEnd = findMatchingClose(body, i2);
|
|
23950
24759
|
if (valueEnd === -1)
|
|
23951
24760
|
return body;
|
|
23952
24761
|
valueEnd++;
|
|
23953
24762
|
} else {
|
|
23954
|
-
while (
|
|
24763
|
+
while (i2 < body.length && body[i2] !== "," && body[i2] !== `
|
|
23955
24764
|
`)
|
|
23956
|
-
|
|
23957
|
-
valueEnd =
|
|
24765
|
+
i2++;
|
|
24766
|
+
valueEnd = i2;
|
|
23958
24767
|
}
|
|
23959
24768
|
let end = valueEnd;
|
|
23960
24769
|
while (end < body.length && (body[end] === " " || body[end] === "\t"))
|
|
@@ -24131,7 +24940,7 @@ function transformPackageJson(pkg, nuaVersion) {
|
|
|
24131
24940
|
if (!result.dependencies["@nuasite/nua"]) {
|
|
24132
24941
|
result.dependencies["@nuasite/nua"] = nuaVersion;
|
|
24133
24942
|
}
|
|
24134
|
-
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)));
|
|
24135
24944
|
return result;
|
|
24136
24945
|
}
|
|
24137
24946
|
async function init({ cwd = process.cwd(), dryRun = false, yes = false } = {}) {
|
|
@@ -24241,9 +25050,9 @@ function detectDisabledFeatures(content) {
|
|
|
24241
25050
|
}
|
|
24242
25051
|
function prependToArrayProperty(lines, property, items) {
|
|
24243
25052
|
const pattern = new RegExp(`\\b${property}\\s*:\\s*\\[`);
|
|
24244
|
-
for (let
|
|
24245
|
-
if (pattern.test(lines[
|
|
24246
|
-
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}, `);
|
|
24247
25056
|
return true;
|
|
24248
25057
|
}
|
|
24249
25058
|
}
|
|
@@ -24332,7 +25141,7 @@ function transformPackageJson2(pkg, disabled, usedRuntimePackages = []) {
|
|
|
24332
25141
|
result.dependencies[name] = nuaVersion ?? "^0.16.0";
|
|
24333
25142
|
}
|
|
24334
25143
|
}
|
|
24335
|
-
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)));
|
|
24336
25145
|
return result;
|
|
24337
25146
|
}
|
|
24338
25147
|
function scanForNuasiteUsage(cwd) {
|
|
@@ -24480,7 +25289,7 @@ var init_config = () => {};
|
|
|
24480
25289
|
|
|
24481
25290
|
// ../cms/src/component-registry.ts
|
|
24482
25291
|
import fs2 from "fs/promises";
|
|
24483
|
-
import
|
|
25292
|
+
import path6 from "path";
|
|
24484
25293
|
|
|
24485
25294
|
class ComponentRegistry {
|
|
24486
25295
|
components = new Map;
|
|
@@ -24490,7 +25299,7 @@ class ComponentRegistry {
|
|
|
24490
25299
|
}
|
|
24491
25300
|
async scan() {
|
|
24492
25301
|
for (const dir of this.componentDirs) {
|
|
24493
|
-
const fullPath =
|
|
25302
|
+
const fullPath = path6.join(getProjectRoot(), dir);
|
|
24494
25303
|
try {
|
|
24495
25304
|
await this.scanDirectory(fullPath, dir);
|
|
24496
25305
|
} catch {}
|
|
@@ -24505,8 +25314,8 @@ class ComponentRegistry {
|
|
|
24505
25314
|
async scanDirectory(dir, relativePath) {
|
|
24506
25315
|
const entries = await fs2.readdir(dir, { withFileTypes: true });
|
|
24507
25316
|
for (const entry of entries) {
|
|
24508
|
-
const fullPath =
|
|
24509
|
-
const relPath =
|
|
25317
|
+
const fullPath = path6.join(dir, entry.name);
|
|
25318
|
+
const relPath = path6.join(relativePath, entry.name);
|
|
24510
25319
|
if (entry.isDirectory()) {
|
|
24511
25320
|
await this.scanDirectory(fullPath, relPath);
|
|
24512
25321
|
} else if (entry.isFile() && entry.name.endsWith(".astro")) {
|
|
@@ -24517,7 +25326,7 @@ class ComponentRegistry {
|
|
|
24517
25326
|
async parseComponent(filePath, relativePath) {
|
|
24518
25327
|
try {
|
|
24519
25328
|
const content = await fs2.readFile(filePath, "utf-8");
|
|
24520
|
-
const componentName =
|
|
25329
|
+
const componentName = path6.basename(filePath, ".astro");
|
|
24521
25330
|
const props = await this.extractProps(content);
|
|
24522
25331
|
const slots = this.extractSlots(content);
|
|
24523
25332
|
const description = this.extractDescription(content);
|
|
@@ -24663,18 +25472,18 @@ ${propsContent}
|
|
|
24663
25472
|
return null;
|
|
24664
25473
|
const startIndex = match.index + match[0].length;
|
|
24665
25474
|
let depth = 1;
|
|
24666
|
-
let
|
|
24667
|
-
while (
|
|
24668
|
-
if (text[
|
|
25475
|
+
let i2 = startIndex;
|
|
25476
|
+
while (i2 < text.length && depth > 0) {
|
|
25477
|
+
if (text[i2] === "{") {
|
|
24669
25478
|
depth++;
|
|
24670
|
-
} else if (text[
|
|
25479
|
+
} else if (text[i2] === "}") {
|
|
24671
25480
|
depth--;
|
|
24672
25481
|
}
|
|
24673
|
-
|
|
25482
|
+
i2++;
|
|
24674
25483
|
}
|
|
24675
25484
|
if (depth !== 0)
|
|
24676
25485
|
return null;
|
|
24677
|
-
return text.substring(startIndex,
|
|
25486
|
+
return text.substring(startIndex, i2 - 1);
|
|
24678
25487
|
}
|
|
24679
25488
|
async extractProps(content) {
|
|
24680
25489
|
const props = [];
|
|
@@ -24772,7 +25581,7 @@ function slugify2(text) {
|
|
|
24772
25581
|
|
|
24773
25582
|
// ../cms/src/utils.ts
|
|
24774
25583
|
import { createHash } from "crypto";
|
|
24775
|
-
import
|
|
25584
|
+
import path7 from "path";
|
|
24776
25585
|
function normalizePagePath(url) {
|
|
24777
25586
|
let pathname;
|
|
24778
25587
|
try {
|
|
@@ -24811,7 +25620,7 @@ function generateSourceFileHashes(entries) {
|
|
|
24811
25620
|
}
|
|
24812
25621
|
const hashes = {};
|
|
24813
25622
|
for (const [filePath, fileEntries] of Object.entries(entriesByFile)) {
|
|
24814
|
-
const sorted = fileEntries.sort((a,
|
|
25623
|
+
const sorted = fileEntries.sort((a, b2) => (a.sourceLine || 0) - (b2.sourceLine || 0));
|
|
24815
25624
|
const content = sorted.map((e) => `${e.sourceLine || 0}|${e.text}|${e.sourceSnippet || ""}`).join(`
|
|
24816
25625
|
`);
|
|
24817
25626
|
hashes[filePath] = sha256(content);
|
|
@@ -24825,27 +25634,27 @@ function escapeReplacement(str) {
|
|
|
24825
25634
|
return str.replace(/\$/g, "$$$$");
|
|
24826
25635
|
}
|
|
24827
25636
|
function resolveSourcePath(sourcePath) {
|
|
24828
|
-
return
|
|
25637
|
+
return path7.isAbsolute(sourcePath) ? sourcePath : path7.join(getProjectRoot(), sourcePath);
|
|
24829
25638
|
}
|
|
24830
25639
|
function resolveAndValidatePath(filePath) {
|
|
24831
25640
|
const projectRoot = getProjectRoot();
|
|
24832
|
-
const resolvedRoot =
|
|
25641
|
+
const resolvedRoot = path7.resolve(projectRoot);
|
|
24833
25642
|
const isAbsoluteFs = filePath.startsWith(resolvedRoot);
|
|
24834
25643
|
const normalizedPath = !isAbsoluteFs && filePath.startsWith("/") ? filePath.slice(1) : filePath;
|
|
24835
|
-
const fullPath =
|
|
24836
|
-
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) {
|
|
24837
25646
|
throw new Error(`Path traversal detected: ${filePath}`);
|
|
24838
25647
|
}
|
|
24839
25648
|
return fullPath;
|
|
24840
25649
|
}
|
|
24841
25650
|
async function acquireFileLock(filePath) {
|
|
24842
|
-
const key =
|
|
25651
|
+
const key = path7.resolve(filePath);
|
|
24843
25652
|
while (fileLocks.has(key)) {
|
|
24844
25653
|
await fileLocks.get(key);
|
|
24845
25654
|
}
|
|
24846
25655
|
let release;
|
|
24847
|
-
const lockPromise = new Promise((
|
|
24848
|
-
release =
|
|
25656
|
+
const lockPromise = new Promise((resolve2) => {
|
|
25657
|
+
release = resolve2;
|
|
24849
25658
|
});
|
|
24850
25659
|
fileLocks.set(key, lockPromise);
|
|
24851
25660
|
return () => {
|
|
@@ -24857,8 +25666,8 @@ function escapeHtml2(text) {
|
|
|
24857
25666
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
24858
25667
|
}
|
|
24859
25668
|
function relativeImportPath2(fromFile, toFile) {
|
|
24860
|
-
const fromDir =
|
|
24861
|
-
let rel =
|
|
25669
|
+
const fromDir = path7.dirname(fromFile);
|
|
25670
|
+
let rel = path7.relative(fromDir, toFile).split(path7.sep).join("/");
|
|
24862
25671
|
if (!rel.startsWith("."))
|
|
24863
25672
|
rel = `./${rel}`;
|
|
24864
25673
|
return rel;
|
|
@@ -24871,7 +25680,7 @@ var init_utils2 = __esm(() => {
|
|
|
24871
25680
|
|
|
24872
25681
|
// ../cms/src/handlers/component-ops.ts
|
|
24873
25682
|
import fs3 from "fs/promises";
|
|
24874
|
-
import
|
|
25683
|
+
import path8 from "path";
|
|
24875
25684
|
async function handleInsertComponent(request, manifestWriter) {
|
|
24876
25685
|
const { position, referenceComponentId, componentName, props, meta } = request;
|
|
24877
25686
|
if (!meta?.url) {
|
|
@@ -25012,12 +25821,12 @@ async function handleRemoveComponent(request, manifestWriter) {
|
|
|
25012
25821
|
function findComponentBounds(lines, startLineIndex, componentName) {
|
|
25013
25822
|
const startLine = startLineIndex;
|
|
25014
25823
|
let tagClosed = false;
|
|
25015
|
-
for (let
|
|
25016
|
-
const currentLine = lines[
|
|
25824
|
+
for (let i2 = startLineIndex;i2 < lines.length; i2++) {
|
|
25825
|
+
const currentLine = lines[i2];
|
|
25017
25826
|
const selfCloseIdx = currentLine.indexOf("/>");
|
|
25018
25827
|
const openEndIdx = currentLine.indexOf(">");
|
|
25019
25828
|
if (selfCloseIdx >= 0 && (openEndIdx < 0 || selfCloseIdx <= openEndIdx)) {
|
|
25020
|
-
return { startLine, endLine:
|
|
25829
|
+
return { startLine, endLine: i2 };
|
|
25021
25830
|
}
|
|
25022
25831
|
if (openEndIdx >= 0) {
|
|
25023
25832
|
tagClosed = true;
|
|
@@ -25031,8 +25840,8 @@ function findComponentBounds(lines, startLineIndex, componentName) {
|
|
|
25031
25840
|
const closingTag = `</${componentName}>`;
|
|
25032
25841
|
let depth = 1;
|
|
25033
25842
|
let endLine = startLineIndex;
|
|
25034
|
-
for (let
|
|
25035
|
-
const currentLine = lines[
|
|
25843
|
+
for (let i2 = startLineIndex + 1;i2 < lines.length; i2++) {
|
|
25844
|
+
const currentLine = lines[i2];
|
|
25036
25845
|
const openingMatches = currentLine.match(new RegExp(`<${escapedName}(?:\\s|>)`, "g"));
|
|
25037
25846
|
if (openingMatches) {
|
|
25038
25847
|
for (const match of openingMatches) {
|
|
@@ -25048,7 +25857,7 @@ function findComponentBounds(lines, startLineIndex, componentName) {
|
|
|
25048
25857
|
depth -= closingMatches.length;
|
|
25049
25858
|
}
|
|
25050
25859
|
if (depth <= 0) {
|
|
25051
|
-
endLine =
|
|
25860
|
+
endLine = i2;
|
|
25052
25861
|
break;
|
|
25053
25862
|
}
|
|
25054
25863
|
}
|
|
@@ -25089,7 +25898,7 @@ function getComponentOccurrenceIndex(manifest, referenceComponent) {
|
|
|
25089
25898
|
async function findComponentInvocationFile(projectRoot, pageUrl, manifest, referenceComponent) {
|
|
25090
25899
|
if (referenceComponent.invocationSourcePath) {
|
|
25091
25900
|
const filePath = normalizeFilePath(referenceComponent.invocationSourcePath);
|
|
25092
|
-
const fullPath =
|
|
25901
|
+
const fullPath = path8.resolve(projectRoot, filePath);
|
|
25093
25902
|
try {
|
|
25094
25903
|
const content = await fs3.readFile(fullPath, "utf-8");
|
|
25095
25904
|
const lines = content.split(`
|
|
@@ -25103,7 +25912,7 @@ async function findComponentInvocationFile(projectRoot, pageUrl, manifest, refer
|
|
|
25103
25912
|
const candidates = getPageFileCandidates(pageUrl);
|
|
25104
25913
|
const occurrenceIndex = getComponentOccurrenceIndex(manifest, referenceComponent);
|
|
25105
25914
|
for (const candidate of candidates) {
|
|
25106
|
-
const fullPath =
|
|
25915
|
+
const fullPath = path8.resolve(projectRoot, candidate);
|
|
25107
25916
|
try {
|
|
25108
25917
|
const content = await fs3.readFile(fullPath, "utf-8");
|
|
25109
25918
|
const lines = content.split(`
|
|
@@ -25119,22 +25928,22 @@ async function findComponentInvocationFile(projectRoot, pageUrl, manifest, refer
|
|
|
25119
25928
|
function findComponentInvocationLine(lines, componentName, occurrenceIndex) {
|
|
25120
25929
|
const pattern = new RegExp(`<${escapeRegex(componentName)}(?:\\s|>|/>|$)`);
|
|
25121
25930
|
const startLine = findFrontmatterEnd(lines);
|
|
25122
|
-
let
|
|
25123
|
-
for (let
|
|
25124
|
-
if (pattern.test(lines[
|
|
25125
|
-
if (
|
|
25126
|
-
return
|
|
25127
|
-
|
|
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++;
|
|
25128
25937
|
}
|
|
25129
25938
|
}
|
|
25130
|
-
return
|
|
25939
|
+
return found2 > 0 ? findComponentInvocationLine(lines, componentName, 0) : -1;
|
|
25131
25940
|
}
|
|
25132
25941
|
function findFrontmatterEnd(lines) {
|
|
25133
25942
|
if (lines.length === 0 || lines[0].trim() !== "---")
|
|
25134
25943
|
return 0;
|
|
25135
|
-
for (let
|
|
25136
|
-
if (lines[
|
|
25137
|
-
return
|
|
25944
|
+
for (let i2 = 1;i2 < lines.length; i2++) {
|
|
25945
|
+
if (lines[i2].trim() === "---")
|
|
25946
|
+
return i2 + 1;
|
|
25138
25947
|
}
|
|
25139
25948
|
return 0;
|
|
25140
25949
|
}
|
|
@@ -25163,7 +25972,7 @@ function getIndentation(line) {
|
|
|
25163
25972
|
function normalizeFilePath(p) {
|
|
25164
25973
|
if (!p.startsWith("/"))
|
|
25165
25974
|
return p;
|
|
25166
|
-
const projectRoot =
|
|
25975
|
+
const projectRoot = path8.resolve(getProjectRoot());
|
|
25167
25976
|
if (p.startsWith(projectRoot))
|
|
25168
25977
|
return p;
|
|
25169
25978
|
return p.slice(1);
|
|
@@ -25171,17 +25980,17 @@ function normalizeFilePath(p) {
|
|
|
25171
25980
|
function ensureComponentImport(lines, componentName, componentFile, targetFile) {
|
|
25172
25981
|
const importPattern = new RegExp(`import\\s+${escapeRegex(componentName)}\\s+from\\s+['"]`);
|
|
25173
25982
|
const frontmatterEnd = findFrontmatterEnd(lines);
|
|
25174
|
-
for (let
|
|
25175
|
-
if (importPattern.test(lines[
|
|
25983
|
+
for (let i2 = 0;i2 < frontmatterEnd; i2++) {
|
|
25984
|
+
if (importPattern.test(lines[i2])) {
|
|
25176
25985
|
return;
|
|
25177
25986
|
}
|
|
25178
25987
|
}
|
|
25179
25988
|
const importStatement = `import ${componentName} from '${relativeImportPath2(targetFile, componentFile)}'`;
|
|
25180
25989
|
if (frontmatterEnd > 0) {
|
|
25181
25990
|
let insertAt = 1;
|
|
25182
|
-
for (let
|
|
25183
|
-
if (/^\s*import\s/.test(lines[
|
|
25184
|
-
insertAt =
|
|
25991
|
+
for (let i2 = 1;i2 < frontmatterEnd - 1; i2++) {
|
|
25992
|
+
if (/^\s*import\s/.test(lines[i2])) {
|
|
25993
|
+
insertAt = i2 + 1;
|
|
25185
25994
|
}
|
|
25186
25995
|
}
|
|
25187
25996
|
lines.splice(insertAt, 0, importStatement);
|
|
@@ -25218,11 +26027,11 @@ function buildMapPattern(varName) {
|
|
|
25218
26027
|
}
|
|
25219
26028
|
function detectArrayPattern(lines, invocationLineIndex) {
|
|
25220
26029
|
const searchStart = Math.max(0, invocationLineIndex - 5);
|
|
25221
|
-
for (let
|
|
25222
|
-
const line = lines[
|
|
26030
|
+
for (let i2 = invocationLineIndex;i2 >= searchStart; i2--) {
|
|
26031
|
+
const line = lines[i2];
|
|
25223
26032
|
const match = line.match(new RegExp(buildMapPattern()));
|
|
25224
26033
|
if (match) {
|
|
25225
|
-
return { arrayVarName: match[1], mapLineIndex:
|
|
26034
|
+
return { arrayVarName: match[1], mapLineIndex: i2 };
|
|
25226
26035
|
}
|
|
25227
26036
|
}
|
|
25228
26037
|
return null;
|
|
@@ -25284,10 +26093,10 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25284
26093
|
let mapLineIndex = -1;
|
|
25285
26094
|
let occurrencesSeen = 0;
|
|
25286
26095
|
const mapPattern = new RegExp(buildMapPattern(arrayVarName));
|
|
25287
|
-
for (let
|
|
25288
|
-
if (mapPattern.test(lines2[
|
|
26096
|
+
for (let i2 = fmEnd2;i2 < lines2.length; i2++) {
|
|
26097
|
+
if (mapPattern.test(lines2[i2])) {
|
|
25289
26098
|
if (occurrencesSeen === mapOccurrence) {
|
|
25290
|
-
mapLineIndex =
|
|
26099
|
+
mapLineIndex = i2;
|
|
25291
26100
|
break;
|
|
25292
26101
|
}
|
|
25293
26102
|
occurrencesSeen++;
|
|
@@ -25301,7 +26110,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25301
26110
|
const elementBounds2 = findArrayDeclaration(frontmatterContent2, frontmatterStartLine2, arrayVarName);
|
|
25302
26111
|
if (!elementBounds2 || elementBounds2.length === 0)
|
|
25303
26112
|
return null;
|
|
25304
|
-
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));
|
|
25305
26114
|
const arrayIndex2 = sameSourceComponents2.findIndex((c) => c.id === component.id);
|
|
25306
26115
|
if (arrayIndex2 < 0 || arrayIndex2 >= elementBounds2.length)
|
|
25307
26116
|
return null;
|
|
@@ -25348,7 +26157,7 @@ async function resolveArrayContext(component, manifest, pageUrl) {
|
|
|
25348
26157
|
return null;
|
|
25349
26158
|
}
|
|
25350
26159
|
const occurrenceIndex = getComponentOccurrenceIndex(manifest, component);
|
|
25351
|
-
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));
|
|
25352
26161
|
const arrayIndex = sameSourceComponents.findIndex((c) => c.id === component.id);
|
|
25353
26162
|
if (arrayIndex < 0 || arrayIndex >= elementBounds.length) {
|
|
25354
26163
|
return null;
|
|
@@ -25480,8 +26289,8 @@ async function handleAddArrayItem(request, manifestWriter) {
|
|
|
25480
26289
|
const newElement = generateObjectLiteral(props);
|
|
25481
26290
|
const indentation = getIndentation(freshLines[refBounds.startLine]);
|
|
25482
26291
|
const indentedLines = newElement.split(`
|
|
25483
|
-
`).map((line,
|
|
25484
|
-
if (
|
|
26292
|
+
`).map((line, i2) => {
|
|
26293
|
+
if (i2 === 0)
|
|
25485
26294
|
return indentation + line;
|
|
25486
26295
|
if (line.trim())
|
|
25487
26296
|
return indentation + line;
|
|
@@ -25505,11 +26314,11 @@ async function handleAddArrayItem(request, manifestWriter) {
|
|
|
25505
26314
|
const addedLineCount = indentedLines.split(`
|
|
25506
26315
|
`).length;
|
|
25507
26316
|
const closingSearchStart = lastEl.endLine + addedLineCount + 1;
|
|
25508
|
-
for (let
|
|
25509
|
-
if (freshLines[
|
|
25510
|
-
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];
|
|
25511
26320
|
if (prev?.trimEnd().endsWith(",")) {
|
|
25512
|
-
freshLines[
|
|
26321
|
+
freshLines[i2 - 1] = prev.replace(/,(\s*)$/, "$1");
|
|
25513
26322
|
}
|
|
25514
26323
|
break;
|
|
25515
26324
|
}
|
|
@@ -25571,45 +26380,45 @@ var init_array_ops = __esm(() => {
|
|
|
25571
26380
|
// ../cms/src/astro-image-paths.ts
|
|
25572
26381
|
import { createHash as createHash2 } from "crypto";
|
|
25573
26382
|
import fs5 from "fs/promises";
|
|
25574
|
-
import
|
|
26383
|
+
import path9 from "path";
|
|
25575
26384
|
function isHugoStyleEntry(entryAbsPath) {
|
|
25576
|
-
return HUGO_INDEX_RE.test(
|
|
26385
|
+
return HUGO_INDEX_RE.test(path9.basename(entryAbsPath));
|
|
25577
26386
|
}
|
|
25578
26387
|
function shortContentHash(buf) {
|
|
25579
26388
|
return createHash2("sha256").update(buf).digest("hex").slice(0, 8);
|
|
25580
26389
|
}
|
|
25581
26390
|
async function pickAstroImageTarget(args) {
|
|
25582
|
-
const entryDir =
|
|
26391
|
+
const entryDir = path9.dirname(args.entryAbsPath);
|
|
25583
26392
|
const isHugoStyle = isHugoStyleEntry(args.entryAbsPath);
|
|
25584
|
-
const safeFilename =
|
|
26393
|
+
const safeFilename = path9.basename(args.originalFilename);
|
|
25585
26394
|
if (!safeFilename || safeFilename === "." || safeFilename === "..") {
|
|
25586
26395
|
throw new Error(`Invalid filename: ${args.originalFilename}`);
|
|
25587
26396
|
}
|
|
25588
26397
|
const baseName = isHugoStyle ? safeFilename : `${args.slug}-${safeFilename}`;
|
|
25589
|
-
const baseAbs =
|
|
26398
|
+
const baseAbs = path9.join(entryDir, baseName);
|
|
25590
26399
|
if (await isFreeOrMatching(baseAbs, args.compareBuffer)) {
|
|
25591
26400
|
return { absPath: baseAbs, relPath: `./${baseName}` };
|
|
25592
26401
|
}
|
|
25593
26402
|
const candidateAbs = await pickHashedSibling(entryDir, baseName, args.compareBuffer);
|
|
25594
|
-
return { absPath: candidateAbs, relPath: `./${
|
|
26403
|
+
return { absPath: candidateAbs, relPath: `./${path9.basename(candidateAbs)}` };
|
|
25595
26404
|
}
|
|
25596
26405
|
async function pickSiblingTarget(dir, filename, buf) {
|
|
25597
|
-
const safe =
|
|
26406
|
+
const safe = path9.basename(filename);
|
|
25598
26407
|
if (!safe || safe === "." || safe === "..") {
|
|
25599
26408
|
throw new Error(`Invalid filename: ${filename}`);
|
|
25600
26409
|
}
|
|
25601
|
-
const baseAbs =
|
|
26410
|
+
const baseAbs = path9.join(dir, safe);
|
|
25602
26411
|
if (await isFreeOrMatching(baseAbs, buf))
|
|
25603
26412
|
return baseAbs;
|
|
25604
26413
|
return pickHashedSibling(dir, safe, buf);
|
|
25605
26414
|
}
|
|
25606
26415
|
async function pickHashedSibling(dir, baseName, buf) {
|
|
25607
26416
|
const hash = shortContentHash(buf);
|
|
25608
|
-
const ext =
|
|
25609
|
-
const stem =
|
|
26417
|
+
const ext = path9.extname(baseName);
|
|
26418
|
+
const stem = path9.basename(baseName, ext);
|
|
25610
26419
|
for (let attempt = 0;attempt < 5; attempt++) {
|
|
25611
26420
|
const suffix = attempt === 0 ? hash : `${hash}-${attempt}`;
|
|
25612
|
-
const candidateAbs =
|
|
26421
|
+
const candidateAbs = path9.join(dir, `${stem}-${suffix}${ext}`);
|
|
25613
26422
|
if (await isFreeOrMatching(candidateAbs, buf))
|
|
25614
26423
|
return candidateAbs;
|
|
25615
26424
|
}
|
|
@@ -25633,7 +26442,7 @@ var init_astro_image_paths = __esm(() => {
|
|
|
25633
26442
|
|
|
25634
26443
|
// ../cms/src/handlers/astro-image-upload.ts
|
|
25635
26444
|
import fs6 from "fs/promises";
|
|
25636
|
-
import
|
|
26445
|
+
import path10 from "path";
|
|
25637
26446
|
async function tryAstroImageUpload(args) {
|
|
25638
26447
|
const { collection, entry, field } = args.context;
|
|
25639
26448
|
if (!collection || !entry || !field)
|
|
@@ -25642,7 +26451,7 @@ async function tryAstroImageUpload(args) {
|
|
|
25642
26451
|
const def = definitions[collection];
|
|
25643
26452
|
if (!def)
|
|
25644
26453
|
return null;
|
|
25645
|
-
const fieldDef = def.fields.find((
|
|
26454
|
+
const fieldDef = def.fields.find((f2) => f2.name === field);
|
|
25646
26455
|
if (!fieldDef?.astroImage)
|
|
25647
26456
|
return null;
|
|
25648
26457
|
const entryInfo = def.entries?.find((e) => e.slug === entry);
|
|
@@ -25655,12 +26464,12 @@ async function tryAstroImageUpload(args) {
|
|
|
25655
26464
|
originalFilename: args.originalFilename,
|
|
25656
26465
|
compareBuffer: args.fileBuffer
|
|
25657
26466
|
});
|
|
25658
|
-
await fs6.mkdir(
|
|
26467
|
+
await fs6.mkdir(path10.dirname(target.absPath), { recursive: true });
|
|
25659
26468
|
await fs6.writeFile(target.absPath, args.fileBuffer);
|
|
25660
26469
|
return {
|
|
25661
26470
|
success: true,
|
|
25662
26471
|
url: target.relPath,
|
|
25663
|
-
filename:
|
|
26472
|
+
filename: path10.basename(target.absPath)
|
|
25664
26473
|
};
|
|
25665
26474
|
}
|
|
25666
26475
|
var init_astro_image_upload = __esm(() => {
|
|
@@ -25674,8 +26483,8 @@ async function handleCheckSlugExists(slug) {
|
|
|
25674
26483
|
const normalizedSlug = slugify2(slug);
|
|
25675
26484
|
if (!normalizedSlug)
|
|
25676
26485
|
return { exists: false };
|
|
25677
|
-
const
|
|
25678
|
-
return
|
|
26486
|
+
const found2 = await findPageFile(`/${normalizedSlug}`);
|
|
26487
|
+
return found2 ? { exists: true, filePath: found2 } : { exists: false };
|
|
25679
26488
|
}
|
|
25680
26489
|
async function fileExists(fullPath) {
|
|
25681
26490
|
try {
|
|
@@ -25707,7 +26516,7 @@ var init_page_ops2 = __esm(() => {
|
|
|
25707
26516
|
|
|
25708
26517
|
// ../cms/src/handlers/request-utils.ts
|
|
25709
26518
|
function readBody(req, maxSize = MAX_BODY_SIZE) {
|
|
25710
|
-
return new Promise((
|
|
26519
|
+
return new Promise((resolve2, reject) => {
|
|
25711
26520
|
const chunks = [];
|
|
25712
26521
|
let totalSize = 0;
|
|
25713
26522
|
req.on("data", (chunk) => {
|
|
@@ -25719,7 +26528,7 @@ function readBody(req, maxSize = MAX_BODY_SIZE) {
|
|
|
25719
26528
|
}
|
|
25720
26529
|
chunks.push(chunk);
|
|
25721
26530
|
});
|
|
25722
|
-
req.on("end", () =>
|
|
26531
|
+
req.on("end", () => resolve2(Buffer.concat(chunks)));
|
|
25723
26532
|
req.on("error", reject);
|
|
25724
26533
|
});
|
|
25725
26534
|
}
|
|
@@ -25907,8 +26716,8 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25907
26716
|
var parseError = function(message) {
|
|
25908
26717
|
throw Error("Parse error: " + message);
|
|
25909
26718
|
};
|
|
25910
|
-
var
|
|
25911
|
-
options = merge(options,
|
|
26719
|
+
var encode2 = function(string, options) {
|
|
26720
|
+
options = merge(options, encode2.options);
|
|
25912
26721
|
var strict = options.strict;
|
|
25913
26722
|
if (strict && regexInvalidRawCodePoint.test(string)) {
|
|
25914
26723
|
parseError("forbidden code point");
|
|
@@ -25955,15 +26764,15 @@ var require_he = __commonJS((exports, module) => {
|
|
|
25955
26764
|
return escapeCodePoint(codePoint);
|
|
25956
26765
|
}).replace(regexBmpWhitelist, escapeBmpSymbol);
|
|
25957
26766
|
};
|
|
25958
|
-
|
|
26767
|
+
encode2.options = {
|
|
25959
26768
|
allowUnsafeSymbols: false,
|
|
25960
26769
|
encodeEverything: false,
|
|
25961
26770
|
strict: false,
|
|
25962
26771
|
useNamedReferences: false,
|
|
25963
26772
|
decimal: false
|
|
25964
26773
|
};
|
|
25965
|
-
var
|
|
25966
|
-
options = merge(options,
|
|
26774
|
+
var decode2 = function(html, options) {
|
|
26775
|
+
options = merge(options, decode2.options);
|
|
25967
26776
|
var strict = options.strict;
|
|
25968
26777
|
if (strict && regexInvalidEntity.test(html)) {
|
|
25969
26778
|
parseError("malformed character reference");
|
|
@@ -26018,7 +26827,7 @@ var require_he = __commonJS((exports, module) => {
|
|
|
26018
26827
|
return $0;
|
|
26019
26828
|
});
|
|
26020
26829
|
};
|
|
26021
|
-
|
|
26830
|
+
decode2.options = {
|
|
26022
26831
|
isAttributeValue: false,
|
|
26023
26832
|
strict: false
|
|
26024
26833
|
};
|
|
@@ -26029,10 +26838,10 @@ var require_he = __commonJS((exports, module) => {
|
|
|
26029
26838
|
};
|
|
26030
26839
|
var he = {
|
|
26031
26840
|
version: "1.2.0",
|
|
26032
|
-
encode,
|
|
26033
|
-
decode,
|
|
26841
|
+
encode: encode2,
|
|
26842
|
+
decode: decode2,
|
|
26034
26843
|
escape,
|
|
26035
|
-
unescape:
|
|
26844
|
+
unescape: decode2
|
|
26036
26845
|
};
|
|
26037
26846
|
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
|
|
26038
26847
|
define(function() {
|
|
@@ -26166,30 +26975,30 @@ var require_lib2 = __commonJS((exports) => {
|
|
|
26166
26975
|
// ../../node_modules/domhandler/lib/node.js
|
|
26167
26976
|
var require_node2 = __commonJS((exports) => {
|
|
26168
26977
|
var __extends = exports && exports.__extends || function() {
|
|
26169
|
-
var extendStatics = function(
|
|
26170
|
-
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
26171
|
-
|
|
26172
|
-
} || function(
|
|
26173
|
-
for (var p in
|
|
26174
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
26175
|
-
|
|
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];
|
|
26176
26985
|
};
|
|
26177
|
-
return extendStatics(
|
|
26986
|
+
return extendStatics(d3, b2);
|
|
26178
26987
|
};
|
|
26179
|
-
return function(
|
|
26180
|
-
if (typeof
|
|
26181
|
-
throw new TypeError("Class extends value " + String(
|
|
26182
|
-
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);
|
|
26183
26992
|
function __() {
|
|
26184
|
-
this.constructor =
|
|
26993
|
+
this.constructor = d3;
|
|
26185
26994
|
}
|
|
26186
|
-
|
|
26995
|
+
d3.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __);
|
|
26187
26996
|
};
|
|
26188
26997
|
}();
|
|
26189
26998
|
var __assign = exports && exports.__assign || function() {
|
|
26190
26999
|
__assign = Object.assign || function(t) {
|
|
26191
|
-
for (var s,
|
|
26192
|
-
s = arguments[
|
|
27000
|
+
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
27001
|
+
s = arguments[i2];
|
|
26193
27002
|
for (var p in s)
|
|
26194
27003
|
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
26195
27004
|
t[p] = s[p];
|
|
@@ -26533,9 +27342,9 @@ var require_node2 = __commonJS((exports) => {
|
|
|
26533
27342
|
var children = childs.map(function(child) {
|
|
26534
27343
|
return cloneNode(child, true);
|
|
26535
27344
|
});
|
|
26536
|
-
for (var
|
|
26537
|
-
children[
|
|
26538
|
-
children[
|
|
27345
|
+
for (var i2 = 1;i2 < children.length; i2++) {
|
|
27346
|
+
children[i2].prev = children[i2 - 1];
|
|
27347
|
+
children[i2 - 1].next = children[i2];
|
|
26539
27348
|
}
|
|
26540
27349
|
return children;
|
|
26541
27350
|
}
|
|
@@ -26543,25 +27352,25 @@ var require_node2 = __commonJS((exports) => {
|
|
|
26543
27352
|
|
|
26544
27353
|
// ../../node_modules/domhandler/lib/index.js
|
|
26545
27354
|
var require_lib3 = __commonJS((exports) => {
|
|
26546
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
27355
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
26547
27356
|
if (k2 === undefined)
|
|
26548
27357
|
k2 = k;
|
|
26549
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
26550
|
-
if (!desc || ("get" in desc ? !
|
|
27358
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
27359
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
26551
27360
|
desc = { enumerable: true, get: function() {
|
|
26552
|
-
return
|
|
27361
|
+
return m2[k];
|
|
26553
27362
|
} };
|
|
26554
27363
|
}
|
|
26555
27364
|
Object.defineProperty(o, k2, desc);
|
|
26556
|
-
} : function(o,
|
|
27365
|
+
} : function(o, m2, k, k2) {
|
|
26557
27366
|
if (k2 === undefined)
|
|
26558
27367
|
k2 = k;
|
|
26559
|
-
o[k2] =
|
|
27368
|
+
o[k2] = m2[k];
|
|
26560
27369
|
});
|
|
26561
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
26562
|
-
for (var p in
|
|
27370
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
27371
|
+
for (var p in m2)
|
|
26563
27372
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
26564
|
-
__createBinding(exports2,
|
|
27373
|
+
__createBinding(exports2, m2, p);
|
|
26565
27374
|
};
|
|
26566
27375
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26567
27376
|
exports.DomHandler = undefined;
|
|
@@ -26775,25 +27584,25 @@ var require_decode_codepoint = __commonJS((exports) => {
|
|
|
26775
27584
|
|
|
26776
27585
|
// ../../node_modules/dom-serializer/node_modules/entities/lib/decode.js
|
|
26777
27586
|
var require_decode = __commonJS((exports) => {
|
|
26778
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
27587
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
26779
27588
|
if (k2 === undefined)
|
|
26780
27589
|
k2 = k;
|
|
26781
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
26782
|
-
if (!desc || ("get" in desc ? !
|
|
27590
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
27591
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
26783
27592
|
desc = { enumerable: true, get: function() {
|
|
26784
|
-
return
|
|
27593
|
+
return m2[k];
|
|
26785
27594
|
} };
|
|
26786
27595
|
}
|
|
26787
27596
|
Object.defineProperty(o, k2, desc);
|
|
26788
|
-
} : function(o,
|
|
27597
|
+
} : function(o, m2, k, k2) {
|
|
26789
27598
|
if (k2 === undefined)
|
|
26790
27599
|
k2 = k;
|
|
26791
|
-
o[k2] =
|
|
27600
|
+
o[k2] = m2[k];
|
|
26792
27601
|
});
|
|
26793
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
26794
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
26795
|
-
} : function(o,
|
|
26796
|
-
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;
|
|
26797
27606
|
});
|
|
26798
27607
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
26799
27608
|
if (mod && mod.__esModule)
|
|
@@ -27127,8 +27936,8 @@ var require_decode = __commonJS((exports) => {
|
|
|
27127
27936
|
var require_encode_html = __commonJS((exports) => {
|
|
27128
27937
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27129
27938
|
function restoreDiff(arr) {
|
|
27130
|
-
for (var
|
|
27131
|
-
arr[
|
|
27939
|
+
for (var i2 = 1;i2 < arr.length; i2++) {
|
|
27940
|
+
arr[i2][0] += arr[i2 - 1][0] + 1;
|
|
27132
27941
|
}
|
|
27133
27942
|
return arr;
|
|
27134
27943
|
}
|
|
@@ -27157,14 +27966,14 @@ var require_escape = __commonJS((exports) => {
|
|
|
27157
27966
|
var lastIdx = 0;
|
|
27158
27967
|
var match;
|
|
27159
27968
|
while ((match = exports.xmlReplacer.exec(str)) !== null) {
|
|
27160
|
-
var
|
|
27161
|
-
var char = str.charCodeAt(
|
|
27969
|
+
var i2 = match.index;
|
|
27970
|
+
var char = str.charCodeAt(i2);
|
|
27162
27971
|
var next = xmlCodeMap.get(char);
|
|
27163
27972
|
if (next !== undefined) {
|
|
27164
|
-
ret += str.substring(lastIdx,
|
|
27165
|
-
lastIdx =
|
|
27973
|
+
ret += str.substring(lastIdx, i2) + next;
|
|
27974
|
+
lastIdx = i2 + 1;
|
|
27166
27975
|
} else {
|
|
27167
|
-
ret += "".concat(str.substring(lastIdx,
|
|
27976
|
+
ret += "".concat(str.substring(lastIdx, i2), "&#x").concat((0, exports.getCodePoint)(str, i2).toString(16), ";");
|
|
27168
27977
|
lastIdx = exports.xmlReplacer.lastIndex += Number((char & 64512) === 55296);
|
|
27169
27978
|
}
|
|
27170
27979
|
}
|
|
@@ -27224,13 +28033,13 @@ var require_encode = __commonJS((exports) => {
|
|
|
27224
28033
|
var lastIdx = 0;
|
|
27225
28034
|
var match;
|
|
27226
28035
|
while ((match = regExp.exec(str)) !== null) {
|
|
27227
|
-
var
|
|
27228
|
-
ret += str.substring(lastIdx,
|
|
27229
|
-
var char = str.charCodeAt(
|
|
28036
|
+
var i2 = match.index;
|
|
28037
|
+
ret += str.substring(lastIdx, i2);
|
|
28038
|
+
var char = str.charCodeAt(i2);
|
|
27230
28039
|
var next = encode_html_js_1.default.get(char);
|
|
27231
28040
|
if (typeof next === "object") {
|
|
27232
|
-
if (
|
|
27233
|
-
var nextChar = str.charCodeAt(
|
|
28041
|
+
if (i2 + 1 < str.length) {
|
|
28042
|
+
var nextChar = str.charCodeAt(i2 + 1);
|
|
27234
28043
|
var value = typeof next.n === "number" ? next.n === nextChar ? next.o : undefined : next.n.get(nextChar);
|
|
27235
28044
|
if (value !== undefined) {
|
|
27236
28045
|
ret += value;
|
|
@@ -27242,9 +28051,9 @@ var require_encode = __commonJS((exports) => {
|
|
|
27242
28051
|
}
|
|
27243
28052
|
if (next !== undefined) {
|
|
27244
28053
|
ret += next;
|
|
27245
|
-
lastIdx =
|
|
28054
|
+
lastIdx = i2 + 1;
|
|
27246
28055
|
} else {
|
|
27247
|
-
var cp = (0, escape_js_1.getCodePoint)(str,
|
|
28056
|
+
var cp = (0, escape_js_1.getCodePoint)(str, i2);
|
|
27248
28057
|
ret += "&#x".concat(cp.toString(16), ";");
|
|
27249
28058
|
lastIdx = regExp.lastIndex += Number(cp !== char);
|
|
27250
28059
|
}
|
|
@@ -27273,7 +28082,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27273
28082
|
EncodingMode2[EncodingMode2["Attribute"] = 3] = "Attribute";
|
|
27274
28083
|
EncodingMode2[EncodingMode2["Text"] = 4] = "Text";
|
|
27275
28084
|
})(EncodingMode = exports.EncodingMode || (exports.EncodingMode = {}));
|
|
27276
|
-
function
|
|
28085
|
+
function decode2(data, options) {
|
|
27277
28086
|
if (options === undefined) {
|
|
27278
28087
|
options = EntityLevel.XML;
|
|
27279
28088
|
}
|
|
@@ -27284,7 +28093,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27284
28093
|
}
|
|
27285
28094
|
return (0, decode_js_1.decodeXML)(data);
|
|
27286
28095
|
}
|
|
27287
|
-
exports.decode =
|
|
28096
|
+
exports.decode = decode2;
|
|
27288
28097
|
function decodeStrict(data, options) {
|
|
27289
28098
|
var _a;
|
|
27290
28099
|
if (options === undefined) {
|
|
@@ -27292,10 +28101,10 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27292
28101
|
}
|
|
27293
28102
|
var opts = typeof options === "number" ? { level: options } : options;
|
|
27294
28103
|
(_a = opts.mode) !== null && _a !== undefined || (opts.mode = decode_js_1.DecodingMode.Strict);
|
|
27295
|
-
return
|
|
28104
|
+
return decode2(data, opts);
|
|
27296
28105
|
}
|
|
27297
28106
|
exports.decodeStrict = decodeStrict;
|
|
27298
|
-
function
|
|
28107
|
+
function encode2(data, options) {
|
|
27299
28108
|
if (options === undefined) {
|
|
27300
28109
|
options = EntityLevel.XML;
|
|
27301
28110
|
}
|
|
@@ -27314,7 +28123,7 @@ var require_lib4 = __commonJS((exports) => {
|
|
|
27314
28123
|
}
|
|
27315
28124
|
return (0, escape_js_1.encodeXML)(data);
|
|
27316
28125
|
}
|
|
27317
|
-
exports.encode =
|
|
28126
|
+
exports.encode = encode2;
|
|
27318
28127
|
var escape_js_2 = require_escape();
|
|
27319
28128
|
Object.defineProperty(exports, "encodeXML", { enumerable: true, get: function() {
|
|
27320
28129
|
return escape_js_2.encodeXML;
|
|
@@ -27494,8 +28303,8 @@ var require_foreignNames = __commonJS((exports) => {
|
|
|
27494
28303
|
var require_lib5 = __commonJS((exports) => {
|
|
27495
28304
|
var __assign = exports && exports.__assign || function() {
|
|
27496
28305
|
__assign = Object.assign || function(t) {
|
|
27497
|
-
for (var s,
|
|
27498
|
-
s = arguments[
|
|
28306
|
+
for (var s, i2 = 1, n2 = arguments.length;i2 < n2; i2++) {
|
|
28307
|
+
s = arguments[i2];
|
|
27499
28308
|
for (var p in s)
|
|
27500
28309
|
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
27501
28310
|
t[p] = s[p];
|
|
@@ -27504,25 +28313,25 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27504
28313
|
};
|
|
27505
28314
|
return __assign.apply(this, arguments);
|
|
27506
28315
|
};
|
|
27507
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
28316
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
27508
28317
|
if (k2 === undefined)
|
|
27509
28318
|
k2 = k;
|
|
27510
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
27511
|
-
if (!desc || ("get" in desc ? !
|
|
28319
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
28320
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
27512
28321
|
desc = { enumerable: true, get: function() {
|
|
27513
|
-
return
|
|
28322
|
+
return m2[k];
|
|
27514
28323
|
} };
|
|
27515
28324
|
}
|
|
27516
28325
|
Object.defineProperty(o, k2, desc);
|
|
27517
|
-
} : function(o,
|
|
28326
|
+
} : function(o, m2, k, k2) {
|
|
27518
28327
|
if (k2 === undefined)
|
|
27519
28328
|
k2 = k;
|
|
27520
|
-
o[k2] =
|
|
28329
|
+
o[k2] = m2[k];
|
|
27521
28330
|
});
|
|
27522
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
27523
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
27524
|
-
} : function(o,
|
|
27525
|
-
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;
|
|
27526
28335
|
});
|
|
27527
28336
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
27528
28337
|
if (mod && mod.__esModule)
|
|
@@ -27558,7 +28367,7 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27558
28367
|
var _a;
|
|
27559
28368
|
if (!attributes)
|
|
27560
28369
|
return;
|
|
27561
|
-
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;
|
|
27562
28371
|
return Object.keys(attributes).map(function(key) {
|
|
27563
28372
|
var _a2, _b;
|
|
27564
28373
|
var value = (_a2 = attributes[key]) !== null && _a2 !== undefined ? _a2 : "";
|
|
@@ -27568,7 +28377,7 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27568
28377
|
if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
|
|
27569
28378
|
return key;
|
|
27570
28379
|
}
|
|
27571
|
-
return "".concat(key, '="').concat(
|
|
28380
|
+
return "".concat(key, '="').concat(encode2(value), '"');
|
|
27572
28381
|
}).join(" ");
|
|
27573
28382
|
}
|
|
27574
28383
|
var singleTag = new Set([
|
|
@@ -27598,8 +28407,8 @@ var require_lib5 = __commonJS((exports) => {
|
|
|
27598
28407
|
}
|
|
27599
28408
|
var nodes = "length" in node ? node : [node];
|
|
27600
28409
|
var output = "";
|
|
27601
|
-
for (var
|
|
27602
|
-
output += renderNode(nodes[
|
|
28410
|
+
for (var i2 = 0;i2 < nodes.length; i2++) {
|
|
28411
|
+
output += renderNode(nodes[i2], options);
|
|
27603
28412
|
}
|
|
27604
28413
|
return output;
|
|
27605
28414
|
}
|
|
@@ -27955,15 +28764,15 @@ var require_querying = __commonJS((exports) => {
|
|
|
27955
28764
|
recurse = true;
|
|
27956
28765
|
}
|
|
27957
28766
|
var searchedNodes = Array.isArray(nodes) ? nodes : [nodes];
|
|
27958
|
-
for (var
|
|
27959
|
-
var node = searchedNodes[
|
|
28767
|
+
for (var i2 = 0;i2 < searchedNodes.length; i2++) {
|
|
28768
|
+
var node = searchedNodes[i2];
|
|
27960
28769
|
if ((0, domhandler_1.isTag)(node) && test(node)) {
|
|
27961
28770
|
return node;
|
|
27962
28771
|
}
|
|
27963
28772
|
if (recurse && (0, domhandler_1.hasChildren)(node) && node.children.length > 0) {
|
|
27964
|
-
var
|
|
27965
|
-
if (
|
|
27966
|
-
return
|
|
28773
|
+
var found2 = findOne(test, node.children, true);
|
|
28774
|
+
if (found2)
|
|
28775
|
+
return found2;
|
|
27967
28776
|
}
|
|
27968
28777
|
}
|
|
27969
28778
|
return null;
|
|
@@ -28052,9 +28861,9 @@ var require_legacy = __commonJS((exports) => {
|
|
|
28052
28861
|
return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value;
|
|
28053
28862
|
};
|
|
28054
28863
|
}
|
|
28055
|
-
function combineFuncs(a,
|
|
28864
|
+
function combineFuncs(a, b2) {
|
|
28056
28865
|
return function(elem) {
|
|
28057
|
-
return a(elem) ||
|
|
28866
|
+
return a(elem) || b2(elem);
|
|
28058
28867
|
};
|
|
28059
28868
|
}
|
|
28060
28869
|
function compileTest(options) {
|
|
@@ -28185,11 +28994,11 @@ var require_helpers = __commonJS((exports) => {
|
|
|
28185
28994
|
return DocumentPosition.PRECEDING;
|
|
28186
28995
|
}
|
|
28187
28996
|
function uniqueSort(nodes) {
|
|
28188
|
-
nodes = nodes.filter(function(node,
|
|
28189
|
-
return !arr.includes(node,
|
|
28997
|
+
nodes = nodes.filter(function(node, i2, arr) {
|
|
28998
|
+
return !arr.includes(node, i2 + 1);
|
|
28190
28999
|
});
|
|
28191
|
-
nodes.sort(function(a,
|
|
28192
|
-
var relative = compareDocumentPosition(a,
|
|
29000
|
+
nodes.sort(function(a, b2) {
|
|
29001
|
+
var relative = compareDocumentPosition(a, b2);
|
|
28193
29002
|
if (relative & DocumentPosition.PRECEDING) {
|
|
28194
29003
|
return -1;
|
|
28195
29004
|
} else if (relative & DocumentPosition.FOLLOWING) {
|
|
@@ -28340,25 +29149,25 @@ var require_feeds = __commonJS((exports) => {
|
|
|
28340
29149
|
|
|
28341
29150
|
// ../../node_modules/domutils/lib/index.js
|
|
28342
29151
|
var require_lib6 = __commonJS((exports) => {
|
|
28343
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
29152
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
28344
29153
|
if (k2 === undefined)
|
|
28345
29154
|
k2 = k;
|
|
28346
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
28347
|
-
if (!desc || ("get" in desc ? !
|
|
29155
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
29156
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
28348
29157
|
desc = { enumerable: true, get: function() {
|
|
28349
|
-
return
|
|
29158
|
+
return m2[k];
|
|
28350
29159
|
} };
|
|
28351
29160
|
}
|
|
28352
29161
|
Object.defineProperty(o, k2, desc);
|
|
28353
|
-
} : function(o,
|
|
29162
|
+
} : function(o, m2, k, k2) {
|
|
28354
29163
|
if (k2 === undefined)
|
|
28355
29164
|
k2 = k;
|
|
28356
|
-
o[k2] =
|
|
29165
|
+
o[k2] = m2[k];
|
|
28357
29166
|
});
|
|
28358
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
28359
|
-
for (var p in
|
|
29167
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
29168
|
+
for (var p in m2)
|
|
28360
29169
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
28361
|
-
__createBinding(exports2,
|
|
29170
|
+
__createBinding(exports2, m2, p);
|
|
28362
29171
|
};
|
|
28363
29172
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28364
29173
|
exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = undefined;
|
|
@@ -28478,7 +29287,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28478
29287
|
}
|
|
28479
29288
|
exports.isTraversal = isTraversal;
|
|
28480
29289
|
var stripQuotesFromPseudos = new Set(["contains", "icontains"]);
|
|
28481
|
-
function funescape(
|
|
29290
|
+
function funescape(_2, escaped, escapedWhitespace) {
|
|
28482
29291
|
var high = parseInt(escaped, 16) - 65536;
|
|
28483
29292
|
return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
|
|
28484
29293
|
}
|
|
@@ -28491,7 +29300,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28491
29300
|
function isWhitespace(c) {
|
|
28492
29301
|
return c === 32 || c === 9 || c === 10 || c === 12 || c === 13;
|
|
28493
29302
|
}
|
|
28494
|
-
function
|
|
29303
|
+
function parse3(selector) {
|
|
28495
29304
|
var subselects = [];
|
|
28496
29305
|
var endIndex = parseSelector(subselects, "".concat(selector), 0);
|
|
28497
29306
|
if (endIndex < selector.length) {
|
|
@@ -28499,7 +29308,7 @@ var require_parse = __commonJS((exports) => {
|
|
|
28499
29308
|
}
|
|
28500
29309
|
return subselects;
|
|
28501
29310
|
}
|
|
28502
|
-
exports.parse =
|
|
29311
|
+
exports.parse = parse3;
|
|
28503
29312
|
function parseSelector(subselects, selector, selectorIndex) {
|
|
28504
29313
|
var tokens = [];
|
|
28505
29314
|
function getName(offset) {
|
|
@@ -28787,11 +29596,11 @@ var require_parse = __commonJS((exports) => {
|
|
|
28787
29596
|
var require_stringify3 = __commonJS((exports) => {
|
|
28788
29597
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
28789
29598
|
if (pack || arguments.length === 2)
|
|
28790
|
-
for (var
|
|
28791
|
-
if (ar || !(
|
|
29599
|
+
for (var i2 = 0, l = from.length, ar;i2 < l; i2++) {
|
|
29600
|
+
if (ar || !(i2 in from)) {
|
|
28792
29601
|
if (!ar)
|
|
28793
|
-
ar = Array.prototype.slice.call(from, 0,
|
|
28794
|
-
ar[
|
|
29602
|
+
ar = Array.prototype.slice.call(from, 0, i2);
|
|
29603
|
+
ar[i2] = from[i2];
|
|
28795
29604
|
}
|
|
28796
29605
|
}
|
|
28797
29606
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
@@ -28895,10 +29704,10 @@ var require_stringify3 = __commonJS((exports) => {
|
|
|
28895
29704
|
function escapeName(str, charsToEscape) {
|
|
28896
29705
|
var lastIdx = 0;
|
|
28897
29706
|
var ret = "";
|
|
28898
|
-
for (var
|
|
28899
|
-
if (charsToEscape.has(str.charCodeAt(
|
|
28900
|
-
ret += "".concat(str.slice(lastIdx,
|
|
28901
|
-
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;
|
|
28902
29711
|
}
|
|
28903
29712
|
}
|
|
28904
29713
|
return ret.length > 0 ? ret + str.slice(lastIdx) : str;
|
|
@@ -28907,25 +29716,25 @@ var require_stringify3 = __commonJS((exports) => {
|
|
|
28907
29716
|
|
|
28908
29717
|
// ../../node_modules/css-what/lib/commonjs/index.js
|
|
28909
29718
|
var require_commonjs = __commonJS((exports) => {
|
|
28910
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
29719
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
28911
29720
|
if (k2 === undefined)
|
|
28912
29721
|
k2 = k;
|
|
28913
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
28914
|
-
if (!desc || ("get" in desc ? !
|
|
29722
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
29723
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
28915
29724
|
desc = { enumerable: true, get: function() {
|
|
28916
|
-
return
|
|
29725
|
+
return m2[k];
|
|
28917
29726
|
} };
|
|
28918
29727
|
}
|
|
28919
29728
|
Object.defineProperty(o, k2, desc);
|
|
28920
|
-
} : function(o,
|
|
29729
|
+
} : function(o, m2, k, k2) {
|
|
28921
29730
|
if (k2 === undefined)
|
|
28922
29731
|
k2 = k;
|
|
28923
|
-
o[k2] =
|
|
29732
|
+
o[k2] = m2[k];
|
|
28924
29733
|
});
|
|
28925
|
-
var __exportStar = exports && exports.__exportStar || function(
|
|
28926
|
-
for (var p in
|
|
29734
|
+
var __exportStar = exports && exports.__exportStar || function(m2, exports2) {
|
|
29735
|
+
for (var p in m2)
|
|
28927
29736
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
|
|
28928
|
-
__createBinding(exports2,
|
|
29737
|
+
__createBinding(exports2, m2, p);
|
|
28929
29738
|
};
|
|
28930
29739
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28931
29740
|
exports.stringify = exports.parse = exports.isTraversal = undefined;
|
|
@@ -28968,11 +29777,11 @@ var require_sort = __commonJS((exports) => {
|
|
|
28968
29777
|
]);
|
|
28969
29778
|
function sortByProcedure(arr) {
|
|
28970
29779
|
var procs = arr.map(getProcedure);
|
|
28971
|
-
for (var
|
|
28972
|
-
var procNew = procs[
|
|
29780
|
+
for (var i2 = 1;i2 < arr.length; i2++) {
|
|
29781
|
+
var procNew = procs[i2];
|
|
28973
29782
|
if (procNew < 0)
|
|
28974
29783
|
continue;
|
|
28975
|
-
for (var j =
|
|
29784
|
+
for (var j = i2 - 1;j >= 0 && procNew < procs[j]; j--) {
|
|
28976
29785
|
var token = arr[j + 1];
|
|
28977
29786
|
arr[j + 1] = arr[j];
|
|
28978
29787
|
arr[j] = token;
|
|
@@ -28999,8 +29808,8 @@ var require_sort = __commonJS((exports) => {
|
|
|
28999
29808
|
} else if (token.name === "has" || token.name === "contains") {
|
|
29000
29809
|
proc = 0;
|
|
29001
29810
|
} else if (Array.isArray(token.data)) {
|
|
29002
|
-
proc = Math.min.apply(Math, token.data.map(function(
|
|
29003
|
-
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));
|
|
29004
29813
|
}));
|
|
29005
29814
|
if (proc < 0) {
|
|
29006
29815
|
proc = 0;
|
|
@@ -29215,7 +30024,7 @@ var require_parse2 = __commonJS((exports) => {
|
|
|
29215
30024
|
var whitespace = new Set([9, 10, 12, 13, 32]);
|
|
29216
30025
|
var ZERO = 48;
|
|
29217
30026
|
var NINE = 57;
|
|
29218
|
-
function
|
|
30027
|
+
function parse3(formula) {
|
|
29219
30028
|
formula = formula.trim().toLowerCase();
|
|
29220
30029
|
if (formula === "even") {
|
|
29221
30030
|
return [2, 0];
|
|
@@ -29267,7 +30076,7 @@ var require_parse2 = __commonJS((exports) => {
|
|
|
29267
30076
|
}
|
|
29268
30077
|
}
|
|
29269
30078
|
}
|
|
29270
|
-
exports.parse =
|
|
30079
|
+
exports.parse = parse3;
|
|
29271
30080
|
});
|
|
29272
30081
|
|
|
29273
30082
|
// ../../node_modules/nth-check/lib/compile.js
|
|
@@ -29280,53 +30089,53 @@ var require_compile = __commonJS((exports) => {
|
|
|
29280
30089
|
var boolbase_1 = __importDefault(require_boolbase());
|
|
29281
30090
|
function compile(parsed) {
|
|
29282
30091
|
var a = parsed[0];
|
|
29283
|
-
var
|
|
29284
|
-
if (
|
|
30092
|
+
var b2 = parsed[1] - 1;
|
|
30093
|
+
if (b2 < 0 && a <= 0)
|
|
29285
30094
|
return boolbase_1.default.falseFunc;
|
|
29286
30095
|
if (a === -1)
|
|
29287
30096
|
return function(index) {
|
|
29288
|
-
return index <=
|
|
30097
|
+
return index <= b2;
|
|
29289
30098
|
};
|
|
29290
30099
|
if (a === 0)
|
|
29291
30100
|
return function(index) {
|
|
29292
|
-
return index ===
|
|
30101
|
+
return index === b2;
|
|
29293
30102
|
};
|
|
29294
30103
|
if (a === 1)
|
|
29295
|
-
return
|
|
29296
|
-
return index >=
|
|
30104
|
+
return b2 < 0 ? boolbase_1.default.trueFunc : function(index) {
|
|
30105
|
+
return index >= b2;
|
|
29297
30106
|
};
|
|
29298
30107
|
var absA = Math.abs(a);
|
|
29299
|
-
var bMod = (
|
|
30108
|
+
var bMod = (b2 % absA + absA) % absA;
|
|
29300
30109
|
return a > 1 ? function(index) {
|
|
29301
|
-
return index >=
|
|
30110
|
+
return index >= b2 && index % absA === bMod;
|
|
29302
30111
|
} : function(index) {
|
|
29303
|
-
return index <=
|
|
30112
|
+
return index <= b2 && index % absA === bMod;
|
|
29304
30113
|
};
|
|
29305
30114
|
}
|
|
29306
30115
|
exports.compile = compile;
|
|
29307
30116
|
function generate(parsed) {
|
|
29308
30117
|
var a = parsed[0];
|
|
29309
|
-
var
|
|
29310
|
-
var
|
|
30118
|
+
var b2 = parsed[1] - 1;
|
|
30119
|
+
var n2 = 0;
|
|
29311
30120
|
if (a < 0) {
|
|
29312
30121
|
var aPos_1 = -a;
|
|
29313
|
-
var minValue_1 = (
|
|
30122
|
+
var minValue_1 = (b2 % aPos_1 + aPos_1) % aPos_1;
|
|
29314
30123
|
return function() {
|
|
29315
|
-
var val = minValue_1 + aPos_1 *
|
|
29316
|
-
return val >
|
|
30124
|
+
var val = minValue_1 + aPos_1 * n2++;
|
|
30125
|
+
return val > b2 ? null : val;
|
|
29317
30126
|
};
|
|
29318
30127
|
}
|
|
29319
30128
|
if (a === 0)
|
|
29320
|
-
return
|
|
30129
|
+
return b2 < 0 ? function() {
|
|
29321
30130
|
return null;
|
|
29322
30131
|
} : function() {
|
|
29323
|
-
return
|
|
30132
|
+
return n2++ === 0 ? b2 : null;
|
|
29324
30133
|
};
|
|
29325
|
-
if (
|
|
29326
|
-
|
|
30134
|
+
if (b2 < 0) {
|
|
30135
|
+
b2 += a * Math.ceil(-b2 / a);
|
|
29327
30136
|
}
|
|
29328
30137
|
return function() {
|
|
29329
|
-
return a *
|
|
30138
|
+
return a * n2++ + b2;
|
|
29330
30139
|
};
|
|
29331
30140
|
}
|
|
29332
30141
|
exports.generate = generate;
|
|
@@ -29396,10 +30205,10 @@ var require_filters = __commonJS((exports) => {
|
|
|
29396
30205
|
return function nthChild(elem) {
|
|
29397
30206
|
var siblings = adapter.getSiblings(elem);
|
|
29398
30207
|
var pos = 0;
|
|
29399
|
-
for (var
|
|
29400
|
-
if (equals(elem, siblings[
|
|
30208
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30209
|
+
if (equals(elem, siblings[i2]))
|
|
29401
30210
|
break;
|
|
29402
|
-
if (adapter.isTag(siblings[
|
|
30211
|
+
if (adapter.isTag(siblings[i2])) {
|
|
29403
30212
|
pos++;
|
|
29404
30213
|
}
|
|
29405
30214
|
}
|
|
@@ -29416,10 +30225,10 @@ var require_filters = __commonJS((exports) => {
|
|
|
29416
30225
|
return function nthLastChild(elem) {
|
|
29417
30226
|
var siblings = adapter.getSiblings(elem);
|
|
29418
30227
|
var pos = 0;
|
|
29419
|
-
for (var
|
|
29420
|
-
if (equals(elem, siblings[
|
|
30228
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30229
|
+
if (equals(elem, siblings[i2]))
|
|
29421
30230
|
break;
|
|
29422
|
-
if (adapter.isTag(siblings[
|
|
30231
|
+
if (adapter.isTag(siblings[i2])) {
|
|
29423
30232
|
pos++;
|
|
29424
30233
|
}
|
|
29425
30234
|
}
|
|
@@ -29436,8 +30245,8 @@ var require_filters = __commonJS((exports) => {
|
|
|
29436
30245
|
return function nthOfType(elem) {
|
|
29437
30246
|
var siblings = adapter.getSiblings(elem);
|
|
29438
30247
|
var pos = 0;
|
|
29439
|
-
for (var
|
|
29440
|
-
var currentSibling = siblings[
|
|
30248
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30249
|
+
var currentSibling = siblings[i2];
|
|
29441
30250
|
if (equals(elem, currentSibling))
|
|
29442
30251
|
break;
|
|
29443
30252
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === adapter.getName(elem)) {
|
|
@@ -29457,8 +30266,8 @@ var require_filters = __commonJS((exports) => {
|
|
|
29457
30266
|
return function nthLastOfType(elem) {
|
|
29458
30267
|
var siblings = adapter.getSiblings(elem);
|
|
29459
30268
|
var pos = 0;
|
|
29460
|
-
for (var
|
|
29461
|
-
var currentSibling = siblings[
|
|
30269
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30270
|
+
var currentSibling = siblings[i2];
|
|
29462
30271
|
if (equals(elem, currentSibling))
|
|
29463
30272
|
break;
|
|
29464
30273
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === adapter.getName(elem)) {
|
|
@@ -29531,10 +30340,10 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29531
30340
|
"last-child": function(elem, _a) {
|
|
29532
30341
|
var { adapter, equals } = _a;
|
|
29533
30342
|
var siblings = adapter.getSiblings(elem);
|
|
29534
|
-
for (var
|
|
29535
|
-
if (equals(elem, siblings[
|
|
30343
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30344
|
+
if (equals(elem, siblings[i2]))
|
|
29536
30345
|
return true;
|
|
29537
|
-
if (adapter.isTag(siblings[
|
|
30346
|
+
if (adapter.isTag(siblings[i2]))
|
|
29538
30347
|
break;
|
|
29539
30348
|
}
|
|
29540
30349
|
return false;
|
|
@@ -29543,8 +30352,8 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29543
30352
|
var { adapter, equals } = _a;
|
|
29544
30353
|
var siblings = adapter.getSiblings(elem);
|
|
29545
30354
|
var elemName = adapter.getName(elem);
|
|
29546
|
-
for (var
|
|
29547
|
-
var currentSibling = siblings[
|
|
30355
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30356
|
+
var currentSibling = siblings[i2];
|
|
29548
30357
|
if (equals(elem, currentSibling))
|
|
29549
30358
|
return true;
|
|
29550
30359
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elemName) {
|
|
@@ -29557,8 +30366,8 @@ var require_pseudos = __commonJS((exports) => {
|
|
|
29557
30366
|
var { adapter, equals } = _a;
|
|
29558
30367
|
var siblings = adapter.getSiblings(elem);
|
|
29559
30368
|
var elemName = adapter.getName(elem);
|
|
29560
|
-
for (var
|
|
29561
|
-
var currentSibling = siblings[
|
|
30369
|
+
for (var i2 = siblings.length - 1;i2 >= 0; i2--) {
|
|
30370
|
+
var currentSibling = siblings[i2];
|
|
29562
30371
|
if (equals(elem, currentSibling))
|
|
29563
30372
|
return true;
|
|
29564
30373
|
if (adapter.isTag(currentSibling) && adapter.getName(currentSibling) === elemName) {
|
|
@@ -29629,11 +30438,11 @@ var require_aliases = __commonJS((exports) => {
|
|
|
29629
30438
|
var require_subselects = __commonJS((exports) => {
|
|
29630
30439
|
var __spreadArray = exports && exports.__spreadArray || function(to, from, pack) {
|
|
29631
30440
|
if (pack || arguments.length === 2)
|
|
29632
|
-
for (var
|
|
29633
|
-
if (ar || !(
|
|
30441
|
+
for (var i2 = 0, l = from.length, ar;i2 < l; i2++) {
|
|
30442
|
+
if (ar || !(i2 in from)) {
|
|
29634
30443
|
if (!ar)
|
|
29635
|
-
ar = Array.prototype.slice.call(from, 0,
|
|
29636
|
-
ar[
|
|
30444
|
+
ar = Array.prototype.slice.call(from, 0, i2);
|
|
30445
|
+
ar[i2] = from[i2];
|
|
29637
30446
|
}
|
|
29638
30447
|
}
|
|
29639
30448
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
@@ -29877,8 +30686,8 @@ var require_general = __commonJS((exports) => {
|
|
|
29877
30686
|
case css_what_1.SelectorType.Sibling: {
|
|
29878
30687
|
return function sibling(elem) {
|
|
29879
30688
|
var siblings = adapter.getSiblings(elem);
|
|
29880
|
-
for (var
|
|
29881
|
-
var currentSibling = siblings[
|
|
30689
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30690
|
+
var currentSibling = siblings[i2];
|
|
29882
30691
|
if (equals(elem, currentSibling))
|
|
29883
30692
|
break;
|
|
29884
30693
|
if (adapter.isTag(currentSibling) && next(currentSibling)) {
|
|
@@ -29898,8 +30707,8 @@ var require_general = __commonJS((exports) => {
|
|
|
29898
30707
|
return function adjacent(elem) {
|
|
29899
30708
|
var siblings = adapter.getSiblings(elem);
|
|
29900
30709
|
var lastElement;
|
|
29901
|
-
for (var
|
|
29902
|
-
var currentSibling = siblings[
|
|
30710
|
+
for (var i2 = 0;i2 < siblings.length; i2++) {
|
|
30711
|
+
var currentSibling = siblings[i2];
|
|
29903
30712
|
if (equals(elem, currentSibling))
|
|
29904
30713
|
break;
|
|
29905
30714
|
if (adapter.isTag(currentSibling)) {
|
|
@@ -29922,25 +30731,25 @@ var require_general = __commonJS((exports) => {
|
|
|
29922
30731
|
|
|
29923
30732
|
// ../../node_modules/css-select/lib/compile.js
|
|
29924
30733
|
var require_compile2 = __commonJS((exports) => {
|
|
29925
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
30734
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
29926
30735
|
if (k2 === undefined)
|
|
29927
30736
|
k2 = k;
|
|
29928
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
29929
|
-
if (!desc || ("get" in desc ? !
|
|
30737
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
30738
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
29930
30739
|
desc = { enumerable: true, get: function() {
|
|
29931
|
-
return
|
|
30740
|
+
return m2[k];
|
|
29932
30741
|
} };
|
|
29933
30742
|
}
|
|
29934
30743
|
Object.defineProperty(o, k2, desc);
|
|
29935
|
-
} : function(o,
|
|
30744
|
+
} : function(o, m2, k, k2) {
|
|
29936
30745
|
if (k2 === undefined)
|
|
29937
30746
|
k2 = k;
|
|
29938
|
-
o[k2] =
|
|
30747
|
+
o[k2] = m2[k];
|
|
29939
30748
|
});
|
|
29940
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
29941
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
29942
|
-
} : function(o,
|
|
29943
|
-
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;
|
|
29944
30753
|
});
|
|
29945
30754
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
29946
30755
|
if (mod && mod.__esModule)
|
|
@@ -30039,40 +30848,40 @@ var require_compile2 = __commonJS((exports) => {
|
|
|
30039
30848
|
return previous === boolbase_1.default.falseFunc ? boolbase_1.default.falseFunc : (0, general_js_1.compileGeneralSelector)(previous, rule, options, context, compileToken);
|
|
30040
30849
|
}, (_a = options.rootFunc) !== null && _a !== undefined ? _a : boolbase_1.default.trueFunc);
|
|
30041
30850
|
}
|
|
30042
|
-
function reduceRules(a,
|
|
30043
|
-
if (
|
|
30851
|
+
function reduceRules(a, b2) {
|
|
30852
|
+
if (b2 === boolbase_1.default.falseFunc || a === boolbase_1.default.trueFunc) {
|
|
30044
30853
|
return a;
|
|
30045
30854
|
}
|
|
30046
|
-
if (a === boolbase_1.default.falseFunc ||
|
|
30047
|
-
return
|
|
30855
|
+
if (a === boolbase_1.default.falseFunc || b2 === boolbase_1.default.trueFunc) {
|
|
30856
|
+
return b2;
|
|
30048
30857
|
}
|
|
30049
30858
|
return function combine(elem) {
|
|
30050
|
-
return a(elem) ||
|
|
30859
|
+
return a(elem) || b2(elem);
|
|
30051
30860
|
};
|
|
30052
30861
|
}
|
|
30053
30862
|
});
|
|
30054
30863
|
|
|
30055
30864
|
// ../../node_modules/css-select/lib/index.js
|
|
30056
30865
|
var require_lib8 = __commonJS((exports) => {
|
|
30057
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o,
|
|
30866
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
30058
30867
|
if (k2 === undefined)
|
|
30059
30868
|
k2 = k;
|
|
30060
|
-
var desc = Object.getOwnPropertyDescriptor(
|
|
30061
|
-
if (!desc || ("get" in desc ? !
|
|
30869
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
30870
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
30062
30871
|
desc = { enumerable: true, get: function() {
|
|
30063
|
-
return
|
|
30872
|
+
return m2[k];
|
|
30064
30873
|
} };
|
|
30065
30874
|
}
|
|
30066
30875
|
Object.defineProperty(o, k2, desc);
|
|
30067
|
-
} : function(o,
|
|
30876
|
+
} : function(o, m2, k, k2) {
|
|
30068
30877
|
if (k2 === undefined)
|
|
30069
30878
|
k2 = k;
|
|
30070
|
-
o[k2] =
|
|
30879
|
+
o[k2] = m2[k];
|
|
30071
30880
|
});
|
|
30072
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o,
|
|
30073
|
-
Object.defineProperty(o, "default", { enumerable: true, value:
|
|
30074
|
-
} : function(o,
|
|
30075
|
-
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;
|
|
30076
30885
|
});
|
|
30077
30886
|
var __importStar = exports && exports.__importStar || function(mod) {
|
|
30078
30887
|
if (mod && mod.__esModule)
|
|
@@ -30095,8 +30904,8 @@ var require_lib8 = __commonJS((exports) => {
|
|
|
30095
30904
|
var boolbase_1 = __importDefault(require_boolbase());
|
|
30096
30905
|
var compile_js_1 = require_compile2();
|
|
30097
30906
|
var subselects_js_1 = require_subselects();
|
|
30098
|
-
var defaultEquals = function(a,
|
|
30099
|
-
return a ===
|
|
30907
|
+
var defaultEquals = function(a, b2) {
|
|
30908
|
+
return a === b2;
|
|
30100
30909
|
};
|
|
30101
30910
|
var defaultOptions = {
|
|
30102
30911
|
adapter: DomUtils,
|
|
@@ -30141,8 +30950,8 @@ var require_lib8 = __commonJS((exports) => {
|
|
|
30141
30950
|
function appendNextSiblings(elem, adapter) {
|
|
30142
30951
|
var elems = Array.isArray(elem) ? elem.slice(0) : [elem];
|
|
30143
30952
|
var elemsLength = elems.length;
|
|
30144
|
-
for (var
|
|
30145
|
-
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);
|
|
30146
30955
|
elems.push.apply(elems, nextSiblings);
|
|
30147
30956
|
}
|
|
30148
30957
|
return elems;
|
|
@@ -30242,8 +31051,8 @@ var require_matcher = __commonJS((exports) => {
|
|
|
30242
31051
|
}
|
|
30243
31052
|
function findOne(test, elems) {
|
|
30244
31053
|
let elem = null;
|
|
30245
|
-
for (let
|
|
30246
|
-
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];
|
|
30247
31056
|
if (test(el)) {
|
|
30248
31057
|
elem = el;
|
|
30249
31058
|
} else {
|
|
@@ -30257,12 +31066,12 @@ var require_matcher = __commonJS((exports) => {
|
|
|
30257
31066
|
}
|
|
30258
31067
|
function findAll(test, nodes) {
|
|
30259
31068
|
let result = [];
|
|
30260
|
-
for (let
|
|
30261
|
-
if (!isTag(nodes[
|
|
31069
|
+
for (let i2 = 0, j = nodes.length;i2 < j; i2++) {
|
|
31070
|
+
if (!isTag(nodes[i2]))
|
|
30262
31071
|
continue;
|
|
30263
|
-
if (test(nodes[
|
|
30264
|
-
result.push(nodes[
|
|
30265
|
-
const childs = getChildren(nodes[
|
|
31072
|
+
if (test(nodes[i2]))
|
|
31073
|
+
result.push(nodes[i2]);
|
|
31074
|
+
const childs = getChildren(nodes[i2]);
|
|
30266
31075
|
if (childs)
|
|
30267
31076
|
result = result.concat(findAll(test, childs));
|
|
30268
31077
|
}
|
|
@@ -30366,23 +31175,23 @@ var require_text = __commonJS((exports) => {
|
|
|
30366
31175
|
}
|
|
30367
31176
|
exports.default = TextNode;
|
|
30368
31177
|
function trimText(text) {
|
|
30369
|
-
let
|
|
31178
|
+
let i2 = 0;
|
|
30370
31179
|
let startPos;
|
|
30371
31180
|
let endPos;
|
|
30372
|
-
while (
|
|
30373
|
-
if (/\S/.test(text[
|
|
31181
|
+
while (i2 >= 0 && i2 < text.length) {
|
|
31182
|
+
if (/\S/.test(text[i2])) {
|
|
30374
31183
|
if (startPos === undefined) {
|
|
30375
|
-
startPos =
|
|
30376
|
-
|
|
31184
|
+
startPos = i2;
|
|
31185
|
+
i2 = text.length;
|
|
30377
31186
|
} else {
|
|
30378
|
-
endPos =
|
|
30379
|
-
|
|
31187
|
+
endPos = i2;
|
|
31188
|
+
i2 = undefined;
|
|
30380
31189
|
}
|
|
30381
31190
|
}
|
|
30382
31191
|
if (startPos === undefined)
|
|
30383
|
-
|
|
31192
|
+
i2++;
|
|
30384
31193
|
else
|
|
30385
|
-
|
|
31194
|
+
i2--;
|
|
30386
31195
|
}
|
|
30387
31196
|
if (startPos === undefined)
|
|
30388
31197
|
startPos = 0;
|
|
@@ -30410,7 +31219,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30410
31219
|
var node_1 = __importDefault(require_node());
|
|
30411
31220
|
var text_1 = __importDefault(require_text());
|
|
30412
31221
|
var type_1 = __importDefault(require_type());
|
|
30413
|
-
function
|
|
31222
|
+
function decode2(val) {
|
|
30414
31223
|
return JSON.parse(JSON.stringify(he_1.default.decode(val)));
|
|
30415
31224
|
}
|
|
30416
31225
|
var Htags = ["h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup"];
|
|
@@ -30560,14 +31369,14 @@ var require_html = __commonJS((exports) => {
|
|
|
30560
31369
|
}, "");
|
|
30561
31370
|
}
|
|
30562
31371
|
get textContent() {
|
|
30563
|
-
return
|
|
31372
|
+
return decode2(this.rawText);
|
|
30564
31373
|
}
|
|
30565
31374
|
set textContent(val) {
|
|
30566
31375
|
const content = [new text_1.default(val, this)];
|
|
30567
31376
|
this.childNodes = content;
|
|
30568
31377
|
}
|
|
30569
31378
|
get text() {
|
|
30570
|
-
return
|
|
31379
|
+
return decode2(this.rawText);
|
|
30571
31380
|
}
|
|
30572
31381
|
get structuredText() {
|
|
30573
31382
|
let currentBlock = [];
|
|
@@ -30618,7 +31427,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30618
31427
|
}).join("");
|
|
30619
31428
|
}
|
|
30620
31429
|
set innerHTML(content) {
|
|
30621
|
-
const r =
|
|
31430
|
+
const r = parse3(content, this._parseOptions);
|
|
30622
31431
|
const nodes = r.childNodes.length ? r.childNodes : [new text_1.default(content, this)];
|
|
30623
31432
|
resetParent(nodes, this);
|
|
30624
31433
|
resetParent(this.childNodes, null);
|
|
@@ -30629,7 +31438,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30629
31438
|
content = [content];
|
|
30630
31439
|
} else if (typeof content == "string") {
|
|
30631
31440
|
options = Object.assign(Object.assign({}, this._parseOptions), options);
|
|
30632
|
-
const r =
|
|
31441
|
+
const r = parse3(content, options);
|
|
30633
31442
|
content = r.childNodes.length ? r.childNodes : [new text_1.default(r.innerHTML, this)];
|
|
30634
31443
|
}
|
|
30635
31444
|
resetParent(this.childNodes, null);
|
|
@@ -30643,7 +31452,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30643
31452
|
if (node instanceof node_1.default) {
|
|
30644
31453
|
return [node];
|
|
30645
31454
|
} else if (typeof node == "string") {
|
|
30646
|
-
const r =
|
|
31455
|
+
const r = parse3(node, this._parseOptions);
|
|
30647
31456
|
return r.childNodes.length ? r.childNodes : [new text_1.default(node, this)];
|
|
30648
31457
|
}
|
|
30649
31458
|
return [];
|
|
@@ -30659,15 +31468,15 @@ var require_html = __commonJS((exports) => {
|
|
|
30659
31468
|
return this.toString();
|
|
30660
31469
|
}
|
|
30661
31470
|
trimRight(pattern) {
|
|
30662
|
-
for (let
|
|
30663
|
-
const childNode = this.childNodes[
|
|
31471
|
+
for (let i2 = 0;i2 < this.childNodes.length; i2++) {
|
|
31472
|
+
const childNode = this.childNodes[i2];
|
|
30664
31473
|
if (childNode.nodeType === type_1.default.ELEMENT_NODE) {
|
|
30665
31474
|
childNode.trimRight(pattern);
|
|
30666
31475
|
} else {
|
|
30667
31476
|
const index = childNode.rawText.search(pattern);
|
|
30668
31477
|
if (index > -1) {
|
|
30669
31478
|
childNode.rawText = childNode.rawText.substr(0, index);
|
|
30670
|
-
this.childNodes.length =
|
|
31479
|
+
this.childNodes.length = i2 + 1;
|
|
30671
31480
|
}
|
|
30672
31481
|
}
|
|
30673
31482
|
}
|
|
@@ -30800,8 +31609,8 @@ var require_html = __commonJS((exports) => {
|
|
|
30800
31609
|
let old = null;
|
|
30801
31610
|
function findOne(test, elems) {
|
|
30802
31611
|
let elem = null;
|
|
30803
|
-
for (let
|
|
30804
|
-
const el2 = elems[
|
|
31612
|
+
for (let i2 = 0, l = elems.length;i2 < l && !elem; i2++) {
|
|
31613
|
+
const el2 = elems[i2];
|
|
30805
31614
|
if (test(el2)) {
|
|
30806
31615
|
elem = el2;
|
|
30807
31616
|
} else {
|
|
@@ -30855,7 +31664,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30855
31664
|
const attrs = this.rawAttributes;
|
|
30856
31665
|
for (const key in attrs) {
|
|
30857
31666
|
const val = attrs[key] || "";
|
|
30858
|
-
this._attrs[key.toLowerCase()] =
|
|
31667
|
+
this._attrs[key.toLowerCase()] = decode2(val);
|
|
30859
31668
|
}
|
|
30860
31669
|
return this._attrs;
|
|
30861
31670
|
}
|
|
@@ -30864,7 +31673,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30864
31673
|
const attrs = this.rawAttributes;
|
|
30865
31674
|
for (const key in attrs) {
|
|
30866
31675
|
const val = attrs[key] || "";
|
|
30867
|
-
ret_attrs[key] =
|
|
31676
|
+
ret_attrs[key] = decode2(val);
|
|
30868
31677
|
}
|
|
30869
31678
|
return ret_attrs;
|
|
30870
31679
|
}
|
|
@@ -30924,7 +31733,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30924
31733
|
}
|
|
30925
31734
|
attrs[key] = String(value);
|
|
30926
31735
|
if (this._attrs) {
|
|
30927
|
-
this._attrs[k2] =
|
|
31736
|
+
this._attrs[k2] = decode2(attrs[key]);
|
|
30928
31737
|
}
|
|
30929
31738
|
this.rawAttrs = Object.keys(attrs).map((name) => {
|
|
30930
31739
|
const val = this.quoteAttribute(attrs[name]);
|
|
@@ -30959,7 +31768,7 @@ var require_html = __commonJS((exports) => {
|
|
|
30959
31768
|
if (arguments.length < 2) {
|
|
30960
31769
|
throw new Error("2 arguments required");
|
|
30961
31770
|
}
|
|
30962
|
-
const p =
|
|
31771
|
+
const p = parse3(html, this._parseOptions);
|
|
30963
31772
|
if (where === "afterend") {
|
|
30964
31773
|
this.after(...p.childNodes);
|
|
30965
31774
|
} else if (where === "afterbegin") {
|
|
@@ -30998,11 +31807,11 @@ var require_html = __commonJS((exports) => {
|
|
|
30998
31807
|
get nextSibling() {
|
|
30999
31808
|
if (this.parentNode) {
|
|
31000
31809
|
const children = this.parentNode.childNodes;
|
|
31001
|
-
let
|
|
31002
|
-
while (
|
|
31003
|
-
const child = children[
|
|
31810
|
+
let i2 = 0;
|
|
31811
|
+
while (i2 < children.length) {
|
|
31812
|
+
const child = children[i2++];
|
|
31004
31813
|
if (this === child)
|
|
31005
|
-
return children[
|
|
31814
|
+
return children[i2] || null;
|
|
31006
31815
|
}
|
|
31007
31816
|
return null;
|
|
31008
31817
|
}
|
|
@@ -31010,10 +31819,10 @@ var require_html = __commonJS((exports) => {
|
|
|
31010
31819
|
get nextElementSibling() {
|
|
31011
31820
|
if (this.parentNode) {
|
|
31012
31821
|
const children = this.parentNode.childNodes;
|
|
31013
|
-
let
|
|
31822
|
+
let i2 = 0;
|
|
31014
31823
|
let find = false;
|
|
31015
|
-
while (
|
|
31016
|
-
const child = children[
|
|
31824
|
+
while (i2 < children.length) {
|
|
31825
|
+
const child = children[i2++];
|
|
31017
31826
|
if (find) {
|
|
31018
31827
|
if (child instanceof HTMLElement) {
|
|
31019
31828
|
return child || null;
|
|
@@ -31028,11 +31837,11 @@ var require_html = __commonJS((exports) => {
|
|
|
31028
31837
|
get previousSibling() {
|
|
31029
31838
|
if (this.parentNode) {
|
|
31030
31839
|
const children = this.parentNode.childNodes;
|
|
31031
|
-
let
|
|
31032
|
-
while (
|
|
31033
|
-
const child = children[--
|
|
31840
|
+
let i2 = children.length;
|
|
31841
|
+
while (i2 > 0) {
|
|
31842
|
+
const child = children[--i2];
|
|
31034
31843
|
if (this === child)
|
|
31035
|
-
return children[
|
|
31844
|
+
return children[i2 - 1] || null;
|
|
31036
31845
|
}
|
|
31037
31846
|
return null;
|
|
31038
31847
|
}
|
|
@@ -31040,10 +31849,10 @@ var require_html = __commonJS((exports) => {
|
|
|
31040
31849
|
get previousElementSibling() {
|
|
31041
31850
|
if (this.parentNode) {
|
|
31042
31851
|
const children = this.parentNode.childNodes;
|
|
31043
|
-
let
|
|
31852
|
+
let i2 = children.length;
|
|
31044
31853
|
let find = false;
|
|
31045
|
-
while (
|
|
31046
|
-
const child = children[--
|
|
31854
|
+
while (i2 > 0) {
|
|
31855
|
+
const child = children[--i2];
|
|
31047
31856
|
if (find) {
|
|
31048
31857
|
if (child instanceof HTMLElement) {
|
|
31049
31858
|
return child || null;
|
|
@@ -31083,7 +31892,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31083
31892
|
return this.classList.toString();
|
|
31084
31893
|
}
|
|
31085
31894
|
clone() {
|
|
31086
|
-
return
|
|
31895
|
+
return parse3(this.toString(), this._parseOptions).firstChild;
|
|
31087
31896
|
}
|
|
31088
31897
|
}
|
|
31089
31898
|
exports.default = HTMLElement;
|
|
@@ -31260,13 +32069,13 @@ var require_html = __commonJS((exports) => {
|
|
|
31260
32069
|
}
|
|
31261
32070
|
}
|
|
31262
32071
|
if (options.closeAllByClosing === true) {
|
|
31263
|
-
let
|
|
31264
|
-
for (
|
|
31265
|
-
if (stack[
|
|
32072
|
+
let i2;
|
|
32073
|
+
for (i2 = stack.length - 2;i2 >= 0; i2--) {
|
|
32074
|
+
if (stack[i2].rawTagName === tagName)
|
|
31266
32075
|
break;
|
|
31267
32076
|
}
|
|
31268
|
-
if (
|
|
31269
|
-
while (stack.length >
|
|
32077
|
+
if (i2 >= 0) {
|
|
32078
|
+
while (stack.length > i2) {
|
|
31270
32079
|
currentParent.range[1] = createRange(-1, Math.max(lastTextPos, tagEndPos))[1];
|
|
31271
32080
|
stack.pop();
|
|
31272
32081
|
currentParent = (0, back_1.default)(stack);
|
|
@@ -31282,7 +32091,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31282
32091
|
return stack;
|
|
31283
32092
|
}
|
|
31284
32093
|
exports.base_parse = base_parse;
|
|
31285
|
-
function
|
|
32094
|
+
function parse3(data, options = {}) {
|
|
31286
32095
|
const stack = base_parse(data, options);
|
|
31287
32096
|
const [root] = stack;
|
|
31288
32097
|
while (stack.length > 1) {
|
|
@@ -31309,7 +32118,7 @@ var require_html = __commonJS((exports) => {
|
|
|
31309
32118
|
}
|
|
31310
32119
|
return root;
|
|
31311
32120
|
}
|
|
31312
|
-
exports.parse =
|
|
32121
|
+
exports.parse = parse3;
|
|
31313
32122
|
function resolveInsertable(insertable) {
|
|
31314
32123
|
return insertable.map((val) => {
|
|
31315
32124
|
if (typeof val === "string") {
|
|
@@ -31368,41 +32177,18 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
31368
32177
|
var parse_1 = __importDefault(require_parse3());
|
|
31369
32178
|
var valid_1 = __importDefault(require_valid());
|
|
31370
32179
|
exports.valid = valid_1.default;
|
|
31371
|
-
function
|
|
32180
|
+
function parse3(data, options = {}) {
|
|
31372
32181
|
return (0, parse_1.default)(data, options);
|
|
31373
32182
|
}
|
|
31374
|
-
exports.default =
|
|
31375
|
-
exports.parse =
|
|
31376
|
-
|
|
31377
|
-
|
|
31378
|
-
|
|
31379
|
-
|
|
31380
|
-
|
|
31381
|
-
|
|
31382
|
-
|
|
31383
|
-
});
|
|
31384
|
-
// ../../node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js
|
|
31385
|
-
import g from "crypto";
|
|
31386
|
-
import _ from "fs";
|
|
31387
|
-
import { TextDecoder as b, TextEncoder as v } from "util";
|
|
31388
|
-
var y, w;
|
|
31389
|
-
var init_chunk_W5DTLHV4 = __esm(() => {
|
|
31390
|
-
globalThis.fs || Object.defineProperty(globalThis, "fs", { value: _ });
|
|
31391
|
-
globalThis.process || Object.defineProperties(globalThis, "process", { value: process });
|
|
31392
|
-
globalThis.crypto || Object.defineProperty(globalThis, "crypto", { value: g.webcrypto ? g.webcrypto : { getRandomValues(m) {
|
|
31393
|
-
return g.randomFillSync(m);
|
|
31394
|
-
} } });
|
|
31395
|
-
globalThis.performance || Object.defineProperty(globalThis, "performance", { value: { now() {
|
|
31396
|
-
let [m, o] = process.hrtime();
|
|
31397
|
-
return m * 1000 + o / 1e6;
|
|
31398
|
-
} } });
|
|
31399
|
-
y = new v("utf-8");
|
|
31400
|
-
w = new b("utf-8");
|
|
31401
|
-
});
|
|
31402
|
-
|
|
31403
|
-
// ../../node_modules/@astrojs/compiler/dist/node/index.js
|
|
31404
|
-
var init_node = __esm(() => {
|
|
31405
|
-
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;
|
|
31406
32192
|
});
|
|
31407
32193
|
// ../cms/src/source-finder/cache.ts
|
|
31408
32194
|
var parsedFileCache, directoryCache, markdownFileCache, declaredUrlIndexCache, dirtyFiles;
|
|
@@ -31489,9 +32275,9 @@ function extractAstroImageOriginalUrl(src) {
|
|
|
31489
32275
|
return href;
|
|
31490
32276
|
}
|
|
31491
32277
|
if (url.pathname.startsWith("/@image/")) {
|
|
31492
|
-
const
|
|
31493
|
-
if (
|
|
31494
|
-
return
|
|
32278
|
+
const f2 = url.searchParams.get("f");
|
|
32279
|
+
if (f2)
|
|
32280
|
+
return f2;
|
|
31495
32281
|
}
|
|
31496
32282
|
} catch {}
|
|
31497
32283
|
return;
|
|
@@ -31511,7 +32297,7 @@ var init_snippet_utils = __esm(() => {
|
|
|
31511
32297
|
|
|
31512
32298
|
// ../cms/src/handlers/source-writer.ts
|
|
31513
32299
|
import fs8 from "fs/promises";
|
|
31514
|
-
import
|
|
32300
|
+
import path11 from "path";
|
|
31515
32301
|
async function handleUpdate(request, manifestWriter) {
|
|
31516
32302
|
const { changes, meta } = request;
|
|
31517
32303
|
const errors = [];
|
|
@@ -31548,7 +32334,7 @@ async function handleUpdate(request, manifestWriter) {
|
|
|
31548
32334
|
}
|
|
31549
32335
|
if (appliedCount > 0 && newContent !== currentContent) {
|
|
31550
32336
|
for (const op of fileOps) {
|
|
31551
|
-
await fs8.mkdir(
|
|
32337
|
+
await fs8.mkdir(path11.dirname(op.target), { recursive: true });
|
|
31552
32338
|
await fs8.writeFile(op.target, op.bytes);
|
|
31553
32339
|
}
|
|
31554
32340
|
await fs8.writeFile(fullPath, newContent, "utf-8");
|
|
@@ -31782,28 +32568,28 @@ function findFrontmatterAssetImport(content, varName) {
|
|
|
31782
32568
|
return null;
|
|
31783
32569
|
const fmStart = fmMatch[0].indexOf(fmMatch[1]);
|
|
31784
32570
|
const importRe = /^\s*import\s+(?!type\b)([\s\S]+?)\s+from\s+(['"])([^'"]+)\2/gm;
|
|
31785
|
-
let
|
|
31786
|
-
while ((
|
|
31787
|
-
const source =
|
|
32571
|
+
let m2;
|
|
32572
|
+
while ((m2 = importRe.exec(fmMatch[1])) !== null) {
|
|
32573
|
+
const source = m2[3];
|
|
31788
32574
|
if (!source.startsWith(".") || !ASSET_IMPORT_EXT_RE.test(source))
|
|
31789
32575
|
continue;
|
|
31790
|
-
const tokens =
|
|
32576
|
+
const tokens = m2[1].replace(/[{}]/g, ",").split(",").map((s) => s.trim()).filter((t) => t && !t.startsWith("type "));
|
|
31791
32577
|
const matches = tokens.some((tok) => {
|
|
31792
32578
|
const aliasMatch = tok.match(/^\S+\s+as\s+(\S+)$/);
|
|
31793
32579
|
return (aliasMatch ? aliasMatch[1] : tok) === varName;
|
|
31794
32580
|
});
|
|
31795
32581
|
if (!matches)
|
|
31796
32582
|
continue;
|
|
31797
|
-
const matchStart = fmStart +
|
|
31798
|
-
const sourceStart = matchStart +
|
|
32583
|
+
const matchStart = fmStart + m2.index;
|
|
32584
|
+
const sourceStart = matchStart + m2[0].indexOf(m2[2]) + 1;
|
|
31799
32585
|
return { localName: varName, source, sourceStart, sourceEnd: sourceStart + source.length };
|
|
31800
32586
|
}
|
|
31801
32587
|
return null;
|
|
31802
32588
|
}
|
|
31803
32589
|
function inlineJsxLiteralReplace(content, lines, regionStart, exprMatch, newSrc) {
|
|
31804
32590
|
let regionStartOffset = 0;
|
|
31805
|
-
for (let
|
|
31806
|
-
regionStartOffset += lines[
|
|
32591
|
+
for (let i2 = 0;i2 < regionStart; i2++)
|
|
32592
|
+
regionStartOffset += lines[i2].length + 1;
|
|
31807
32593
|
const absIndex = regionStartOffset + exprMatch.index;
|
|
31808
32594
|
return {
|
|
31809
32595
|
content: content.slice(0, absIndex) + `src="${escapeReplacement(newSrc)}"` + content.slice(absIndex + exprMatch.length),
|
|
@@ -31814,8 +32600,8 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
|
|
|
31814
32600
|
const resolved = await resolveNewSrcBytes(newSrc, originUrl);
|
|
31815
32601
|
if (!resolved)
|
|
31816
32602
|
return null;
|
|
31817
|
-
const originalAssetAbs =
|
|
31818
|
-
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);
|
|
31819
32605
|
const newRelImport = relativeImportPath2(absFilePath, targetAbs);
|
|
31820
32606
|
const newContent = content.slice(0, importInfo.sourceStart) + newRelImport + content.slice(importInfo.sourceEnd);
|
|
31821
32607
|
return {
|
|
@@ -31825,8 +32611,8 @@ async function tryRewriteAssetImport(content, importInfo, newSrc, absFilePath, o
|
|
|
31825
32611
|
};
|
|
31826
32612
|
}
|
|
31827
32613
|
async function resolveNewSrcBytes(newSrc, originUrl) {
|
|
31828
|
-
const filenameFromPath = (p) =>
|
|
31829
|
-
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;
|
|
31830
32616
|
if (diskPath) {
|
|
31831
32617
|
try {
|
|
31832
32618
|
return { bytes: await fs8.readFile(diskPath), filename: filenameFromPath(newSrc) };
|
|
@@ -31916,10 +32702,10 @@ function replaceClassInAttribute(content, oldClass, newClass, sourceLine) {
|
|
|
31916
32702
|
}
|
|
31917
32703
|
const lines = content.split(`
|
|
31918
32704
|
`);
|
|
31919
|
-
for (let
|
|
31920
|
-
const result = replaceOnLine(lines[
|
|
32705
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
32706
|
+
const result = replaceOnLine(lines[i2]);
|
|
31921
32707
|
if (result !== null) {
|
|
31922
|
-
lines[
|
|
32708
|
+
lines[i2] = result;
|
|
31923
32709
|
return { success: true, content: lines.join(`
|
|
31924
32710
|
`) };
|
|
31925
32711
|
}
|
|
@@ -31959,10 +32745,10 @@ function appendClassToAttribute(content, newClass, sourceLine) {
|
|
|
31959
32745
|
}
|
|
31960
32746
|
const lines = content.split(`
|
|
31961
32747
|
`);
|
|
31962
|
-
for (let
|
|
31963
|
-
const result = doAppendOnLine(lines[
|
|
32748
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
32749
|
+
const result = doAppendOnLine(lines[i2]);
|
|
31964
32750
|
if (result !== null) {
|
|
31965
|
-
lines[
|
|
32751
|
+
lines[i2] = result;
|
|
31966
32752
|
return { success: true, content: lines.join(`
|
|
31967
32753
|
`) };
|
|
31968
32754
|
}
|
|
@@ -32121,9 +32907,9 @@ function applyTextChangeWithPlaceholders(content, sourceSnippet, originalValue,
|
|
|
32121
32907
|
}
|
|
32122
32908
|
let updatedSnippet = sourceSnippet;
|
|
32123
32909
|
let anyChange = false;
|
|
32124
|
-
for (let
|
|
32125
|
-
const oldPart = originalParts[
|
|
32126
|
-
let newPart = newParts[
|
|
32910
|
+
for (let i2 = 0;i2 < originalParts.length; i2++) {
|
|
32911
|
+
const oldPart = originalParts[i2];
|
|
32912
|
+
let newPart = newParts[i2];
|
|
32127
32913
|
if (oldPart === newPart || oldPart.length === 0) {
|
|
32128
32914
|
continue;
|
|
32129
32915
|
}
|
|
@@ -32170,8 +32956,8 @@ function findTextInSnippet(snippet, decodedText) {
|
|
|
32170
32956
|
const match = snippet.match(regex);
|
|
32171
32957
|
if (match)
|
|
32172
32958
|
return match[0];
|
|
32173
|
-
const
|
|
32174
|
-
const brAwarePattern =
|
|
32959
|
+
const chars2 = [...decodedText].map((ch) => escapeRegex(ch));
|
|
32960
|
+
const brAwarePattern = chars2.join("(?:<br\\b[^>]*\\/?>)*");
|
|
32175
32961
|
const brRegex = new RegExp(brAwarePattern);
|
|
32176
32962
|
const brMatch = snippet.match(brRegex);
|
|
32177
32963
|
return brMatch && brMatch[0] !== decodedText ? brMatch[0] : null;
|
|
@@ -32215,19 +33001,19 @@ function findExpressionAttribute(text, attr) {
|
|
|
32215
33001
|
return null;
|
|
32216
33002
|
const braceStart = match.index + match[0].length - 1;
|
|
32217
33003
|
let depth = 1;
|
|
32218
|
-
let
|
|
32219
|
-
while (
|
|
32220
|
-
if (text[
|
|
33004
|
+
let i2 = braceStart + 1;
|
|
33005
|
+
while (i2 < text.length && depth > 0) {
|
|
33006
|
+
if (text[i2] === "{")
|
|
32221
33007
|
depth++;
|
|
32222
|
-
else if (text[
|
|
33008
|
+
else if (text[i2] === "}")
|
|
32223
33009
|
depth--;
|
|
32224
|
-
|
|
33010
|
+
i2++;
|
|
32225
33011
|
}
|
|
32226
33012
|
if (depth !== 0)
|
|
32227
33013
|
return null;
|
|
32228
33014
|
return {
|
|
32229
33015
|
index: match.index,
|
|
32230
|
-
length:
|
|
33016
|
+
length: i2 - match.index
|
|
32231
33017
|
};
|
|
32232
33018
|
}
|
|
32233
33019
|
function findExpressionSrcAttribute(text) {
|
|
@@ -32323,16 +33109,16 @@ function tryBrNormalizedChange(sourceSnippet, resolvedOriginal, resolvedNewText)
|
|
|
32323
33109
|
if (originalSegments.length !== newSegments.length)
|
|
32324
33110
|
return null;
|
|
32325
33111
|
const root = import_node_html_parser.parse(sourceSnippet, { blockTextElements: {} });
|
|
32326
|
-
const outerElement = root.childNodes.find((
|
|
33112
|
+
const outerElement = root.childNodes.find((n2) => n2.nodeType === import_node_html_parser.NodeType.ELEMENT_NODE);
|
|
32327
33113
|
if (!outerElement)
|
|
32328
33114
|
return null;
|
|
32329
33115
|
const groups = [[]];
|
|
32330
|
-
for (let
|
|
32331
|
-
const child = outerElement.childNodes[
|
|
33116
|
+
for (let i2 = 0;i2 < outerElement.childNodes.length; i2++) {
|
|
33117
|
+
const child = outerElement.childNodes[i2];
|
|
32332
33118
|
if (child.nodeType === import_node_html_parser.NodeType.ELEMENT_NODE && child.rawTagName === "br") {
|
|
32333
33119
|
groups.push([]);
|
|
32334
33120
|
} else if (child.nodeType === import_node_html_parser.NodeType.TEXT_NODE) {
|
|
32335
|
-
groups[groups.length - 1].push({ node: child, index:
|
|
33121
|
+
groups[groups.length - 1].push({ node: child, index: i2 });
|
|
32336
33122
|
}
|
|
32337
33123
|
}
|
|
32338
33124
|
if (groups.length !== originalSegments.length)
|
|
@@ -32374,7 +33160,7 @@ var init_source_writer = __esm(() => {
|
|
|
32374
33160
|
});
|
|
32375
33161
|
|
|
32376
33162
|
// ../cms/src/handlers/api-routes.ts
|
|
32377
|
-
import
|
|
33163
|
+
import path12 from "path";
|
|
32378
33164
|
function requireMedia(ctx) {
|
|
32379
33165
|
if (!ctx.mediaAdapter) {
|
|
32380
33166
|
sendError(ctx.res, "Media storage not configured", 501);
|
|
@@ -32537,7 +33323,7 @@ var init_api_routes = __esm(() => {
|
|
|
32537
33323
|
sendJson(res, { success: false, error: `Invalid content path: ${body.filePath}` }, 400);
|
|
32538
33324
|
return;
|
|
32539
33325
|
}
|
|
32540
|
-
const fullPath =
|
|
33326
|
+
const fullPath = path12.resolve(getProjectRoot(), body.filePath.replace(/^\//, ""));
|
|
32541
33327
|
expectedDeletions.add(fullPath);
|
|
32542
33328
|
const result = await core.deleteEntry(entry.collection, entry.slug);
|
|
32543
33329
|
if (result.success) {
|
|
@@ -32644,7 +33430,7 @@ var init_api_routes = __esm(() => {
|
|
|
32644
33430
|
const body = await parseJsonBody(req);
|
|
32645
33431
|
const result = await core.deletePage(body);
|
|
32646
33432
|
if (result.success && result.filePath) {
|
|
32647
|
-
expectedDeletions.add(
|
|
33433
|
+
expectedDeletions.add(path12.resolve(getProjectRoot(), result.filePath));
|
|
32648
33434
|
}
|
|
32649
33435
|
if (result.success && body.createRedirect && body.redirectTo) {
|
|
32650
33436
|
await core.addRedirect({ source: body.pagePath, destination: body.redirectTo, statusCode: 307 });
|
|
@@ -32749,7 +33535,7 @@ var init_color_patterns = __esm(() => {
|
|
|
32749
33535
|
|
|
32750
33536
|
// ../cms/src/tailwind-colors.ts
|
|
32751
33537
|
import fs9 from "fs/promises";
|
|
32752
|
-
import
|
|
33538
|
+
import path13 from "path";
|
|
32753
33539
|
async function parseTailwindConfig(projectRoot = getProjectRoot()) {
|
|
32754
33540
|
const cssFiles = [
|
|
32755
33541
|
"src/styles/global.css",
|
|
@@ -32763,7 +33549,7 @@ async function parseTailwindConfig(projectRoot = getProjectRoot()) {
|
|
|
32763
33549
|
];
|
|
32764
33550
|
let customColors = [];
|
|
32765
33551
|
for (const cssFile of cssFiles) {
|
|
32766
|
-
const fullPath =
|
|
33552
|
+
const fullPath = path13.join(projectRoot, cssFile);
|
|
32767
33553
|
try {
|
|
32768
33554
|
const content = await fs9.readFile(fullPath, "utf-8");
|
|
32769
33555
|
customColors = extractColorsFromCss(content);
|
|
@@ -32836,7 +33622,7 @@ async function parseTextStyles(projectRoot = getProjectRoot()) {
|
|
|
32836
33622
|
];
|
|
32837
33623
|
let customTextStyles = {};
|
|
32838
33624
|
for (const cssFile of cssFiles) {
|
|
32839
|
-
const fullPath =
|
|
33625
|
+
const fullPath = path13.join(projectRoot, cssFile);
|
|
32840
33626
|
try {
|
|
32841
33627
|
const content = await fs9.readFile(fullPath, "utf-8");
|
|
32842
33628
|
customTextStyles = extractTextStylesFromCss(content);
|
|
@@ -33304,7 +34090,7 @@ var init_local_admin = __esm(() => {
|
|
|
33304
34090
|
|
|
33305
34091
|
// ../cms/src/manifest-writer.ts
|
|
33306
34092
|
import fs10 from "fs/promises";
|
|
33307
|
-
import
|
|
34093
|
+
import path14 from "path";
|
|
33308
34094
|
|
|
33309
34095
|
class ManifestWriter {
|
|
33310
34096
|
globalManifest;
|
|
@@ -33375,10 +34161,10 @@ class ManifestWriter {
|
|
|
33375
34161
|
}
|
|
33376
34162
|
getPageManifestPath(pagePath) {
|
|
33377
34163
|
if (pagePath === "/" || pagePath === "") {
|
|
33378
|
-
return
|
|
34164
|
+
return path14.join(this.outDir, "index.json");
|
|
33379
34165
|
}
|
|
33380
34166
|
const cleanPath = pagePath.replace(/^\//, "");
|
|
33381
|
-
return
|
|
34167
|
+
return path14.join(this.outDir, `${cleanPath}.json`);
|
|
33382
34168
|
}
|
|
33383
34169
|
addPage(pagePath, entries, components, collection, seo) {
|
|
33384
34170
|
this.pageManifests.set(pagePath, { entries, components, collection, seo });
|
|
@@ -33404,7 +34190,7 @@ class ManifestWriter {
|
|
|
33404
34190
|
}
|
|
33405
34191
|
async writePageManifest(pagePath, entries, components, collection, seo) {
|
|
33406
34192
|
const manifestPath = this.getPageManifestPath(pagePath);
|
|
33407
|
-
const manifestDir =
|
|
34193
|
+
const manifestDir = path14.dirname(manifestPath);
|
|
33408
34194
|
await fs10.mkdir(manifestDir, { recursive: true });
|
|
33409
34195
|
const metadata = {
|
|
33410
34196
|
version: MANIFEST_VERSION,
|
|
@@ -33460,7 +34246,7 @@ class ManifestWriter {
|
|
|
33460
34246
|
}
|
|
33461
34247
|
}
|
|
33462
34248
|
if (this.outDir) {
|
|
33463
|
-
const globalManifestPath =
|
|
34249
|
+
const globalManifestPath = path14.join(this.outDir, this.manifestFile);
|
|
33464
34250
|
const globalSettings = {
|
|
33465
34251
|
componentDefinitions: this.componentDefinitions,
|
|
33466
34252
|
pages
|
|
@@ -33570,8 +34356,8 @@ function $constructor(name, initializer, params) {
|
|
|
33570
34356
|
initializer(inst, def);
|
|
33571
34357
|
const proto = _2.prototype;
|
|
33572
34358
|
const keys = Object.keys(proto);
|
|
33573
|
-
for (let
|
|
33574
|
-
const k = keys[
|
|
34359
|
+
for (let i2 = 0;i2 < keys.length; i2++) {
|
|
34360
|
+
const k = keys[i2];
|
|
33575
34361
|
if (!(k in inst)) {
|
|
33576
34362
|
inst[k] = proto[k].bind(inst);
|
|
33577
34363
|
}
|
|
@@ -33722,10 +34508,10 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
33722
34508
|
fieldErrors._errors.push(mapper(issue));
|
|
33723
34509
|
} else {
|
|
33724
34510
|
let curr = fieldErrors;
|
|
33725
|
-
let
|
|
33726
|
-
while (
|
|
33727
|
-
const el = issue.path[
|
|
33728
|
-
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;
|
|
33729
34515
|
if (!terminal) {
|
|
33730
34516
|
curr[el] = curr[el] || { _errors: [] };
|
|
33731
34517
|
} else {
|
|
@@ -33733,7 +34519,7 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
33733
34519
|
curr[el]._errors.push(mapper(issue));
|
|
33734
34520
|
}
|
|
33735
34521
|
curr = curr[el];
|
|
33736
|
-
|
|
34522
|
+
i2++;
|
|
33737
34523
|
}
|
|
33738
34524
|
}
|
|
33739
34525
|
}
|
|
@@ -33927,8 +34713,8 @@ class $ZodRegistry {
|
|
|
33927
34713
|
if (p) {
|
|
33928
34714
|
const pm = { ...this.get(p) ?? {} };
|
|
33929
34715
|
delete pm.id;
|
|
33930
|
-
const
|
|
33931
|
-
return Object.keys(
|
|
34716
|
+
const f2 = { ...pm, ...this._map.get(schema) };
|
|
34717
|
+
return Object.keys(f2).length ? f2 : undefined;
|
|
33932
34718
|
}
|
|
33933
34719
|
return this._map.get(schema);
|
|
33934
34720
|
}
|
|
@@ -34072,7 +34858,7 @@ var init_field_types = __esm(() => {
|
|
|
34072
34858
|
|
|
34073
34859
|
// ../cms/src/migrate-astro-image.ts
|
|
34074
34860
|
import fs11 from "fs/promises";
|
|
34075
|
-
import
|
|
34861
|
+
import path15 from "path";
|
|
34076
34862
|
async function migrateAstroImages(options = {}) {
|
|
34077
34863
|
const projectRoot = options.projectRoot ?? getProjectRoot();
|
|
34078
34864
|
const dryRun = options.dryRun ?? false;
|
|
@@ -34080,11 +34866,11 @@ async function migrateAstroImages(options = {}) {
|
|
|
34080
34866
|
const migrations = [];
|
|
34081
34867
|
const skipped = [];
|
|
34082
34868
|
for (const def of Object.values(collections)) {
|
|
34083
|
-
const astroFields = def.fields.filter((
|
|
34869
|
+
const astroFields = def.fields.filter((f2) => f2.astroImage);
|
|
34084
34870
|
if (astroFields.length === 0 || !def.entries)
|
|
34085
34871
|
continue;
|
|
34086
34872
|
for (const entry of def.entries) {
|
|
34087
|
-
const entryAbs =
|
|
34873
|
+
const entryAbs = path15.isAbsolute(entry.sourcePath) ? entry.sourcePath : path15.join(projectRoot, entry.sourcePath);
|
|
34088
34874
|
let raw;
|
|
34089
34875
|
try {
|
|
34090
34876
|
raw = await fs11.readFile(entryAbs, "utf-8");
|
|
@@ -34109,7 +34895,7 @@ async function migrateAstroImages(options = {}) {
|
|
|
34109
34895
|
}
|
|
34110
34896
|
if (!current.startsWith("/") || current.startsWith("//"))
|
|
34111
34897
|
continue;
|
|
34112
|
-
const sourceAbs =
|
|
34898
|
+
const sourceAbs = path15.join(projectRoot, "public", current.replace(/^\/+/, ""));
|
|
34113
34899
|
let sourceBuf;
|
|
34114
34900
|
try {
|
|
34115
34901
|
sourceBuf = await fs11.readFile(sourceAbs);
|
|
@@ -34120,11 +34906,11 @@ async function migrateAstroImages(options = {}) {
|
|
|
34120
34906
|
const target = await pickAstroImageTarget({
|
|
34121
34907
|
entryAbsPath: entryAbs,
|
|
34122
34908
|
slug: entry.slug,
|
|
34123
|
-
originalFilename:
|
|
34909
|
+
originalFilename: path15.basename(current),
|
|
34124
34910
|
compareBuffer: sourceBuf
|
|
34125
34911
|
});
|
|
34126
34912
|
if (!dryRun) {
|
|
34127
|
-
await fs11.mkdir(
|
|
34913
|
+
await fs11.mkdir(path15.dirname(target.absPath), { recursive: true });
|
|
34128
34914
|
await fs11.writeFile(target.absPath, sourceBuf);
|
|
34129
34915
|
}
|
|
34130
34916
|
doc2.set(field.name, target.relPath);
|
|
@@ -34187,7 +34973,7 @@ var exports_migrate = {};
|
|
|
34187
34973
|
__export(exports_migrate, {
|
|
34188
34974
|
migrate: () => migrate
|
|
34189
34975
|
});
|
|
34190
|
-
import
|
|
34976
|
+
import path16 from "path";
|
|
34191
34977
|
async function migrate(args) {
|
|
34192
34978
|
if (args.target !== "astro-image") {
|
|
34193
34979
|
console.error(`Unknown migrate target: ${args.target}`);
|
|
@@ -34203,10 +34989,10 @@ async function migrate(args) {
|
|
|
34203
34989
|
} else {
|
|
34204
34990
|
console.log(`${result.migrations.length} field(s) to migrate:
|
|
34205
34991
|
`);
|
|
34206
|
-
for (const
|
|
34207
|
-
console.log(` ${
|
|
34208
|
-
console.log(` ${
|
|
34209
|
-
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)}`);
|
|
34210
34996
|
}
|
|
34211
34997
|
}
|
|
34212
34998
|
if (result.skipped.length > 0) {
|
|
@@ -34248,7 +35034,7 @@ Commands:`);
|
|
|
34248
35034
|
console.log(" build Run astro build with the Nua defaults");
|
|
34249
35035
|
console.log(" dev Run astro dev with the Nua defaults");
|
|
34250
35036
|
console.log(" preview Run astro preview with the Nua defaults");
|
|
34251
|
-
console.log(" check Validate the
|
|
35037
|
+
console.log(" check Validate collections and parse the source (no build). --json, --strict, --content-only");
|
|
34252
35038
|
console.log(" init Convert a standard Astro project to use Nua");
|
|
34253
35039
|
console.log(" clean Eject to a standard Astro project (remove @nuasite/* deps)");
|
|
34254
35040
|
console.log(" migrate <target> Run a content migration. Targets: astro-image");
|
|
@@ -34266,7 +35052,8 @@ if (command && ["build", "dev", "preview"].includes(command)) {
|
|
|
34266
35052
|
process.exit(await check2({
|
|
34267
35053
|
cwd: process.cwd(),
|
|
34268
35054
|
json: args.includes("--json"),
|
|
34269
|
-
strict: args.includes("--strict")
|
|
35055
|
+
strict: args.includes("--strict"),
|
|
35056
|
+
contentOnly: args.includes("--content-only")
|
|
34270
35057
|
}));
|
|
34271
35058
|
break;
|
|
34272
35059
|
}
|