guessit-js 4.5.1 → 4.5.2
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 +3 -3
- package/dist/guessit-js.cjs +15 -10
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +15 -10
- package/dist/guessit-js.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@ Extract metadata (title, year, season, episode, codec, language, etc.) from medi
|
|
|
5
5
|
[](https://www.npmjs.com/package/guessit-js)
|
|
6
6
|
[](https://github.com/opensubtitles/guessit-js/actions/workflows/ci.yml)
|
|
7
7
|
[](https://www.gnu.org/licenses/lgpl-3.0)
|
|
8
|
-
[-brightgreen)](https://github.com/guessit-io/guessit)
|
|
9
9
|
|
|
10
10
|
**[Live Demo](https://opensubtitles.github.io/guessit-js)** · **[API Docs](https://opensubtitles.github.io/guessit-js/docs)** · **[npm](https://www.npmjs.com/package/guessit-js)**
|
|
11
11
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
|
-
- **100% compatibility** with Python guessit 4.4.0 (
|
|
14
|
+
- **100% compatibility** with Python guessit 4.4.0 (1342/1342 fixtures passing, including Python's own grown 4.x corpus) — and **more correct**: ships fixes for 32 historical upstream bugs, Python's still-open #875 and #877, and 112 of the 276 cross-parser cases Python admits failing (see [Differences from Python](#differences-from-python-guessit))
|
|
15
15
|
- **3.5x faster** than Python (6.87ms vs 23.86ms per parse)
|
|
16
16
|
- **50 properties** detected: title, year, season, episode, resolution, codec, language, and more — with a [machine-readable schema](#output-schema)
|
|
17
17
|
- **Single dependency** ([rebulk-js](https://www.npmjs.com/package/rebulk-js))
|
|
@@ -122,7 +122,7 @@ The WASM build is **bit-identical to the JS build** across the entire test corpu
|
|
|
122
122
|
|
|
123
123
|
## Differences from Python guessit
|
|
124
124
|
|
|
125
|
-
guessit-js is a faithful port (
|
|
125
|
+
guessit-js is a faithful port (1342/1342 fixtures, tracking Python 4.4.0), but it is
|
|
126
126
|
**not bug-for-bug identical** — where Python has a genuine parsing bug, guessit-js
|
|
127
127
|
is corrected. Highlights:
|
|
128
128
|
|
package/dist/guessit-js.cjs
CHANGED
|
@@ -372,6 +372,11 @@ class _BaseMatches {
|
|
|
372
372
|
toArray() {
|
|
373
373
|
return [...this._delegate];
|
|
374
374
|
}
|
|
375
|
+
/** All matches as an array. Ported Python code reads `matches.matches` — without
|
|
376
|
+
* this getter that silently evaluated to undefined and turned rules into no-ops. */
|
|
377
|
+
get matches() {
|
|
378
|
+
return [...this._delegate];
|
|
379
|
+
}
|
|
375
380
|
// ── Cache accessors ──────────────────────────────────────────────────────
|
|
376
381
|
get nameDict() {
|
|
377
382
|
if (!this._nameDict) {
|
|
@@ -1621,12 +1626,10 @@ function executeRule(rule, matches, context) {
|
|
|
1621
1626
|
}
|
|
1622
1627
|
function toposortRules(rules) {
|
|
1623
1628
|
const graph = /* @__PURE__ */ new Map();
|
|
1624
|
-
const
|
|
1629
|
+
const classToDeps = /* @__PURE__ */ new Map();
|
|
1625
1630
|
for (const rule of rules) {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
}
|
|
1629
|
-
classToDep.set(rule.constructor, rule);
|
|
1631
|
+
const cls = rule.constructor;
|
|
1632
|
+
classToDeps.set(cls, [...classToDeps.get(cls) ?? [], rule]);
|
|
1630
1633
|
}
|
|
1631
1634
|
for (const rule of rules) {
|
|
1632
1635
|
const deps = /* @__PURE__ */ new Set();
|
|
@@ -1634,18 +1637,20 @@ function toposortRules(rules) {
|
|
|
1634
1637
|
if (rawDeps) {
|
|
1635
1638
|
const depArr = Array.isArray(rawDeps) ? rawDeps : [rawDeps];
|
|
1636
1639
|
for (const dep of depArr) {
|
|
1637
|
-
let resolved;
|
|
1640
|
+
let resolved = [];
|
|
1638
1641
|
if (typeof dep === "string") {
|
|
1639
|
-
for (const [cls,
|
|
1642
|
+
for (const [cls, insts] of classToDeps) {
|
|
1640
1643
|
if (cls.name === dep) {
|
|
1641
|
-
resolved =
|
|
1644
|
+
resolved = insts;
|
|
1642
1645
|
break;
|
|
1643
1646
|
}
|
|
1644
1647
|
}
|
|
1645
1648
|
} else {
|
|
1646
|
-
resolved =
|
|
1649
|
+
resolved = classToDeps.get(dep) ?? [];
|
|
1650
|
+
}
|
|
1651
|
+
for (const inst of resolved) {
|
|
1652
|
+
if (inst !== rule) deps.add(inst);
|
|
1647
1653
|
}
|
|
1648
|
-
if (resolved) deps.add(resolved);
|
|
1649
1654
|
}
|
|
1650
1655
|
}
|
|
1651
1656
|
graph.set(rule, deps);
|