guessit-js 4.5.1 → 4.5.3
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 +20 -4
- package/bin/cli.mjs +51 -0
- package/dist/guessit-js.cjs +18 -10
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +19 -11
- package/dist/guessit-js.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/package.json +16 -9
package/dist/guessit-js.js
CHANGED
|
@@ -370,6 +370,11 @@ class _BaseMatches {
|
|
|
370
370
|
toArray() {
|
|
371
371
|
return [...this._delegate];
|
|
372
372
|
}
|
|
373
|
+
/** All matches as an array. Ported Python code reads `matches.matches` — without
|
|
374
|
+
* this getter that silently evaluated to undefined and turned rules into no-ops. */
|
|
375
|
+
get matches() {
|
|
376
|
+
return [...this._delegate];
|
|
377
|
+
}
|
|
373
378
|
// ── Cache accessors ──────────────────────────────────────────────────────
|
|
374
379
|
get nameDict() {
|
|
375
380
|
if (!this._nameDict) {
|
|
@@ -1619,12 +1624,10 @@ function executeRule(rule, matches, context) {
|
|
|
1619
1624
|
}
|
|
1620
1625
|
function toposortRules(rules) {
|
|
1621
1626
|
const graph = /* @__PURE__ */ new Map();
|
|
1622
|
-
const
|
|
1627
|
+
const classToDeps = /* @__PURE__ */ new Map();
|
|
1623
1628
|
for (const rule of rules) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
}
|
|
1627
|
-
classToDep.set(rule.constructor, rule);
|
|
1629
|
+
const cls = rule.constructor;
|
|
1630
|
+
classToDeps.set(cls, [...classToDeps.get(cls) ?? [], rule]);
|
|
1628
1631
|
}
|
|
1629
1632
|
for (const rule of rules) {
|
|
1630
1633
|
const deps = /* @__PURE__ */ new Set();
|
|
@@ -1632,18 +1635,20 @@ function toposortRules(rules) {
|
|
|
1632
1635
|
if (rawDeps) {
|
|
1633
1636
|
const depArr = Array.isArray(rawDeps) ? rawDeps : [rawDeps];
|
|
1634
1637
|
for (const dep of depArr) {
|
|
1635
|
-
let resolved;
|
|
1638
|
+
let resolved = [];
|
|
1636
1639
|
if (typeof dep === "string") {
|
|
1637
|
-
for (const [cls,
|
|
1640
|
+
for (const [cls, insts] of classToDeps) {
|
|
1638
1641
|
if (cls.name === dep) {
|
|
1639
|
-
resolved =
|
|
1642
|
+
resolved = insts;
|
|
1640
1643
|
break;
|
|
1641
1644
|
}
|
|
1642
1645
|
}
|
|
1643
1646
|
} else {
|
|
1644
|
-
resolved =
|
|
1647
|
+
resolved = classToDeps.get(dep) ?? [];
|
|
1648
|
+
}
|
|
1649
|
+
for (const inst of resolved) {
|
|
1650
|
+
if (inst !== rule) deps.add(inst);
|
|
1645
1651
|
}
|
|
1646
|
-
if (resolved) deps.add(resolved);
|
|
1647
1652
|
}
|
|
1648
1653
|
}
|
|
1649
1654
|
graph.set(rule, deps);
|
|
@@ -14509,6 +14514,8 @@ function configure(options, rulesBuilder, force = false) {
|
|
|
14509
14514
|
function reset() {
|
|
14510
14515
|
defaultApi.reset();
|
|
14511
14516
|
}
|
|
14517
|
+
const version$1 = "4.5.3";
|
|
14518
|
+
const version = version$1;
|
|
14512
14519
|
export {
|
|
14513
14520
|
GUESSIT_SCHEMA,
|
|
14514
14521
|
GuessItApi,
|
|
@@ -14521,6 +14528,7 @@ export {
|
|
|
14521
14528
|
parseOptions,
|
|
14522
14529
|
properties,
|
|
14523
14530
|
rebulkBuilder,
|
|
14524
|
-
reset
|
|
14531
|
+
reset,
|
|
14532
|
+
version
|
|
14525
14533
|
};
|
|
14526
14534
|
//# sourceMappingURL=guessit-js.js.map
|