fix namespace conflicts

This commit is contained in:
Jeff Colombo 2019-03-19 02:02:10 -04:00
parent 0d7fbab223
commit c5f36e553f
24 changed files with 3598 additions and 3603 deletions

View File

@ -1,5 +1,10 @@
import * as $protobuf from "protobufjs"; import * as $protobuf from "protobufjs";
export namespace POGOProtos { export = PVPokemon;
declare namespace PVPokemon {
namespace POGOProtos {
namespace Enums { namespace Enums {
@ -1177,3 +1182,4 @@ export namespace POGOProtos {
} }
} }
} }
}

View File

@ -1,29 +1,20 @@
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ /*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
(function(global, factory) { /* global define, require, module */ import * as $protobuf from "protobufjs/minimal";
/* AMD */ if (typeof define === 'function' && define.amd)
define(["protobufjs/minimal"], factory);
/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("protobufjs/minimal"));
})(this, function($protobuf) {
"use strict";
// Common aliases // Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace // Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); const $root = $protobuf.roots.PVPokemon || ($protobuf.roots.PVPokemon = {});
$root.POGOProtos = (function() { export const POGOProtos = $root.POGOProtos = (() => {
/** /**
* Namespace POGOProtos. * Namespace POGOProtos.
* @exports POGOProtos * @exports POGOProtos
* @namespace * @namespace
*/ */
var POGOProtos = {}; const POGOProtos = {};
POGOProtos.Enums = (function() { POGOProtos.Enums = (function() {
@ -32,7 +23,7 @@
* @memberof POGOProtos * @memberof POGOProtos
* @namespace * @namespace
*/ */
var Enums = {}; const Enums = {};
/** /**
* Form enum. * Form enum.
@ -173,7 +164,7 @@
* @property {number} SPINDA_19=132 SPINDA_19 value * @property {number} SPINDA_19=132 SPINDA_19 value
*/ */
Enums.Form = (function() { Enums.Form = (function() {
var valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "FORM_UNSET"] = 0; values[valuesById[0] = "FORM_UNSET"] = 0;
values[valuesById[1] = "UNOWN_A"] = 1; values[valuesById[1] = "UNOWN_A"] = 1;
values[valuesById[2] = "UNOWN_B"] = 2; values[valuesById[2] = "UNOWN_B"] = 2;
@ -568,7 +559,7 @@
* @property {number} FAMILY_MELTAN=808 FAMILY_MELTAN value * @property {number} FAMILY_MELTAN=808 FAMILY_MELTAN value
*/ */
Enums.PokemonFamilyId = (function() { Enums.PokemonFamilyId = (function() {
var valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "FAMILY_UNSET"] = 0; values[valuesById[0] = "FAMILY_UNSET"] = 0;
values[valuesById[1] = "FAMILY_BULBASAUR"] = 1; values[valuesById[1] = "FAMILY_BULBASAUR"] = 1;
values[valuesById[4] = "FAMILY_CHARMANDER"] = 4; values[valuesById[4] = "FAMILY_CHARMANDER"] = 4;
@ -1326,7 +1317,7 @@
* @property {number} MELMETAL=809 MELMETAL value * @property {number} MELMETAL=809 MELMETAL value
*/ */
Enums.PokemonId = (function() { Enums.PokemonId = (function() {
var valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "MISSINGNO"] = 0; values[valuesById[0] = "MISSINGNO"] = 0;
values[valuesById[1] = "BULBASAUR"] = 1; values[valuesById[1] = "BULBASAUR"] = 1;
values[valuesById[2] = "IVYSAUR"] = 2; values[valuesById[2] = "IVYSAUR"] = 2;
@ -2090,7 +2081,7 @@
* @property {number} POWER_UP_PUNCH=319 POWER_UP_PUNCH value * @property {number} POWER_UP_PUNCH=319 POWER_UP_PUNCH value
*/ */
Enums.PokemonMove = (function() { Enums.PokemonMove = (function() {
var valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "MOVE_UNSET"] = 0; values[valuesById[0] = "MOVE_UNSET"] = 0;
values[valuesById[1] = "THUNDER_SHOCK"] = 1; values[valuesById[1] = "THUNDER_SHOCK"] = 1;
values[valuesById[2] = "QUICK_ATTACK"] = 2; values[valuesById[2] = "QUICK_ATTACK"] = 2;
@ -2377,7 +2368,7 @@
* @property {number} POKEMON_TYPE_FAIRY=18 POKEMON_TYPE_FAIRY value * @property {number} POKEMON_TYPE_FAIRY=18 POKEMON_TYPE_FAIRY value
*/ */
Enums.PokemonType = (function() { Enums.PokemonType = (function() {
var valuesById = {}, values = Object.create(valuesById); const valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "POKEMON_TYPE_NONE"] = 0; values[valuesById[0] = "POKEMON_TYPE_NONE"] = 0;
values[valuesById[1] = "POKEMON_TYPE_NORMAL"] = 1; values[valuesById[1] = "POKEMON_TYPE_NORMAL"] = 1;
values[valuesById[2] = "POKEMON_TYPE_FIGHTING"] = 2; values[valuesById[2] = "POKEMON_TYPE_FIGHTING"] = 2;
@ -2406,5 +2397,4 @@
return POGOProtos; return POGOProtos;
})(); })();
return $root; export { $root as default };
});

View File

@ -11,8 +11,8 @@
"tsnode": "node -r ts-node/register -r tsconfig-paths/register", "tsnode": "node -r ts-node/register -r tsconfig-paths/register",
"generate": "node_modules/.bin/run-s protobuf pbjs pbts pokemondata", "generate": "node_modules/.bin/run-s protobuf pbjs pbts pokemondata",
"protobuf": "yarn tsnode ./src/scripts/generatePogoProtocolBuffer.ts PokemonId.proto Form.proto PokemonMove.proto PokemonFamilyId.proto PokemonType.proto", "protobuf": "yarn tsnode ./src/scripts/generatePogoProtocolBuffer.ts PokemonId.proto Form.proto PokemonMove.proto PokemonFamilyId.proto PokemonType.proto",
"pbjs": "node_modules/.bin/pbjs --keep-case -t static-module --no-verify --no-create --no-delimited -o ./externals/generated/PvPogoProtos.js ./externals/generated/POGOProtos.generated.proto", "pbjs": "node_modules/.bin/pbjs --keep-case -t static-module --no-verify --no-create --no-delimited -w es6 -r PVPokemon -o ./externals/generated/PVPogoProtos.js ./externals/generated/POGOProtos.generated.proto",
"pbts": "node_modules/.bin/pbts --no-comments -o ./externals/generated/PvPogoProtos.d.ts ./externals/generated/PvPogoProtos.js", "pbts": "node_modules/.bin/pbts --no-comments -n PVPokemon -o ./externals/generated/PVPogoProtos.d.ts ./externals/generated/PVPogoProtos.js",
"pokemondata": "yarn tsnode ./src/scripts/generatePokemonData.ts" "pokemondata": "yarn tsnode ./src/scripts/generatePokemonData.ts"
}, },
"devDependencies": { "devDependencies": {

View File

@ -9,7 +9,7 @@ import { ILeaguePokemonJson } from 'api/PokemonService';
import { ILeaguePokemon, League, MaxCpByLeague } from 'app/models/League'; import { ILeaguePokemon, League, MaxCpByLeague } from 'app/models/League';
import { Grade, IMaxStats, IStats } from 'app/models/Pokemon'; import { Grade, IMaxStats, IStats } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
type ICpAndTotalFound = Record<number, Array<IStats>>; type ICpAndTotalFound = Record<number, Array<IStats>>;
interface IStatsDistribution { interface IStatsDistribution {

View File

@ -1,12 +1,13 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import POGOProtos from 'pogo-protos';
import { ApiService } from 'api/ApiService'; import { ApiService } from 'api/ApiService';
import { CombatMoveStats, IBaseStatsRank, IPokemon, TypeEffectiveness, TypeOrder } from 'app/models/Pokemon'; import { CombatMoveStats, IBaseStatsRank, IPokemon, TypeEffectiveness, TypeOrder } from 'app/models/Pokemon';
import { LegacyMoves } from 'common/models/LegacyMoves'; import { LegacyMoves } from 'common/models/LegacyMoves';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
interface ICalculateRelativeStats { interface ICalculateRelativeStats {
id : PVPogoProtos.PokemonId; id : PVPogoProtos.PokemonId;
@ -15,8 +16,6 @@ interface ICalculateRelativeStats {
} }
export const parseGameMaster = async () => { export const parseGameMaster = async () => {
const POGOProtos = await import('pogo-protos');
const apiService = new ApiService(); const apiService = new ApiService();
const pokemonDataByPokemonId : Map<PVPogoProtos.PokemonId, Array<IPokemon>> = new Map(); const pokemonDataByPokemonId : Map<PVPogoProtos.PokemonId, Array<IPokemon>> = new Map();
const pokemonFormsByPokemonId : Map<PVPogoProtos.PokemonId, Array<PVPogoProtos.PokemonForm>> = new Map(); const pokemonFormsByPokemonId : Map<PVPogoProtos.PokemonId, Array<PVPogoProtos.PokemonForm>> = new Map();

View File

@ -5,7 +5,7 @@ import { AjaxRequest } from 'api/AjaxRequest';
import { DEFAULT_POKEMON_NAME, IPokemonSpecies } from 'app/models/Pokemon'; import { DEFAULT_POKEMON_NAME, IPokemonSpecies } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
interface IPokeApiSpeciesNameJSON { interface IPokeApiSpeciesNameJSON {
pokemon_species_id : string; pokemon_species_id : string;

View File

@ -4,7 +4,7 @@ import { AttackTypeEffectivenessSerializingTuple, IConfig, IConfigJson } from 'a
import { ILeaguePokemon } from 'app/models/League'; import { ILeaguePokemon } from 'app/models/League';
import { IPokemon, TypeEffectiveness } from 'app/models/Pokemon'; import { IPokemon, TypeEffectiveness } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export interface ILeaguePokemonJson extends Omit<ILeaguePokemon, 'effectiveness'> { export interface ILeaguePokemonJson extends Omit<ILeaguePokemon, 'effectiveness'> {

View File

@ -18,7 +18,7 @@ import { Header } from 'app/components/Header';
import { ConnectedPokemonExplorer } from 'app/components/PokemonExplorer/PokemonExplorer'; import { ConnectedPokemonExplorer } from 'app/components/PokemonExplorer/PokemonExplorer';
import { PokemonSelectList } from 'app/components/PokemonSelectList/PokemonSelectList'; import { PokemonSelectList } from 'app/components/PokemonSelectList/PokemonSelectList';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/styles/PokemonApp.scss'; import * as styles from 'app/styles/PokemonApp.scss';

View File

@ -7,7 +7,7 @@ import classNames from 'classnames';
import { IIndividualValues } from 'app/components/PokemonExplorer/types'; import { IIndividualValues } from 'app/components/PokemonExplorer/types';
import { Grade, IStats } from 'app/models/Pokemon'; import { Grade, IStats } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/LeagueStatsList.scss'; import * as styles from 'app/components/PokemonExplorer/styles/LeagueStatsList.scss';

View File

@ -11,7 +11,7 @@ import { TypeIndicator, TypeTheme } from './TypeIndicator';
import { formatType } from 'app/utils/formatter'; import { formatType } from 'app/utils/formatter';
import { getMoveType } from 'app/utils/types'; import { getMoveType } from 'app/utils/types';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/MovesDropdown.scss'; import * as styles from 'app/components/PokemonExplorer/styles/MovesDropdown.scss';

View File

@ -12,7 +12,7 @@ import { EffectivenessMode, TypeEffectiveDisplay } from './TypeEffectiveDisplay'
import { calculateTypeCoverage } from 'app/utils/types'; import { calculateTypeCoverage } from 'app/utils/types';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/MovesExplorer.scss'; import * as styles from 'app/components/PokemonExplorer/styles/MovesExplorer.scss';

View File

@ -9,7 +9,7 @@ import { formatDexNumber, formatForm, Forms } from 'app/utils/formatter';
import { StatDisplay } from './StatDisplay'; import { StatDisplay } from './StatDisplay';
import { TypeIndicator, TypeTheme } from './TypeIndicator'; import { TypeIndicator, TypeTheme } from './TypeIndicator';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/PokemonDisplay.scss'; import * as styles from 'app/components/PokemonExplorer/styles/PokemonDisplay.scss';

View File

@ -26,7 +26,7 @@ import { EffectivenessMode, TypeEffectiveDisplay } from 'app/components/PokemonE
import { appendQueryString } from 'app/utils/navigation'; import { appendQueryString } from 'app/utils/navigation';
import { calculateTypeCoverage } from 'app/utils/types'; import { calculateTypeCoverage } from 'app/utils/types';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/styles/PokemonApp.scss'; import * as styles from 'app/styles/PokemonApp.scss';

View File

@ -6,7 +6,7 @@ import { IPokemon, TypeEffectiveness } from 'app/models/Pokemon';
import { TypeIndicator, TypeTheme } from './TypeIndicator'; import { TypeIndicator, TypeTheme } from './TypeIndicator';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/TypeEffectiveDisplay.scss'; import * as styles from 'app/components/PokemonExplorer/styles/TypeEffectiveDisplay.scss';

View File

@ -4,7 +4,7 @@ import classNames from 'classnames';
import { formatType } from 'app/utils/formatter'; import { formatType } from 'app/utils/formatter';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from 'app/components/PokemonExplorer/styles/TypeIndicator.scss'; import * as styles from 'app/components/PokemonExplorer/styles/TypeIndicator.scss';

View File

@ -10,7 +10,7 @@ import { appendQueryString } from 'app/utils/navigation';
import { DEFAULT_POKEMON_NAME, IPokemon } from 'app/models/Pokemon'; import { DEFAULT_POKEMON_NAME, IPokemon } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
import * as styles from './styles/PokemonSelectList.scss'; import * as styles from './styles/PokemonSelectList.scss';

View File

@ -6,7 +6,7 @@ import { IPokemon } from 'app/models/Pokemon';
import { ThunkResult } from 'app/types'; import { ThunkResult } from 'app/types';
import { PokemonSelectListActionTypes } from './types'; import { PokemonSelectListActionTypes } from './types';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
export const setIsLoading = (isLoading : boolean) => action(PokemonSelectListActionTypes.SET_IS_LOADING, { isLoading }); export const setIsLoading = (isLoading : boolean) => action(PokemonSelectListActionTypes.SET_IS_LOADING, { isLoading });

View File

@ -1,7 +1,7 @@
import { ILeaguePokemon } from 'app/models/League'; import { ILeaguePokemon } from 'app/models/League';
import { IPokemon } from 'app/models/Pokemon'; import { IPokemon } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
export interface IPokemonSelectListState { export interface IPokemonSelectListState {
isLoading : boolean; isLoading : boolean;

View File

@ -1,6 +1,6 @@
import { CombatMoveStats, ICombatMoveStats, IMaxStats, TypeEffectiveness } from 'app/models/Pokemon'; import { CombatMoveStats, ICombatMoveStats, IMaxStats, TypeEffectiveness } from 'app/models/Pokemon';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
type TypeEffectivenessByTypeJson = Array<[PVPogoProtos.PokemonType, TypeEffectiveness]>; type TypeEffectivenessByTypeJson = Array<[PVPogoProtos.PokemonType, TypeEffectiveness]>;
type AttackTypeEffectivenessJson = Array<[PVPogoProtos.PokemonType, TypeEffectivenessByTypeJson]>; type AttackTypeEffectivenessJson = Array<[PVPogoProtos.PokemonType, TypeEffectivenessByTypeJson]>;

View File

@ -1,4 +1,4 @@
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
export const DEFAULT_POKEMON_NAME = 'MissingNo.'; export const DEFAULT_POKEMON_NAME = 'MissingNo.';

View File

@ -1,4 +1,4 @@
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
export const formatDexNumber = (dex : number) => { export const formatDexNumber = (dex : number) => {
let prefix : string = ''; let prefix : string = '';

View File

@ -3,7 +3,7 @@ import { CombatMoveStats, ICombatMoveStats, IPokemonMove, TypeEffectiveness } fr
import { SelectedCombatMoves } from 'app/components/PokemonExplorer/types'; import { SelectedCombatMoves } from 'app/components/PokemonExplorer/types';
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
export const calculateTypeCoverage = ( export const calculateTypeCoverage = (
selectedMoves : SelectedCombatMoves, selectedMoves : SelectedCombatMoves,

View File

@ -1,4 +1,4 @@
import * as PVPogoProtos from 'common/models/PvPogoProtos'; import * as PVPogoProtos from 'common/models/PVPogoProtos';
interface ILegacyMoves { interface ILegacyMoves {
quick_moves : Array<PVPogoProtos.PokemonMove>; quick_moves : Array<PVPogoProtos.PokemonMove>;

View File

@ -1,19 +1,19 @@
import { POGOProtos } from 'externals/generated/PvPogoProtos'; import * as PVPogoProtos from 'externals/generated/PVPogoProtos';
export const PokemonId = POGOProtos.Enums.PokemonId; export const PokemonId = PVPogoProtos.POGOProtos.Enums.PokemonId;
export type PokemonId = POGOProtos.Enums.PokemonId; export type PokemonId = PVPogoProtos.POGOProtos.Enums.PokemonId;
export const PokemonMove = POGOProtos.Enums.PokemonMove; export const PokemonMove = PVPogoProtos.POGOProtos.Enums.PokemonMove;
export type PokemonMove = POGOProtos.Enums.PokemonMove; export type PokemonMove = PVPogoProtos.POGOProtos.Enums.PokemonMove;
export const PokemonFamilyId = POGOProtos.Enums.PokemonFamilyId; export const PokemonFamilyId = PVPogoProtos.POGOProtos.Enums.PokemonFamilyId;
export type PokemonFamilyId = POGOProtos.Enums.PokemonFamilyId; export type PokemonFamilyId = PVPogoProtos.POGOProtos.Enums.PokemonFamilyId;
export const PokemonType = POGOProtos.Enums.PokemonType; export const PokemonType = PVPogoProtos.POGOProtos.Enums.PokemonType;
export type PokemonType = POGOProtos.Enums.PokemonType; export type PokemonType = PVPogoProtos.POGOProtos.Enums.PokemonType;
export const PokemonForm = POGOProtos.Enums.Form; export const PokemonForm = PVPogoProtos.POGOProtos.Enums.Form;
export type PokemonForm = POGOProtos.Enums.Form; export type PokemonForm = PVPogoProtos.POGOProtos.Enums.Form;
// this worked, until i realized that i needed to access the values of the enums and not just the types // this worked, until i realized that i needed to access the values of the enums and not just the types
// export declare const PokemonId : import('pogo-protos').Enums.PokemonId; // export declare const PokemonId : import('pogo-protos').Enums.PokemonId;