@openpkg-ts/sdk 0.34.0 → 0.35.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.
@@ -1,83 +1,3 @@
1
- // src/core/query-builder.ts
2
- class QueryBuilder {
3
- spec;
4
- predicates = [];
5
- constructor(spec) {
6
- this.spec = spec;
7
- }
8
- byKind(...kinds) {
9
- if (kinds.length > 0) {
10
- this.predicates.push((exp) => kinds.includes(exp.kind));
11
- }
12
- return this;
13
- }
14
- byName(pattern) {
15
- if (typeof pattern === "string") {
16
- this.predicates.push((exp) => exp.name === pattern);
17
- } else {
18
- this.predicates.push((exp) => pattern.test(exp.name));
19
- }
20
- return this;
21
- }
22
- byTag(...tags) {
23
- if (tags.length > 0) {
24
- this.predicates.push((exp) => {
25
- const expTags = exp.tags?.map((t) => t.name) ?? [];
26
- return tags.some((tag) => expTags.includes(tag));
27
- });
28
- }
29
- return this;
30
- }
31
- deprecated(include) {
32
- if (include !== undefined) {
33
- this.predicates.push((exp) => (exp.deprecated ?? false) === include);
34
- }
35
- return this;
36
- }
37
- withDescription() {
38
- this.predicates.push((exp) => Boolean(exp.description?.trim()));
39
- return this;
40
- }
41
- search(term) {
42
- const lower = term.toLowerCase();
43
- this.predicates.push((exp) => exp.name.toLowerCase().includes(lower) || (exp.description?.toLowerCase().includes(lower) ?? false));
44
- return this;
45
- }
46
- where(predicate) {
47
- this.predicates.push(predicate);
48
- return this;
49
- }
50
- byModule(modulePath) {
51
- this.predicates.push((exp) => exp.source?.file?.includes(modulePath) ?? false);
52
- return this;
53
- }
54
- matches(exp) {
55
- return this.predicates.every((p) => p(exp));
56
- }
57
- find() {
58
- return this.spec.exports.filter((exp) => this.matches(exp));
59
- }
60
- first() {
61
- return this.spec.exports.find((exp) => this.matches(exp));
62
- }
63
- count() {
64
- return this.spec.exports.filter((exp) => this.matches(exp)).length;
65
- }
66
- ids() {
67
- return this.find().map((exp) => exp.id);
68
- }
69
- toSpec() {
70
- return {
71
- ...this.spec,
72
- exports: this.find(),
73
- types: this.spec.types ? [...this.spec.types] : undefined
74
- };
75
- }
76
- }
77
- function query(spec) {
78
- return new QueryBuilder(spec);
79
- }
80
-
81
1
  // src/core/diagnostics.ts
82
2
  function hasDeprecatedTag(exp) {
83
3
  if (exp.deprecated === true)
@@ -549,4 +469,84 @@ function toSearchIndexJSON(spec, options = {}) {
549
469
  return options.pretty ? JSON.stringify(index, null, 2) : JSON.stringify(index);
550
470
  }
551
471
 
552
- export { QueryBuilder, query, hasDeprecatedTag, getDeprecationMessage, findMissingParamDocs, analyzeSpec, getMemberBadges, formatBadges, formatSchema, formatTypeParameters, formatParameters, formatReturnType, buildSignatureString, resolveTypeRef, isMethod, isProperty, getMethods, getProperties, groupByVisibility, sortByName, formatConditionalType, formatMappedType, toSearchIndex, toPagefindRecords, toAlgoliaRecords, toSearchIndexJSON };
472
+ // src/core/query-builder.ts
473
+ class QueryBuilder {
474
+ spec;
475
+ predicates = [];
476
+ constructor(spec) {
477
+ this.spec = spec;
478
+ }
479
+ byKind(...kinds) {
480
+ if (kinds.length > 0) {
481
+ this.predicates.push((exp) => kinds.includes(exp.kind));
482
+ }
483
+ return this;
484
+ }
485
+ byName(pattern) {
486
+ if (typeof pattern === "string") {
487
+ this.predicates.push((exp) => exp.name === pattern);
488
+ } else {
489
+ this.predicates.push((exp) => pattern.test(exp.name));
490
+ }
491
+ return this;
492
+ }
493
+ byTag(...tags) {
494
+ if (tags.length > 0) {
495
+ this.predicates.push((exp) => {
496
+ const expTags = exp.tags?.map((t) => t.name) ?? [];
497
+ return tags.some((tag) => expTags.includes(tag));
498
+ });
499
+ }
500
+ return this;
501
+ }
502
+ deprecated(include) {
503
+ if (include !== undefined) {
504
+ this.predicates.push((exp) => (exp.deprecated ?? false) === include);
505
+ }
506
+ return this;
507
+ }
508
+ withDescription() {
509
+ this.predicates.push((exp) => Boolean(exp.description?.trim()));
510
+ return this;
511
+ }
512
+ search(term) {
513
+ const lower = term.toLowerCase();
514
+ this.predicates.push((exp) => exp.name.toLowerCase().includes(lower) || (exp.description?.toLowerCase().includes(lower) ?? false));
515
+ return this;
516
+ }
517
+ where(predicate) {
518
+ this.predicates.push(predicate);
519
+ return this;
520
+ }
521
+ byModule(modulePath) {
522
+ this.predicates.push((exp) => exp.source?.file?.includes(modulePath) ?? false);
523
+ return this;
524
+ }
525
+ matches(exp) {
526
+ return this.predicates.every((p) => p(exp));
527
+ }
528
+ find() {
529
+ return this.spec.exports.filter((exp) => this.matches(exp));
530
+ }
531
+ first() {
532
+ return this.spec.exports.find((exp) => this.matches(exp));
533
+ }
534
+ count() {
535
+ return this.spec.exports.filter((exp) => this.matches(exp)).length;
536
+ }
537
+ ids() {
538
+ return this.find().map((exp) => exp.id);
539
+ }
540
+ toSpec() {
541
+ return {
542
+ ...this.spec,
543
+ exports: this.find(),
544
+ types: this.spec.types ? [...this.spec.types] : undefined
545
+ };
546
+ }
547
+ }
548
+ function query(spec) {
549
+ return new QueryBuilder(spec);
550
+ }
551
+
552
+ export { hasDeprecatedTag, getDeprecationMessage, findMissingParamDocs, analyzeSpec, getMemberBadges, formatBadges, formatSchema, formatTypeParameters, formatParameters, formatReturnType, buildSignatureString, resolveTypeRef, isMethod, isProperty, getMethods, getProperties, groupByVisibility, sortByName, formatConditionalType, formatMappedType, toSearchIndex, toPagefindRecords, toAlgoliaRecords, toSearchIndexJSON, QueryBuilder, query };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpkg-ts/sdk",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "TypeScript API extraction SDK - programmatic primitives for OpenPkg specs",
5
5
  "keywords": [
6
6
  "openpkg",
@@ -42,7 +42,7 @@
42
42
  "test": "bun test"
43
43
  },
44
44
  "dependencies": {
45
- "@openpkg-ts/spec": "^0.33.0",
45
+ "@openpkg-ts/spec": "^0.34.1",
46
46
  "picomatch": "4.0.3",
47
47
  "typescript": "^5.0.0"
48
48
  },
@@ -57,7 +57,7 @@
57
57
  "devDependencies": {
58
58
  "@types/bun": "latest",
59
59
  "@types/node": "^20.0.0",
60
- "bunup": "latest"
60
+ "bunup": "^0.16.20"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"