@pkmn/dex 0.6.4 → 0.7.1

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 CHANGED
@@ -64,7 +64,7 @@ The most important breaking change is that **`learnsets` have been made `async`*
64
64
  been changed to be more generally useful. In [an ideal api](#limitations) we wouldn't fetch data
65
65
  we don't need during startup, but to maximize compatibility with Pokémon Showdown only the
66
66
  `getLearnsets` method call from `Dex` has been made async. Compressed, all of the data files without
67
- learnsets to ~287KB, while **`data/learnsets.json` takes up ~384KB just on its own**. Only loading
67
+ learnsets to ~344KB, while **`data/learnsets.json` takes up ~475KB just on its own**. Only loading
68
68
  this data on demand helps make the loading experience more reasonable given the constraints of this
69
69
  package.
70
70
 
@@ -89,7 +89,7 @@ import {Generations} from '@pkmn/data';
89
89
 
90
90
  const gens = new Generations(Dex);
91
91
  assert(gens.get(1).types.get('Ghost').effectiveness['Psychic'] === 0);
92
- assert(gens.get(8).types.totalEffectiveness('Dark', ['Ghost', 'Psychic']) === 4);
92
+ assert(gens.get(9).types.totalEffectiveness('Dark', ['Ghost', 'Psychic']) === 4);
93
93
  assert(gens.get(5).species.get('Dragapult') === undefined);
94
94
  assert(gens.get(3).species.get('Chansey').prevo === undefined);
95
95
  assert(Array.from(gens.get(1).species).length === 151);
@@ -110,14 +110,14 @@ eventually fully bridge the gap ("`@pkmn/data` - what Pokémon Showdown's data l
110
110
  The recommended way of using `@pkmn/dex` in a web browser is to **configure your bundler**
111
111
  ([Webpack](https://webpack.js.org/), [Rollup](https://rollupjs.org/),
112
112
  [Parcel](https://parceljs.org/), etc) to minimize it and package it with the rest of your
113
- application. If you do not use a bundler, a convenience `production.min.js` is included in the
114
- package. You simply need to depend on `./node_modules/@pkmn/dex/build/production.min.js` in a
115
- `script` tag (which is what the unpkg shortcut above is doing), after which **`Dex` will be
113
+ application. If you do not use a bundler, a convenience `index.min.js` is included in the
114
+ package. You simply need to depend on `./node_modules/@pkmn/dex/build/index.min.js` in a
115
+ `script` tag (which is what the unpkg shortcut above is doing), after which **`pkmn.dex` will be
116
116
  accessible as a global.**
117
117
 
118
118
  `Dex#getLearnsets` does not play nicely in the browser because it is an asynchronous API. As such,
119
119
  you must first depend on `./node_modules/@pkmn/dex/build/learnsets.min.js` which makes
120
- **`DexLearnsets` accessible as a global** before calling `Dex#getLearnsets`. If you are using
120
+ **`pkmn.learnsets` accessible as a global** before calling `Dex#getLearnsets`. If you are using
121
121
  `unpkg` this looks like:
122
122
 
123
123
  ```html
@@ -126,8 +126,8 @@ you must first depend on `./node_modules/@pkmn/dex/build/learnsets.min.js` which
126
126
  ```
127
127
 
128
128
  Note that `unpkg.com/@pkmn/dex` is configured to point at
129
- `unpkg.com/@pkmn/dex/build/production.min.js` already. The ordering of the `<script>` tags does not
130
- matter as long as the `learnsets.min.js` script has loaded and populated the `DexLearnsets` global
129
+ `unpkg.com/@pkmn/dex/build/index.min.js` already. The ordering of the `<script>` tags does not
130
+ matter as long as the `learnsets.min.js` script has loaded and populated the `pkmn.learnsets` global
131
131
  before `Dex#getLearnsets` is called.
132
132
 
133
133
  ## Limitations
@@ -0,0 +1,10 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
10
+ //# sourceMappingURL=chunk-5VRACIDE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+
8
+
9
+ exports.__export = __export;
10
+ //# sourceMappingURL=chunk-JC4IRQUL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
package/build/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import * as T from '@pkmn/dex-types';
2
- export declare function toID(text: any): T.ID;
3
- export interface FormatData {
2
+ export { AbilityData, AbilityName, As, BoostID, BoostsTable, ConditionData, Data, DataKind, Effect, EffectData, EffectType, EggGroup, EventInfo, EventInfoData, EvoType, FieldCondition, FormeName, GameType, GenID, GenderName, GenerationNum, HPColor, HPTypeName, HitEffect, ID, ItemData, ItemName, LearnsetData, MoveCategory, MoveData, MoveName, MoveSource, MoveTarget, NatureData, NatureName, Nonstandard, Player, PokemonSet, SecondaryEffect, SideCondition, SideID, SpeciesData, SpeciesName, StatID, StatsTable, StatusName, Tier, TypeData, TypeName, Weather } from '@pkmn/dex-types';
3
+
4
+ declare function toID(text: any): T.ID;
5
+ interface FormatData {
4
6
  tier?: string;
5
7
  doublesTier?: string;
6
8
  isNonstandard?: T.Nonstandard;
@@ -9,7 +11,7 @@ export interface FormatData {
9
11
  interface AnyObject {
10
12
  [k: string]: any;
11
13
  }
12
- export declare class BasicEffect<NameT extends string = string> implements T.BasicEffect<NameT> {
14
+ declare class BasicEffect<NameT extends string = string> implements T.BasicEffect<NameT> {
13
15
  id: T.ID;
14
16
  name: NameT;
15
17
  fullname: string;
@@ -25,8 +27,8 @@ export declare class BasicEffect<NameT extends string = string> implements T.Bas
25
27
  constructor(data: AnyObject);
26
28
  toString(): NameT;
27
29
  }
28
- export declare class Condition extends BasicEffect implements T.Condition {
29
- readonly effectType: 'Condition' | 'Weather' | 'Status';
30
+ declare class Condition extends BasicEffect implements T.Condition {
31
+ readonly effectType: 'Condition' | 'Weather' | 'Status' | 'Terastal';
30
32
  readonly kind: 'Condition';
31
33
  constructor(data: AnyObject);
32
34
  }
@@ -39,7 +41,7 @@ declare class DexConditions implements T.DexTable<Condition> {
39
41
  get(name: string): Condition;
40
42
  getByID(id: T.ID): Condition;
41
43
  }
42
- export declare class Ability extends BasicEffect<T.AbilityName> implements T.Ability {
44
+ declare class Ability extends BasicEffect<T.AbilityName> implements T.Ability {
43
45
  readonly effectType: 'Ability';
44
46
  readonly kind: 'Ability';
45
47
  readonly isBreakable?: boolean;
@@ -60,7 +62,7 @@ declare class DexAbilities implements T.DexTable<Ability> {
60
62
  getByID(id: T.ID): Ability;
61
63
  all(): readonly Ability[];
62
64
  }
63
- export declare class Item extends BasicEffect<T.ItemName> implements T.Item {
65
+ declare class Item extends BasicEffect<T.ItemName> implements T.Item {
64
66
  readonly effectType: 'Item';
65
67
  readonly kind: 'Item';
66
68
  readonly forcedForme?: T.SpeciesName;
@@ -100,7 +102,7 @@ declare class DexItems implements T.DexTable<Item> {
100
102
  getByID(id: T.ID): Item;
101
103
  all(): readonly Item[];
102
104
  }
103
- export declare class Move extends BasicEffect<T.MoveName> implements T.Move {
105
+ declare class Move extends BasicEffect<T.MoveName> implements T.Move {
104
106
  readonly effectType: 'Move';
105
107
  readonly kind: 'Move';
106
108
  readonly boosts?: Partial<T.BoostsTable>;
@@ -136,7 +138,7 @@ export declare class Move extends BasicEffect<T.MoveName> implements T.Move {
136
138
  readonly thawsTarget?: boolean;
137
139
  readonly heal?: number[] | null;
138
140
  readonly forceSwitch?: boolean;
139
- readonly selfSwitch?: boolean | 'copyvolatile';
141
+ readonly selfSwitch?: 'copyvolatile' | 'shedtail' | boolean;
140
142
  readonly selfBoost?: {
141
143
  boosts?: Partial<T.BoostsTable>;
142
144
  };
@@ -204,7 +206,7 @@ declare class DexMoves implements T.DexTable<Move> {
204
206
  getByID(id: T.ID): Move;
205
207
  all(): readonly Move[];
206
208
  }
207
- export declare class Nature extends BasicEffect<T.NatureName> implements T.Nature {
209
+ declare class Nature extends BasicEffect<T.NatureName> implements T.Nature {
208
210
  readonly effectType: 'Nature';
209
211
  readonly kind: 'Nature';
210
212
  readonly plus?: Exclude<T.StatID, 'hp'>;
@@ -224,7 +226,7 @@ declare class DexNatures implements T.DexTable<Nature> {
224
226
  getByID(id: T.ID): Nature;
225
227
  all(): readonly Nature[];
226
228
  }
227
- export declare class Species extends BasicEffect<T.SpeciesName> implements T.Species {
229
+ declare class Species extends BasicEffect<T.SpeciesName> implements T.Species {
228
230
  readonly effectType: 'Pokemon';
229
231
  readonly kind: 'Species';
230
232
  readonly baseStats: T.StatsTable;
@@ -287,7 +289,7 @@ declare class DexSpecies implements T.DexTable<Species> {
287
289
  getByID(id: T.ID): Species;
288
290
  all(): readonly Species[];
289
291
  }
290
- export declare class Learnset implements T.Learnset {
292
+ declare class Learnset implements T.Learnset {
291
293
  readonly effectType: 'Learnset';
292
294
  readonly kind: 'Learnset';
293
295
  readonly learnset?: {
@@ -308,7 +310,7 @@ declare class DexLearnsets {
308
310
  get(name: string): Promise<Learnset>;
309
311
  getByID(id: T.ID): Promise<Learnset>;
310
312
  }
311
- export declare class Type implements T.Type {
313
+ declare class Type implements T.Type {
312
314
  readonly id: T.ID;
313
315
  readonly name: T.TypeName;
314
316
  readonly effectType: 'Type';
@@ -356,10 +358,10 @@ declare class DexStats {
356
358
  constructor(dex: ModdedDex);
357
359
  ids(): typeof STATS;
358
360
  }
359
- declare const GEN_IDS: readonly ["gen1", "gen2", "gen3", "gen4", "gen5", "gen6", "gen7", "gen8"];
360
- declare type GenID = typeof GEN_IDS[number];
361
- export declare type ModData = T.DeepPartial<ModdedDex['data']> & T.ModData;
362
- export declare class ModdedDex implements T.Dex {
361
+ declare const GEN_IDS: readonly ["gen1", "gen2", "gen3", "gen4", "gen5", "gen6", "gen7", "gen8", "gen9"];
362
+ type GenID = typeof GEN_IDS[number];
363
+ type ModData = T.DeepPartial<ModdedDex['data']> & T.ModData;
364
+ declare class ModdedDex implements T.Dex {
363
365
  static readonly STATS: ReadonlyArray<T.StatID>;
364
366
  readonly gen: T.GenerationNum;
365
367
  readonly modid: T.ID;
@@ -405,7 +407,7 @@ export declare class ModdedDex implements T.Dex {
405
407
  readonly stats: DexStats;
406
408
  readonly types: DexTypes;
407
409
  modData?: ModData;
408
- constructor(modid?: T.ID | "gen1" | "gen2" | "gen3" | "gen4" | "gen5" | "gen6" | "gen7" | "gen8", modData?: ModData);
410
+ constructor(modid?: T.ID | "gen1" | "gen2" | "gen3" | "gen4" | "gen5" | "gen6" | "gen7" | "gen8" | "gen9", modData?: ModData);
409
411
  mod(genid: GenID): ModdedDex;
410
412
  mod(modid: T.ID, modData: ModData): ModdedDex;
411
413
  forGen(gen: number): ModdedDex;
@@ -464,5 +466,6 @@ export declare class ModdedDex implements T.Dex {
464
466
  };
465
467
  load(type: Exclude<keyof ModdedDex['data'], 'Aliases'>, modData?: ModData): void;
466
468
  }
467
- export declare const Dex: ModdedDex;
468
- export { ID, As, Weather, FieldCondition, SideCondition, GenerationNum, GenderName, StatID, StatsTable, BoostID, BoostsTable, MoveCategory, MoveTarget, Nonstandard, EvoType, EggGroup, SideID, Player, GameType, HPColor, StatusName, NatureName, TypeName, HPTypeName, Tier, PokemonSet, AbilityName, ItemName, MoveName, SpeciesName, FormeName, EffectType, Effect, DataKind, Data, EffectData, HitEffect, SecondaryEffect, ConditionData, AbilityData, ItemData, MoveData, SpeciesData, MoveSource, EventInfoData, LearnsetData, TypeData, NatureData, EventInfo, GenID, } from '@pkmn/dex-types';
469
+ declare const Dex: ModdedDex;
470
+
471
+ export { Ability, BasicEffect, Condition, Dex, FormatData, Item, Learnset, ModData, ModdedDex, Move, Nature, Species, Type, toID };