@sprucelabs/spruce-cli 20.0.0 → 20.0.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js +2 -1
  3. package/build/__tests__/behavioral/EnablingAndDisablingCache.test.js.map +1 -1
  4. package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js +1 -1
  5. package/build/__tests__/behavioral/upgrading/UpgradingASkill5.test.js.map +1 -1
  6. package/build/__tests__/behavioral/views/CreatingASkillView.test.js +1 -1
  7. package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
  8. package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.d.ts +4 -0
  9. package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js +95 -17
  10. package/build/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.js.map +1 -1
  11. package/build/__tests__/implementation/EventCacheService.test.d.ts +4 -0
  12. package/build/__tests__/implementation/EventCacheService.test.js +84 -0
  13. package/build/__tests__/implementation/EventCacheService.test.js.map +1 -0
  14. package/build/errors/SpruceError.js +2 -2
  15. package/build/errors/SpruceError.js.map +1 -1
  16. package/build/features/cache/actions/EnableAction.js +3 -1
  17. package/build/features/cache/actions/EnableAction.js.map +1 -1
  18. package/build/features/event/EventFeature.js +2 -2
  19. package/build/features/event/EventFeature.js.map +1 -1
  20. package/build/features/event/actions/SyncAction.js +1 -1
  21. package/build/features/event/actions/SyncAction.js.map +1 -1
  22. package/build/features/event/services/{EventSettingsService.d.ts → EventCacheService.d.ts} +3 -3
  23. package/build/features/event/services/{EventSettingsService.js → EventCacheService.js} +8 -7
  24. package/build/features/event/services/EventCacheService.js.map +1 -0
  25. package/build/features/node/actions/UpgradeAction.d.ts +2 -2
  26. package/build/features/node/actions/UpgradeAction.js.map +1 -1
  27. package/build/features/universalFileDescriptions.js +1 -1
  28. package/build/features/universalFileDescriptions.js.map +1 -1
  29. package/build/features/view/actions/SyncAction.js +2 -0
  30. package/build/features/view/actions/SyncAction.js.map +1 -1
  31. package/build/services/ServiceFactory.d.ts +3 -2
  32. package/build/services/ServiceFactory.js +11 -7
  33. package/build/services/ServiceFactory.js.map +1 -1
  34. package/build/utilities/introspection.utility.d.ts +8 -4
  35. package/build/utilities/introspection.utility.js +189 -46
  36. package/build/utilities/introspection.utility.js.map +1 -1
  37. package/package.json +27 -27
  38. package/src/__tests__/behavioral/EnablingAndDisablingCache.test.ts +1 -0
  39. package/src/__tests__/behavioral/upgrading/UpgradingASkill5.test.ts +1 -1
  40. package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +1 -1
  41. package/src/__tests__/behavioral/views/plugins/CreatingAViewPlugin.test.ts +53 -0
  42. package/src/__tests__/implementation/EventCacheService.test.ts +38 -0
  43. package/src/errors/SpruceError.ts +3 -1
  44. package/src/features/cache/actions/EnableAction.ts +6 -1
  45. package/src/features/event/EventFeature.ts +2 -2
  46. package/src/features/event/actions/SyncAction.ts +1 -1
  47. package/src/features/event/services/{EventSettingsService.ts → EventCacheService.ts} +5 -3
  48. package/src/features/node/actions/UpgradeAction.ts +4 -4
  49. package/src/features/universalFileDescriptions.ts +1 -1
  50. package/src/features/view/actions/SyncAction.ts +2 -0
  51. package/src/services/ServiceFactory.ts +11 -8
  52. package/src/utilities/introspection.utility.ts +233 -79
  53. package/build/features/event/services/EventSettingsService.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventCacheService.js","names":["EventCacheService","exports","settings","_classCallCheck2","_defineProperty2","setFile","_createClass2","key","value","getLastSyncOptions","get","setLastSyncCache","options","set","setListenerCache","clearListenerCache","unset","getListenerCache"],"sources":["../../../../src/features/event/services/EventCacheService.ts"],"sourcesContent":["import { SettingsService } from '@sprucelabs/spruce-skill-utils'\n\nexport default class EventCacheService {\n\tprotected settings: SettingsService<string>\n\n\tpublic constructor(settings: SettingsService) {\n\t\tthis.settings = settings\n\t\tthis.settings.setFile('event-cache.json')\n\t}\n\n\tpublic getLastSyncOptions() {\n\t\treturn this.settings.get('events.lastSync')\n\t}\n\n\tpublic setLastSyncCache(options: {\n\t\tshouldSyncOnlyCoreEvents?: boolean | null\n\t}) {\n\t\tthis.settings.set('events.lastSync', options)\n\t}\n\n\tpublic setListenerCache(value: Record<string, any>) {\n\t\tthis.settings.set('events.listenerCacheKeys', value)\n\t}\n\n\tpublic clearListenerCache() {\n\t\tthis.settings.unset('events.listenerCacheKeys')\n\t}\n\n\tpublic getListenerCache() {\n\t\treturn this.settings.get('events.listenerCacheKeys')\n\t}\n}\n"],"mappings":";;;;;;;;;;IAEqBA,iBAAiB,GAAAC,OAAA;EAGrC,SAAAD,kBAAmBE,QAAyB,EAAE;IAAA,IAAAC,gBAAA,mBAAAH,iBAAA;IAAA,IAAAI,gBAAA;IAC7C,IAAI,CAACF,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACA,QAAQ,CAACG,OAAO,CAAC,kBAAkB,CAAC;EAC1C;EAAC,WAAAC,aAAA,aAAAN,iBAAA;IAAAO,GAAA;IAAAC,KAAA,EAED,SAAAC,mBAAA,EAA4B;MAC3B,OAAO,IAAI,CAACP,QAAQ,CAACQ,GAAG,CAAC,iBAAiB,CAAC;IAC5C;EAAC;IAAAH,GAAA;IAAAC,KAAA,EAED,SAAAG,iBAAwBC,OAEvB,EAAE;MACF,IAAI,CAACV,QAAQ,CAACW,GAAG,CAAC,iBAAiB,EAAED,OAAO,CAAC;IAC9C;EAAC;IAAAL,GAAA;IAAAC,KAAA,EAED,SAAAM,iBAAwBN,KAA0B,EAAE;MACnD,IAAI,CAACN,QAAQ,CAACW,GAAG,CAAC,0BAA0B,EAAEL,KAAK,CAAC;IACrD;EAAC;IAAAD,GAAA;IAAAC,KAAA,EAED,SAAAO,mBAAA,EAA4B;MAC3B,IAAI,CAACb,QAAQ,CAACc,KAAK,CAAC,0BAA0B,CAAC;IAChD;EAAC;IAAAT,GAAA;IAAAC,KAAA,EAED,SAAAS,iBAAA,EAA0B;MACzB,OAAO,IAAI,CAACf,QAAQ,CAACQ,GAAG,CAAC,0BAA0B,CAAC;IACrD;EAAC;AAAA","ignoreList":[]}
@@ -2,8 +2,6 @@ import { SchemaValues } from '@sprucelabs/schema';
2
2
  import { SpruceSchemas } from "./../../../.spruce/schemas/schemas.types";
3
3
  import AbstractAction from '../../AbstractAction';
4
4
  import { FeatureActionResponse } from '../../features.types';
5
- type OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema;
6
- type Options = SchemaValues<OptionsSchema>;
7
5
  export default class UpgradeAction extends AbstractAction<OptionsSchema> {
8
6
  invocationMessage: string;
9
7
  optionsSchema: SpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema;
@@ -12,4 +10,6 @@ export default class UpgradeAction extends AbstractAction<OptionsSchema> {
12
10
  private reInstallPackageDependencies;
13
11
  private updateScripts;
14
12
  }
13
+ type OptionsSchema = SpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema;
14
+ type Options = SchemaValues<OptionsSchema>;
15
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"UpgradeAction.js","names":["_upgradeSkillOptions","_interopRequireDefault","require","_InFlightEntertainment","_ScriptUpdater","_action","_AbstractAction2","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","UpgradeAction","exports","_AbstractAction","_this","_classCallCheck2","_len","args","_key","concat","upgradeSkillActionSchema","_inherits2","_createClass2","key","_execute","_asyncToGenerator2","_regenerator","mark","_callee","options","normalizedOptions","files","dependencyResults","wrap","_callee$","_context","prev","validateAndNormalizeOptions","updateScripts","shouldConfirm","upgradeMode","Writer","writeNodeModule","cwd","shouldConfirmBeforeWriting","shouldWriteIndex","sent","ui","clear","InFlightEntertainment","start","reInstallPackageDependencies","Service","execute","abrupt","actionUtil","mergeActionResults","headline","stop","renderHero","finish","_x","_reInstallPackageDependencies","_callee2","_callee2$","_context2","Action","_updateScripts","_callee3","features","scripts","_iterator","_step","feature","scriptUpdater","_callee3$","_context3","getInstalledFeatures","ScriptUpdater","FromFeature","parent","latestScripts","update","shouldConfirmIfScriptExistsButIsDifferent","_x2","AbstractAction"],"sources":["../../../../src/features/node/actions/UpgradeAction.ts"],"sourcesContent":["import { SchemaValues } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport upgradeSkillActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema'\nimport InFlightEntertainment from '../../../InFlightEntertainment'\nimport ScriptUpdater from '../../../updaters/ScriptUpdater'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class UpgradeAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Upgrading your skill... 💪'\n\tpublic optionsSchema = upgradeSkillActionSchema\n\tpublic commandAliases = ['upgrade', 'update']\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\n\t\tawait this.updateScripts({\n\t\t\tshouldConfirm: normalizedOptions.upgradeMode !== 'forceEverything',\n\t\t})\n\n\t\ttry {\n\t\t\tconst files = await this.Writer('node', {\n\t\t\t\tupgradeMode: normalizedOptions.upgradeMode,\n\t\t\t}).writeNodeModule(this.cwd, {\n\t\t\t\tshouldConfirmBeforeWriting: true,\n\t\t\t\tshouldWriteIndex: false,\n\t\t\t})\n\n\t\t\tthis.ui.clear()\n\t\t\tInFlightEntertainment.start([\n\t\t\t\t\"Let's start the upgrade!\",\n\t\t\t\t'While things are going, see if you can beat 1k points!',\n\t\t\t\t'Go!!!!',\n\t\t\t])\n\n\t\t\tconst dependencyResults = await this.reInstallPackageDependencies()\n\n\t\t\tawait this.Service('command').execute('yarn fix.lint')\n\n\t\t\treturn actionUtil.mergeActionResults(dependencyResults, {\n\t\t\t\theadline: 'Upgrade',\n\t\t\t\tfiles,\n\t\t\t})\n\t\t} finally {\n\t\t\tInFlightEntertainment.stop()\n\t\t\tthis.ui.renderHero('Upgrade')\n\t\t}\n\t}\n\n\tprivate async reInstallPackageDependencies() {\n\t\treturn this.Action('node', 'updateDependencies').execute({})\n\t}\n\n\tprivate async updateScripts(options: { shouldConfirm: boolean }) {\n\t\tconst features = await this.features.getInstalledFeatures()\n\n\t\tlet scripts: Record<string, any> = {}\n\n\t\tfor (const feature of features) {\n\t\t\tscripts = {\n\t\t\t\t...scripts,\n\t\t\t\t...feature.scripts,\n\t\t\t}\n\t\t}\n\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this.parent, {\n\t\t\tlatestScripts: scripts,\n\t\t})\n\n\t\tawait scriptUpdater.update({\n\t\t\tshouldConfirmIfScriptExistsButIsDifferent: options.shouldConfirm,\n\t\t})\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAL,sBAAA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,CAAC;YAAA;YAAA;cAAA,OAAAqC,SAAA,CAAAlB,IAAA;UAAA;QAAA,GAAAU,QAAA;MAAA,CACF;MAAA,SAAA9B,cAAA8C,GAAA;QAAA,OAAAjB,cAAA,CAAA7G,KAAA,OAAAE,SAAA;MAAA;MAAA,OAAA8E,aAAA;IAAA;EAAA;AAAA,EAhEyC+C,2BAAc","ignoreList":[]}
1
+ {"version":3,"file":"UpgradeAction.js","names":["_upgradeSkillOptions","_interopRequireDefault","require","_InFlightEntertainment","_ScriptUpdater","_action","_AbstractAction2","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","UpgradeAction","exports","_AbstractAction","_this","_classCallCheck2","_len","args","_key","concat","upgradeSkillActionSchema","_inherits2","_createClass2","key","_execute","_asyncToGenerator2","_regenerator","mark","_callee","options","normalizedOptions","files","dependencyResults","wrap","_callee$","_context","prev","validateAndNormalizeOptions","updateScripts","shouldConfirm","upgradeMode","Writer","writeNodeModule","cwd","shouldConfirmBeforeWriting","shouldWriteIndex","sent","ui","clear","InFlightEntertainment","start","reInstallPackageDependencies","Service","execute","abrupt","actionUtil","mergeActionResults","headline","stop","renderHero","finish","_x","_reInstallPackageDependencies","_callee2","_callee2$","_context2","Action","_updateScripts","_callee3","features","scripts","_iterator","_step","feature","scriptUpdater","_callee3$","_context3","getInstalledFeatures","ScriptUpdater","FromFeature","parent","latestScripts","update","shouldConfirmIfScriptExistsButIsDifferent","_x2","AbstractAction"],"sources":["../../../../src/features/node/actions/UpgradeAction.ts"],"sourcesContent":["import { SchemaValues } from '@sprucelabs/schema'\nimport { SpruceSchemas } from '#spruce/schemas/schemas.types'\nimport upgradeSkillActionSchema from '#spruce/schemas/spruceCli/v2020_07_22/upgradeSkillOptions.schema'\nimport InFlightEntertainment from '../../../InFlightEntertainment'\nimport ScriptUpdater from '../../../updaters/ScriptUpdater'\nimport actionUtil from '../../../utilities/action.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nexport default class UpgradeAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Upgrading your skill... 💪'\n\tpublic optionsSchema = upgradeSkillActionSchema\n\tpublic commandAliases = ['upgrade', 'update']\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst normalizedOptions = this.validateAndNormalizeOptions(options)\n\n\t\tawait this.updateScripts({\n\t\t\tshouldConfirm: normalizedOptions.upgradeMode !== 'forceEverything',\n\t\t})\n\n\t\ttry {\n\t\t\tconst files = await this.Writer('node', {\n\t\t\t\tupgradeMode: normalizedOptions.upgradeMode,\n\t\t\t}).writeNodeModule(this.cwd, {\n\t\t\t\tshouldConfirmBeforeWriting: true,\n\t\t\t\tshouldWriteIndex: false,\n\t\t\t})\n\n\t\t\tthis.ui.clear()\n\t\t\tInFlightEntertainment.start([\n\t\t\t\t\"Let's start the upgrade!\",\n\t\t\t\t'While things are going, see if you can beat 1k points!',\n\t\t\t\t'Go!!!!',\n\t\t\t])\n\n\t\t\tconst dependencyResults = await this.reInstallPackageDependencies()\n\n\t\t\tawait this.Service('command').execute('yarn fix.lint')\n\n\t\t\treturn actionUtil.mergeActionResults(dependencyResults, {\n\t\t\t\theadline: 'Upgrade',\n\t\t\t\tfiles,\n\t\t\t})\n\t\t} finally {\n\t\t\tInFlightEntertainment.stop()\n\t\t\tthis.ui.renderHero('Upgrade')\n\t\t}\n\t}\n\n\tprivate async reInstallPackageDependencies() {\n\t\treturn this.Action('node', 'updateDependencies').execute({})\n\t}\n\n\tprivate async updateScripts(options: { shouldConfirm: boolean }) {\n\t\tconst features = await this.features.getInstalledFeatures()\n\n\t\tlet scripts: Record<string, any> = {}\n\n\t\tfor (const feature of features) {\n\t\t\tscripts = {\n\t\t\t\t...scripts,\n\t\t\t\t...feature.scripts,\n\t\t\t}\n\t\t}\n\n\t\tconst scriptUpdater = ScriptUpdater.FromFeature(this.parent, {\n\t\t\tlatestScripts: scripts,\n\t\t})\n\n\t\tawait scriptUpdater.update({\n\t\t\tshouldConfirmIfScriptExistsButIsDifferent: options.shouldConfirm,\n\t\t})\n\t}\n}\n\ntype OptionsSchema =\n\tSpruceSchemas.SpruceCli.v2020_07_22.UpgradeSkillOptionsSchema\ntype Options = SchemaValues<OptionsSchema>\n"],"mappings":";;;;;;;;;;;;;;;AAEA,IAAAA,oBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,gBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAiD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EA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ACgF,QAAQ,CAACQ,oBAAoB,CAAC,CAAC;YAAA;cAArDR,QAAQ,GAAAO,SAAA,CAAA9B,IAAA;cAEVwB,OAA4B,GAAG,CAAC,CAAC;cAAAC,SAAA,GAAAxG,0BAAA,CAEfsG,QAAQ;cAAA;gBAA9B,KAAAE,SAAA,CAAA9F,CAAA,MAAA+F,KAAA,GAAAD,SAAA,CAAA7F,CAAA,IAAAC,IAAA,GAAgC;kBAArB8F,OAAO,GAAAD,KAAA,CAAA5F,KAAA;kBACjB0F,OAAO,GAAA/G,aAAA,CAAAA,aAAA,KACH+G,OAAO,GACPG,OAAO,CAACH,OAAO,CAClB;gBACF;cAAC,SAAApF,GAAA;gBAAAqF,SAAA,CAAA5H,CAAA,CAAAuC,GAAA;cAAA;gBAAAqF,SAAA,CAAAzF,CAAA;cAAA;cAEK4F,aAAa,GAAGI,yBAAa,CAACC,WAAW,CAAC,IAAI,CAACC,MAAM,EAAE;gBAC5DC,aAAa,EAAEX;cAChB,CAAC,CAAC;cAAAM,SAAA,CAAAvF,IAAA;cAAA,OAEIqF,aAAa,CAACQ,MAAM,CAAC;gBAC1BC,yCAAyC,EAAEtD,OAAO,CAACU;cACpD,CAAC,CAAC;YAAA;YAAA;cAAA,OAAAqC,SAAA,CAAAlB,IAAA;UAAA;QAAA,GAAAU,QAAA;MAAA,CACF;MAAA,SAAA9B,cAAA8C,GAAA;QAAA,OAAAjB,cAAA,CAAA7G,KAAA,OAAAE,SAAA;MAAA;MAAA,OAAA8E,aAAA;IAAA;EAAA;AAAA,EAhEyC+C,2BAAc","ignoreList":[]}
@@ -15,7 +15,7 @@ var universalFileDescriptions = [{
15
15
  }, {
16
16
  path: '.gitignore',
17
17
  description: 'The usual suspects.',
18
- shouldOverwriteWhenChanged: false
18
+ shouldOverwriteWhenChanged: true
19
19
  }, {
20
20
  path: '.npmignore',
21
21
  description: 'Came out of nowhere!',
@@ -1 +1 @@
1
- {"version":3,"file":"universalFileDescriptions.js","names":["universalFileDescriptions","path","description","shouldOverwriteWhenChanged","_default","exports"],"sources":["../../src/features/universalFileDescriptions.ts"],"sourcesContent":["import { FileDescription } from '../types/cli.types'\n\nconst universalFileDescriptions: FileDescription[] = [\n\t{\n\t\tpath: '.eslintignore',\n\t\tdescription: 'Ignore things like build and node_module dirs.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.eslintrc.js',\n\t\tdescription: 'Extends Spruce configurations.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.gitignore',\n\t\tdescription: 'The usual suspects.',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: '.npmignore',\n\t\tdescription: 'Came out of nowhere!',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: '.nvmrc',\n\t\tdescription: 'Keep node at the latest.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: 'readme.md',\n\t\tdescription: \"Don't forget to update this at some point.\",\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: 'package.json',\n\t\tdescription: 'All dependencies and scripts.',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: 'tsconfig.json',\n\t\tdescription: 'Maps #spruce paths.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.spruce/settings.json',\n\t\tdescription: 'Tracks things like which features are installed.',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n]\n\nexport default universalFileDescriptions\n"],"mappings":";;;;;;AAEA,IAAMA,yBAA4C,GAAG,CACpD;EACCC,IAAI,EAAE,eAAe;EACrBC,WAAW,EAAE,gDAAgD;EAC7DC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,cAAc;EACpBC,WAAW,EAAE,gCAAgC;EAC7CC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,qBAAqB;EAClCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,sBAAsB;EACnCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,0BAA0B;EACvCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,WAAW;EACjBC,WAAW,EAAE,4CAA4C;EACzDC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,cAAc;EACpBC,WAAW,EAAE,+BAA+B;EAC5CC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,eAAe;EACrBC,WAAW,EAAE,qBAAqB;EAClCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,uBAAuB;EAC7BC,WAAW,EAAE,kDAAkD;EAC/DC,0BAA0B,EAAE;AAC7B,CAAC,CACD;AAAA,IAAAC,QAAA,GAAAC,OAAA,cAEcL,yBAAyB","ignoreList":[]}
1
+ {"version":3,"file":"universalFileDescriptions.js","names":["universalFileDescriptions","path","description","shouldOverwriteWhenChanged","_default","exports"],"sources":["../../src/features/universalFileDescriptions.ts"],"sourcesContent":["import { FileDescription } from '../types/cli.types'\n\nconst universalFileDescriptions: FileDescription[] = [\n\t{\n\t\tpath: '.eslintignore',\n\t\tdescription: 'Ignore things like build and node_module dirs.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.eslintrc.js',\n\t\tdescription: 'Extends Spruce configurations.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.gitignore',\n\t\tdescription: 'The usual suspects.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.npmignore',\n\t\tdescription: 'Came out of nowhere!',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: '.nvmrc',\n\t\tdescription: 'Keep node at the latest.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: 'readme.md',\n\t\tdescription: \"Don't forget to update this at some point.\",\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: 'package.json',\n\t\tdescription: 'All dependencies and scripts.',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n\t{\n\t\tpath: 'tsconfig.json',\n\t\tdescription: 'Maps #spruce paths.',\n\t\tshouldOverwriteWhenChanged: true,\n\t},\n\t{\n\t\tpath: '.spruce/settings.json',\n\t\tdescription: 'Tracks things like which features are installed.',\n\t\tshouldOverwriteWhenChanged: false,\n\t},\n]\n\nexport default universalFileDescriptions\n"],"mappings":";;;;;;AAEA,IAAMA,yBAA4C,GAAG,CACpD;EACCC,IAAI,EAAE,eAAe;EACrBC,WAAW,EAAE,gDAAgD;EAC7DC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,cAAc;EACpBC,WAAW,EAAE,gCAAgC;EAC7CC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,qBAAqB;EAClCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,YAAY;EAClBC,WAAW,EAAE,sBAAsB;EACnCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,QAAQ;EACdC,WAAW,EAAE,0BAA0B;EACvCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,WAAW;EACjBC,WAAW,EAAE,4CAA4C;EACzDC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,cAAc;EACpBC,WAAW,EAAE,+BAA+B;EAC5CC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,eAAe;EACrBC,WAAW,EAAE,qBAAqB;EAClCC,0BAA0B,EAAE;AAC7B,CAAC,EACD;EACCF,IAAI,EAAE,uBAAuB;EAC7BC,WAAW,EAAE,kDAAkD;EAC/DC,0BAA0B,EAAE;AAC7B,CAAC,CACD;AAAA,IAAAC,QAAA,GAAAC,OAAA,cAEcL,yBAAyB","ignoreList":[]}
@@ -85,6 +85,8 @@ var SyncAction = exports["default"] = /*#__PURE__*/function (_AbstractAction) {
85
85
  viewPluginItems.push(plugin);
86
86
  } else if (svc) {
87
87
  svcTemplateItems.push(svc);
88
+ } else {
89
+ throw new Error('Unexpected class type.');
88
90
  }
89
91
  }
90
92
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"SyncAction.js","names":["_globby","_interopRequireDefault","require","_schema","_spruceSkillUtils","_introspection","_AbstractAction2","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","SyncAction","exports","_AbstractAction","_this","_classCallCheck2","_len","args","_key","concat","optionsSchema","_inherits2","_createClass2","key","_execute","_asyncToGenerator2","_regenerator","mark","_callee","_options","_this2","targetDir","matches","paths","introspect","vcTemplateItems","svcTemplateItems","viewPluginItems","namespace","files","wrap","_callee$","_context","prev","diskUtil","resolvePath","cwd","globby","sent","abrupt","map","m","introspectionUtil","_ref","classes","_iterator","_step","thisClass","_this2$mapIntrospecte","mapIntrospectedClassToTemplateItem","vc","svc","plugin","Store","loadCurrentSkillsNamespace","Writer","writeCombinedViewsFile","namespaceKebab","namesUtil","toKebab","stop","execute","_x","c","item","id","staticProperties","namePascal","className","path","classPath","endsWith","nameCamel","match","AbstractAction","buildSchema","description","fields"],"sources":["../../../../src/features/view/actions/SyncAction.ts"],"sourcesContent":["import globby from '@sprucelabs/globby'\nimport { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tVcTemplateItem,\n\tViewControllerPluginItem,\n} from '../../../../../spruce-templates/build'\nimport introspectionUtil, {\n\tIntrospectionClass,\n} from '../../../utilities/introspection.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic commandAliases = ['sync.views']\n\tpublic invocationMessage = 'Syncing view controller types... 🌲'\n\n\tpublic async execute(\n\t\t_options: SchemaValues<OptionsSchema>\n\t): Promise<FeatureActionResponse> {\n\t\tconst targetDir = diskUtil.resolvePath(this.cwd, 'src')\n\t\tconst matches = await globby(\n\t\t\t['**/*.svc.ts', '**/*.vc.ts', '**/*.view.plugin.ts'],\n\t\t\t{\n\t\t\t\tcwd: targetDir,\n\t\t\t}\n\t\t)\n\n\t\tif (matches.length === 0) {\n\t\t\treturn {}\n\t\t}\n\n\t\tconst paths = matches.map((m) => diskUtil.resolvePath(targetDir, m))\n\t\tconst introspect = introspectionUtil.introspect(paths)\n\n\t\tconst vcTemplateItems: VcTemplateItem[] = []\n\t\tconst svcTemplateItems: VcTemplateItem[] = []\n\t\tconst viewPluginItems: ViewControllerPluginItem[] = []\n\n\t\tintrospect.forEach(({ classes }) => {\n\t\t\tfor (const thisClass of classes) {\n\t\t\t\tconst { vc, svc, plugin } =\n\t\t\t\t\tthis.mapIntrospectedClassToTemplateItem(thisClass)\n\n\t\t\t\tif (vc) {\n\t\t\t\t\tvcTemplateItems.push(vc)\n\t\t\t\t} else if (plugin) {\n\t\t\t\t\tviewPluginItems.push(plugin)\n\t\t\t\t} else if (svc) {\n\t\t\t\t\tsvcTemplateItems.push(svc)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tconst namespace = await this.Store('skill').loadCurrentSkillsNamespace()\n\t\tconst files = await this.Writer('view').writeCombinedViewsFile(this.cwd, {\n\t\t\tnamespaceKebab: namesUtil.toKebab(namespace),\n\t\t\tvcTemplateItems,\n\t\t\tsvcTemplateItems,\n\t\t\tviewPluginItems,\n\t\t})\n\n\t\treturn {\n\t\t\tfiles,\n\t\t}\n\t}\n\n\tprivate mapIntrospectedClassToTemplateItem(c: IntrospectionClass): {\n\t\tvc?: VcTemplateItem\n\t\tsvc?: VcTemplateItem\n\t\tplugin?: ViewControllerPluginItem\n\t} {\n\t\tconst item = {\n\t\t\tid: c.staticProperties.id,\n\t\t\tnamePascal: c.className,\n\t\t\tpath: c.classPath,\n\t\t}\n\n\t\tlet vc: VcTemplateItem | undefined\n\t\tlet svc: VcTemplateItem | undefined\n\t\tlet plugin: ViewControllerPluginItem | undefined\n\n\t\tif (c.classPath.endsWith('.svc.ts')) {\n\t\t\tsvc = item\n\t\t} else if (c.classPath.endsWith('view.plugin.ts')) {\n\t\t\tconst nameCamel = c.classPath.match(/([^/]+).view.plugin.ts$/)![1]\n\t\t\tplugin = { ...item, nameCamel }\n\t\t} else {\n\t\t\tvc = item\n\t\t}\n\n\t\treturn { svc, vc, plugin }\n\t}\n}\n\nconst optionsSchema = buildSchema({\n\tid: 'syncViewsOptions',\n\tdescription: 'Keep types and generated files based on views in sync.',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAKA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAGA,IAAAI,gBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAiD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAA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AG,EAAHA,GAAG;QAAED,EAAE,EAAFA,EAAE;QAAEE,MAAM,EAANA;MAAO,CAAC;IAC3B;EAAC;AAAA,EAhFsCsB,2BAAc;AAmFtD,IAAMhE,aAAa,GAAG,IAAAiE,mBAAW,EAAC;EACjCV,EAAE,EAAE,kBAAkB;EACtBW,WAAW,EAAE,wDAAwD;EACrEC,MAAM,EAAE,CAAC;AACV,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"SyncAction.js","names":["_globby","_interopRequireDefault","require","_schema","_spruceSkillUtils","_introspection","_AbstractAction2","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_createForOfIteratorHelper","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","from","test","arr","len","arr2","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","Boolean","valueOf","SyncAction","exports","_AbstractAction","_this","_classCallCheck2","_len","args","_key","concat","optionsSchema","_inherits2","_createClass2","key","_execute","_asyncToGenerator2","_regenerator","mark","_callee","_options","_this2","targetDir","matches","paths","introspect","vcTemplateItems","svcTemplateItems","viewPluginItems","namespace","files","wrap","_callee$","_context","prev","diskUtil","resolvePath","cwd","globby","sent","abrupt","map","m","introspectionUtil","_ref","classes","_iterator","_step","thisClass","_this2$mapIntrospecte","mapIntrospectedClassToTemplateItem","vc","svc","plugin","Error","Store","loadCurrentSkillsNamespace","Writer","writeCombinedViewsFile","namespaceKebab","namesUtil","toKebab","stop","execute","_x","c","item","id","staticProperties","namePascal","className","path","classPath","endsWith","nameCamel","match","AbstractAction","buildSchema","description","fields"],"sources":["../../../../src/features/view/actions/SyncAction.ts"],"sourcesContent":["import globby from '@sprucelabs/globby'\nimport { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tVcTemplateItem,\n\tViewControllerPluginItem,\n} from '../../../../../spruce-templates/build'\nimport introspectionUtil, {\n\tIntrospectionClass,\n} from '../../../utilities/introspection.utility'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic commandAliases = ['sync.views']\n\tpublic invocationMessage = 'Syncing view controller types... 🌲'\n\n\tpublic async execute(\n\t\t_options: SchemaValues<OptionsSchema>\n\t): Promise<FeatureActionResponse> {\n\t\tconst targetDir = diskUtil.resolvePath(this.cwd, 'src')\n\t\tconst matches = await globby(\n\t\t\t['**/*.svc.ts', '**/*.vc.ts', '**/*.view.plugin.ts'],\n\t\t\t{\n\t\t\t\tcwd: targetDir,\n\t\t\t}\n\t\t)\n\n\t\tif (matches.length === 0) {\n\t\t\treturn {}\n\t\t}\n\n\t\tconst paths = matches.map((m) => diskUtil.resolvePath(targetDir, m))\n\t\tconst introspect = introspectionUtil.introspect(paths)\n\n\t\tconst vcTemplateItems: VcTemplateItem[] = []\n\t\tconst svcTemplateItems: VcTemplateItem[] = []\n\t\tconst viewPluginItems: ViewControllerPluginItem[] = []\n\n\t\tintrospect.forEach(({ classes }) => {\n\t\t\tfor (const thisClass of classes) {\n\t\t\t\tconst { vc, svc, plugin } =\n\t\t\t\t\tthis.mapIntrospectedClassToTemplateItem(thisClass)\n\n\t\t\t\tif (vc) {\n\t\t\t\t\tvcTemplateItems.push(vc)\n\t\t\t\t} else if (plugin) {\n\t\t\t\t\tviewPluginItems.push(plugin)\n\t\t\t\t} else if (svc) {\n\t\t\t\t\tsvcTemplateItems.push(svc)\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error('Unexpected class type.')\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tconst namespace = await this.Store('skill').loadCurrentSkillsNamespace()\n\t\tconst files = await this.Writer('view').writeCombinedViewsFile(this.cwd, {\n\t\t\tnamespaceKebab: namesUtil.toKebab(namespace),\n\t\t\tvcTemplateItems,\n\t\t\tsvcTemplateItems,\n\t\t\tviewPluginItems,\n\t\t})\n\n\t\treturn {\n\t\t\tfiles,\n\t\t}\n\t}\n\n\tprivate mapIntrospectedClassToTemplateItem(c: IntrospectionClass): {\n\t\tvc?: VcTemplateItem\n\t\tsvc?: VcTemplateItem\n\t\tplugin?: ViewControllerPluginItem\n\t} {\n\t\tconst item = {\n\t\t\tid: c.staticProperties.id,\n\t\t\tnamePascal: c.className,\n\t\t\tpath: c.classPath,\n\t\t}\n\n\t\tlet vc: VcTemplateItem | undefined\n\t\tlet svc: VcTemplateItem | undefined\n\t\tlet plugin: ViewControllerPluginItem | undefined\n\n\t\tif (c.classPath.endsWith('.svc.ts')) {\n\t\t\tsvc = item\n\t\t} else if (c.classPath.endsWith('view.plugin.ts')) {\n\t\t\tconst nameCamel = c.classPath.match(/([^/]+).view.plugin.ts$/)![1]\n\t\t\tplugin = { ...item, nameCamel }\n\t\t} else {\n\t\t\tvc = item\n\t\t}\n\n\t\treturn { svc, vc, plugin }\n\t}\n}\n\nconst optionsSchema = buildSchema({\n\tid: 'syncViewsOptions',\n\tdescription: 'Keep types and generated files based on views in sync.',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\n"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAKA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAGA,IAAAI,gBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAiD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA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ACNvB,EAAE,GAAGe,IAAI;MACV;MAEA,OAAO;QAAEd,GAAG,EAAHA,GAAG;QAAED,EAAE,EAAFA,EAAE;QAAEE,MAAM,EAANA;MAAO,CAAC;IAC3B;EAAC;AAAA,EAlFsCuB,2BAAc;AAqFtD,IAAMjE,aAAa,GAAG,IAAAkE,mBAAW,EAAC;EACjCV,EAAE,EAAE,kBAAkB;EACtBW,WAAW,EAAE,wDAAwD;EACrEC,MAAM,EAAE,CAAC;AACV,CAAC,CAAC","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { SettingsService, EnvService, AuthService } from '@sprucelabs/spruce-skill-utils';
2
- import EventSettingsService from '../features/event/services/EventSettingsService';
2
+ import EventCacheService from '../features/event/services/EventCacheService';
3
3
  import RemoteService from '../features/event/services/RemoteService';
4
4
  import SchemaService from '../features/schema/services/SchemaService';
5
5
  import VsCodeService from '../features/vscode/services/VsCodeService';
@@ -12,6 +12,7 @@ import PkgService from './PkgService';
12
12
  import TypeCheckerService from './TypeCheckerService';
13
13
  export default class ServiceFactory {
14
14
  static serviceClassOverides: Record<string, any>;
15
+ static setServiceClass(name: Service, Class: any): void;
15
16
  Service<S extends Service>(cwd: string, type: S): ServiceMap[S];
16
17
  private buildImportService;
17
18
  static reset(): void;
@@ -30,7 +31,7 @@ export interface ServiceMap {
30
31
  env: EnvService;
31
32
  auth: AuthService;
32
33
  remote: RemoteService;
33
- eventSettings: EventSettingsService;
34
+ eventCache: EventCacheService;
34
35
  dependency: DependencyService;
35
36
  }
36
37
  export type Service = keyof ServiceMap;
@@ -9,7 +9,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
9
9
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
12
- var _EventSettingsService = _interopRequireDefault(require("../features/event/services/EventSettingsService"));
12
+ var _EventCacheService = _interopRequireDefault(require("../features/event/services/EventCacheService"));
13
13
  var _RemoteService = _interopRequireDefault(require("../features/event/services/RemoteService"));
14
14
  var _SchemaService = _interopRequireDefault(require("../features/schema/services/SchemaService"));
15
15
  var _VsCodeService = _interopRequireDefault(require("../features/vscode/services/VsCodeService"));
@@ -36,9 +36,7 @@ var ServiceFactory = exports["default"] = /*#__PURE__*/function () {
36
36
  return Service;
37
37
  }(function (cwd, type) {
38
38
  var _this = this;
39
- if (ServiceFactory.serviceClassOverides[type]) {
40
- return new ServiceFactory.serviceClassOverides[type](cwd);
41
- }
39
+ var Class = ServiceFactory.serviceClassOverides[type];
42
40
  switch (type) {
43
41
  case 'auth':
44
42
  return _spruceSkillUtils.AuthService.Auth(cwd);
@@ -66,7 +64,8 @@ var ServiceFactory = exports["default"] = /*#__PURE__*/function () {
66
64
  case 'typeChecker':
67
65
  return new _TypeCheckerService["default"](this.buildImportService(cwd));
68
66
  case 'settings':
69
- return new _spruceSkillUtils.SettingsService(cwd);
67
+ //@ts-ignore
68
+ return new (Class !== null && Class !== void 0 ? Class : _spruceSkillUtils.SettingsService)(cwd);
70
69
  case 'dependency':
71
70
  return new _DependencyService["default"](new _spruceSkillUtils.SettingsService(cwd));
72
71
  case 'import':
@@ -78,8 +77,8 @@ var ServiceFactory = exports["default"] = /*#__PURE__*/function () {
78
77
  return _this.Service(cwd, 'command');
79
78
  }));
80
79
  }
81
- case 'eventSettings':
82
- return new _EventSettingsService["default"](new _spruceSkillUtils.SettingsService(cwd));
80
+ case 'eventCache':
81
+ return new (Class !== null && Class !== void 0 ? Class : _EventCacheService["default"])(new _spruceSkillUtils.SettingsService(cwd));
83
82
  default:
84
83
  throw new Error("Service \"".concat(type, "\" not found"));
85
84
  }
@@ -93,6 +92,11 @@ var ServiceFactory = exports["default"] = /*#__PURE__*/function () {
93
92
  });
94
93
  }
95
94
  }], [{
95
+ key: "setServiceClass",
96
+ value: function setServiceClass(name, Class) {
97
+ this.serviceClassOverides[name] = Class;
98
+ }
99
+ }, {
96
100
  key: "reset",
97
101
  value: function reset() {
98
102
  this.serviceClassOverides = {};
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceFactory.js","names":["_spruceSkillUtils","require","_EventSettingsService","_interopRequireDefault","_RemoteService","_SchemaService","_VsCodeService","_BuildService","_CommandService","_DependencyService","_ImportService","_LintService","_PkgService","_TypeCheckerService","ServiceFactory","exports","_classCallCheck2","_createClass2","key","value","_Service","Service","_x","_x2","apply","arguments","toString","cwd","type","_this","serviceClassOverides","AuthService","Auth","PkgService","EnvService","VsCodeService","SchemaService","command","CommandService","LintService","RemoteService","TypeCheckerService","buildImportService","SettingsService","DependencyService","commandService","BuildService","EventSettingsService","Error","concat","ImportService","reset","setFactoryClass","name","Class","_defineProperty2"],"sources":["../../src/services/ServiceFactory.ts"],"sourcesContent":["import {\n\tSettingsService,\n\tEnvService,\n\tAuthService,\n} from '@sprucelabs/spruce-skill-utils'\nimport EventSettingsService from '../features/event/services/EventSettingsService'\nimport RemoteService from '../features/event/services/RemoteService'\nimport { FeatureCode } from '../features/features.types'\nimport SchemaService from '../features/schema/services/SchemaService'\nimport VsCodeService from '../features/vscode/services/VsCodeService'\nimport BuildService from './BuildService'\nimport CommandService from './CommandService'\nimport DependencyService from './DependencyService'\nimport ImportService from './ImportService'\nimport LintService from './LintService'\nimport PkgService from './PkgService'\nimport TypeCheckerService from './TypeCheckerService'\n\nexport default class ServiceFactory {\n\tpublic static serviceClassOverides: Record<string, any> = {}\n\n\tpublic Service<S extends Service>(cwd: string, type: S): ServiceMap[S] {\n\t\tif (ServiceFactory.serviceClassOverides[type]) {\n\t\t\treturn new ServiceFactory.serviceClassOverides[type](cwd) as ServiceMap[S]\n\t\t}\n\n\t\tswitch (type) {\n\t\t\tcase 'auth':\n\t\t\t\treturn AuthService.Auth(cwd) as ServiceMap[S]\n\t\t\tcase 'pkg':\n\t\t\t\treturn new PkgService(\n\t\t\t\t\tcwd,\n\t\t\t\t\tthis.Service(cwd, 'command')\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'env':\n\t\t\t\treturn new EnvService(cwd) as ServiceMap[S]\n\t\t\tcase 'vsCode':\n\t\t\t\treturn new VsCodeService(cwd) as ServiceMap[S]\n\t\t\tcase 'schema':\n\t\t\t\treturn new SchemaService({\n\t\t\t\t\tcwd,\n\t\t\t\t\tcommand: new CommandService(cwd),\n\t\t\t\t}) as ServiceMap[S]\n\t\t\tcase 'lint':\n\t\t\t\treturn new LintService(cwd, () =>\n\t\t\t\t\tthis.Service(cwd, 'command')\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'command': {\n\t\t\t\treturn new CommandService(cwd) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'remote':\n\t\t\t\treturn new RemoteService(new EnvService(cwd)) as ServiceMap[S]\n\t\t\tcase 'typeChecker':\n\t\t\t\treturn new TypeCheckerService(\n\t\t\t\t\tthis.buildImportService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'settings':\n\t\t\t\treturn new SettingsService<FeatureCode>(cwd) as ServiceMap[S]\n\t\t\tcase 'dependency':\n\t\t\t\treturn new DependencyService(\n\t\t\t\t\tnew SettingsService<FeatureCode>(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'import':\n\t\t\t\treturn this.buildImportService(cwd) as ServiceMap[S]\n\t\t\tcase 'build': {\n\t\t\t\tconst commandService = new CommandService(cwd)\n\t\t\t\treturn new BuildService(\n\t\t\t\t\tcommandService,\n\t\t\t\t\tnew LintService(cwd, () => this.Service(cwd, 'command'))\n\t\t\t\t) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'eventSettings':\n\t\t\t\treturn new EventSettingsService(\n\t\t\t\t\tnew SettingsService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Service \"${type}\" not found`)\n\t\t}\n\t}\n\n\tprivate buildImportService(cwd: string): ImportService {\n\t\treturn new ImportService({\n\t\t\tcwd,\n\t\t\tcommand: new CommandService(cwd),\n\t\t})\n\t}\n\n\tpublic static reset() {\n\t\tthis.serviceClassOverides = {}\n\t}\n\n\tpublic static setFactoryClass(name: string, Class: any) {\n\t\tthis.serviceClassOverides[name] = Class\n\t}\n}\n\nexport interface ServiceMap {\n\tpkg: PkgService\n\tvsCode: VsCodeService\n\tschema: SchemaService\n\tlint: LintService\n\tcommand: CommandService\n\ttypeChecker: TypeCheckerService\n\timport: ImportService\n\tbuild: BuildService\n\tsettings: SettingsService\n\tenv: EnvService\n\tauth: AuthService\n\tremote: RemoteService\n\teventSettings: EventSettingsService\n\tdependency: DependencyService\n}\n\nexport type Service = keyof ServiceMap\n\nexport interface ServiceProvider {\n\tService<S extends Service>(type: S, cwd?: string): ServiceMap[S]\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,cAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,eAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,kBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,cAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,YAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,WAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,mBAAA,GAAAV,sBAAA,CAAAF,OAAA;AAAqD,IAEhCa,cAAc,GAAAC,OAAA;EAAA,SAAAD,eAAA;IAAA,IAAAE,gBAAA,mBAAAF,cAAA;EAAA;EAAA,WAAAG,aAAA,aAAAH,cAAA;IAAAI,GAAA;IAAAC,KAAA,YAAAC,QAAA;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,"file":"ServiceFactory.js","names":["_spruceSkillUtils","require","_EventCacheService","_interopRequireDefault","_RemoteService","_SchemaService","_VsCodeService","_BuildService","_CommandService","_DependencyService","_ImportService","_LintService","_PkgService","_TypeCheckerService","ServiceFactory","exports","_classCallCheck2","_createClass2","key","value","_Service","Service","_x","_x2","apply","arguments","toString","cwd","type","_this","Class","serviceClassOverides","AuthService","Auth","PkgService","EnvService","VsCodeService","SchemaService","command","CommandService","LintService","RemoteService","TypeCheckerService","buildImportService","SettingsService","DependencyService","commandService","BuildService","EventCacheService","Error","concat","ImportService","setServiceClass","name","reset","setFactoryClass","_defineProperty2"],"sources":["../../src/services/ServiceFactory.ts"],"sourcesContent":["import {\n\tSettingsService,\n\tEnvService,\n\tAuthService,\n} from '@sprucelabs/spruce-skill-utils'\nimport EventCacheService from '../features/event/services/EventCacheService'\nimport RemoteService from '../features/event/services/RemoteService'\nimport { FeatureCode } from '../features/features.types'\nimport SchemaService from '../features/schema/services/SchemaService'\nimport VsCodeService from '../features/vscode/services/VsCodeService'\nimport BuildService from './BuildService'\nimport CommandService from './CommandService'\nimport DependencyService from './DependencyService'\nimport ImportService from './ImportService'\nimport LintService from './LintService'\nimport PkgService from './PkgService'\nimport TypeCheckerService from './TypeCheckerService'\n\nexport default class ServiceFactory {\n\tpublic static serviceClassOverides: Record<string, any> = {}\n\n\tpublic static setServiceClass(name: Service, Class: any) {\n\t\tthis.serviceClassOverides[name] = Class\n\t}\n\n\tpublic Service<S extends Service>(cwd: string, type: S): ServiceMap[S] {\n\t\tconst Class = ServiceFactory.serviceClassOverides[type] as any\n\n\t\tswitch (type) {\n\t\t\tcase 'auth':\n\t\t\t\treturn AuthService.Auth(cwd) as ServiceMap[S]\n\t\t\tcase 'pkg':\n\t\t\t\treturn new PkgService(\n\t\t\t\t\tcwd,\n\t\t\t\t\tthis.Service(cwd, 'command')\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'env':\n\t\t\t\treturn new EnvService(cwd) as ServiceMap[S]\n\t\t\tcase 'vsCode':\n\t\t\t\treturn new VsCodeService(cwd) as ServiceMap[S]\n\t\t\tcase 'schema':\n\t\t\t\treturn new SchemaService({\n\t\t\t\t\tcwd,\n\t\t\t\t\tcommand: new CommandService(cwd),\n\t\t\t\t}) as ServiceMap[S]\n\t\t\tcase 'lint':\n\t\t\t\treturn new LintService(cwd, () =>\n\t\t\t\t\tthis.Service(cwd, 'command')\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'command': {\n\t\t\t\treturn new CommandService(cwd) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'remote':\n\t\t\t\treturn new RemoteService(new EnvService(cwd)) as ServiceMap[S]\n\t\t\tcase 'typeChecker':\n\t\t\t\treturn new TypeCheckerService(\n\t\t\t\t\tthis.buildImportService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'settings':\n\t\t\t\t//@ts-ignore\n\t\t\t\treturn new (Class ?? SettingsService)<FeatureCode>(cwd) as ServiceMap[S]\n\t\t\tcase 'dependency':\n\t\t\t\treturn new DependencyService(\n\t\t\t\t\tnew SettingsService<FeatureCode>(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tcase 'import':\n\t\t\t\treturn this.buildImportService(cwd) as ServiceMap[S]\n\t\t\tcase 'build': {\n\t\t\t\tconst commandService = new CommandService(cwd)\n\t\t\t\treturn new BuildService(\n\t\t\t\t\tcommandService,\n\t\t\t\t\tnew LintService(cwd, () => this.Service(cwd, 'command'))\n\t\t\t\t) as ServiceMap[S]\n\t\t\t}\n\t\t\tcase 'eventCache':\n\t\t\t\treturn new (Class ?? EventCacheService)(\n\t\t\t\t\tnew SettingsService(cwd)\n\t\t\t\t) as ServiceMap[S]\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`Service \"${type}\" not found`)\n\t\t}\n\t}\n\n\tprivate buildImportService(cwd: string): ImportService {\n\t\treturn new ImportService({\n\t\t\tcwd,\n\t\t\tcommand: new CommandService(cwd),\n\t\t})\n\t}\n\n\tpublic static reset() {\n\t\tthis.serviceClassOverides = {}\n\t}\n\n\tpublic static setFactoryClass(name: string, Class: any) {\n\t\tthis.serviceClassOverides[name] = Class\n\t}\n}\n\nexport interface ServiceMap {\n\tpkg: PkgService\n\tvsCode: VsCodeService\n\tschema: SchemaService\n\tlint: LintService\n\tcommand: CommandService\n\ttypeChecker: TypeCheckerService\n\timport: ImportService\n\tbuild: BuildService\n\tsettings: SettingsService\n\tenv: EnvService\n\tauth: AuthService\n\tremote: RemoteService\n\teventCache: EventCacheService\n\tdependency: DependencyService\n}\n\nexport type Service = keyof ServiceMap\n\nexport interface ServiceProvider {\n\tService<S extends Service>(type: S, cwd?: string): ServiceMap[S]\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,cAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,eAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,kBAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,cAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,YAAA,GAAAR,sBAAA,CAAAF,OAAA;AACA,IAAAW,WAAA,GAAAT,sBAAA,CAAAF,OAAA;AACA,IAAAY,mBAAA,GAAAV,sBAAA,CAAAF,OAAA;AAAqD,IAEhCa,cAAc,GAAAC,OAAA;EAAA,SAAAD,eAAA;IAAA,IAAAE,gBAAA,mBAAAF,cAAA;EAAA;EAAA,WAAAG,aAAA,aAAAH,cAAA;IAAAI,GAAA;IAAAC,KAAA,YAAAC,QAAA;MAAA,SAAAC,QAAAC,EAAA,EAAAC,GAAA;QAAA,OAAAH,QAAA,CA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AK;IACxC;EAAC;AAAA;AAAA,IAAA0B,gBAAA,aA9EmB1C,cAAc,0BACwB,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +1,11 @@
1
+ import * as ts from 'typescript';
2
+ declare const introspectionUtil: {
3
+ introspect(tsFiles: string[]): Introspection[];
4
+ getExports(sourceFile: ts.SourceFile): ts.Node[];
5
+ getClassDeclarationFromImportedFile(exportDeclaration: ts.Node, dirName: string, program: ts.Program): ts.ClassDeclaration | undefined;
6
+ hasClassDefinition(sourceFile: ts.SourceFile): boolean;
7
+ };
8
+ export default introspectionUtil;
1
9
  export interface IntrospectionClass {
2
10
  className: string;
3
11
  classPath: string;
@@ -15,7 +23,3 @@ export interface Introspection {
15
23
  classes: IntrospectionClass[];
16
24
  interfaces: IntrospectionInterface[];
17
25
  }
18
- declare const introspectionUtil: {
19
- introspect(tsFiles: string[]): Introspection[];
20
- };
21
- export default introspectionUtil;
@@ -6,6 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _path = require("path");
11
+ var _spruceSkillUtils = require("@sprucelabs/spruce-skill-utils");
9
12
  var _lodash = _interopRequireDefault(require("lodash"));
10
13
  var tsutils = _interopRequireWildcard(require("tsutils"));
11
14
  var ts = _interopRequireWildcard(require("typescript"));
@@ -42,6 +45,7 @@ var serializeSignature = function serializeSignature(options) {
42
45
  };
43
46
  var introspectionUtil = {
44
47
  introspect: function introspect(tsFiles) {
48
+ var _this = this;
45
49
  var filePaths = tsFiles;
46
50
  var program = ts.createProgram(filePaths, {});
47
51
  var checker = program.getTypeChecker();
@@ -56,49 +60,46 @@ var introspectionUtil = {
56
60
  interfaces: []
57
61
  };
58
62
  if (sourceFile && _lodash["default"].includes(filePaths, sourceFile.fileName)) {
59
- ts.forEachChild(sourceFile, function (node) {
60
- // if this is a class declaration
61
- if (ts.isClassDeclaration(node) && node.name) {
62
- var symbol = checker.getSymbolAtLocation(node.name);
63
- if (symbol !== null && symbol !== void 0 && symbol.valueDeclaration) {
64
- var _parentClassSymbol, _parentClassSymbol2, _details$constructors;
65
- var details = serializeSymbol({
66
- checker: checker,
67
- symbol: symbol
68
- });
69
- // Get the construct signatures
70
- var constructorType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
71
- var parentClassSymbol;
72
- if (node.heritageClauses && node.heritageClauses[0]) {
73
- parentClassSymbol = checker.getTypeAtLocation(node.heritageClauses[0].types[0]).getSymbol();
74
- }
75
- var parentClassName = // @ts-ignore
76
- (_parentClassSymbol = parentClassSymbol) === null || _parentClassSymbol === void 0 || (_parentClassSymbol = _parentClassSymbol.valueDeclaration) === null || _parentClassSymbol === void 0 || (_parentClassSymbol = _parentClassSymbol.name) === null || _parentClassSymbol === void 0 ? void 0 : _parentClassSymbol.text;
77
- // @ts-ignore
78
- var parentClassPath = (_parentClassSymbol2 = parentClassSymbol) === null || _parentClassSymbol2 === void 0 || (_parentClassSymbol2 = _parentClassSymbol2.parent) === null || _parentClassSymbol2 === void 0 ? void 0 : _parentClassSymbol2.getName().replace('"', '');
79
- var isAbstractClass = tsutils.isModifierFlagSet(node, ts.ModifierFlags.Abstract);
80
- details.constructors = constructorType.getConstructSignatures().map(function (s) {
81
- return serializeSignature({
82
- signature: s,
83
- checker: checker
63
+ if (!_this.hasClassDefinition(sourceFile)) {
64
+ var exports = _this.getExports(sourceFile);
65
+ var firstExport = exports[0];
66
+ if (firstExport) {
67
+ var declaration = _this.getClassDeclarationFromImportedFile(firstExport, (0, _path.dirname)(tsFile), program);
68
+ if (declaration) {
69
+ var _results$classes, _results$interfaces;
70
+ var _getDeclarationsFromN = getDeclarationsFromNode(declaration, checker, sourceFile),
71
+ classes = _getDeclarationsFromN.classes,
72
+ interfaces = _getDeclarationsFromN.interfaces;
73
+ (_results$classes = results.classes).push.apply(_results$classes, (0, _toConsumableArray2["default"])(classes));
74
+ (_results$interfaces = results.interfaces).push.apply(_results$interfaces, (0, _toConsumableArray2["default"])(interfaces));
75
+ } else {
76
+ var _firstExport$exportCl;
77
+ // must have imported from somewhere else (another node module)
78
+ var className = //@ts-ignore
79
+ (_firstExport$exportCl = firstExport.exportClause) === null || _firstExport$exportCl === void 0 || (_firstExport$exportCl = _firstExport$exportCl.elements) === null || _firstExport$exportCl === void 0 || (_firstExport$exportCl = _firstExport$exportCl[0]) === null || _firstExport$exportCl === void 0 || (_firstExport$exportCl = _firstExport$exportCl.propertyName) === null || _firstExport$exportCl === void 0 ? void 0 : _firstExport$exportCl.text;
80
+ if (className) {
81
+ results.classes.push({
82
+ className: className,
83
+ classPath: tsFile,
84
+ isAbstract: false,
85
+ optionsInterfaceName: undefined,
86
+ parentClassName: undefined,
87
+ parentClassPath: undefined,
88
+ staticProperties: {}
84
89
  });
85
- });
86
- results.classes.push({
87
- className: node.name.text,
88
- classPath: sourceFile.fileName,
89
- parentClassName: parentClassName,
90
- parentClassPath: parentClassPath,
91
- staticProperties: pluckStaticProperties(node),
92
- optionsInterfaceName: (_details$constructors = details.constructors) === null || _details$constructors === void 0 || (_details$constructors = _details$constructors[0].parameters) === null || _details$constructors === void 0 || (_details$constructors = _details$constructors[0]) === null || _details$constructors === void 0 ? void 0 : _details$constructors.type,
93
- isAbstract: isAbstractClass
94
- });
90
+ }
95
91
  }
96
- } else if (ts.isInterfaceDeclaration(node)) {
97
- results.interfaces.push({
98
- interfaceName: node.name.text
99
- });
100
92
  }
101
- });
93
+ } else {
94
+ ts.forEachChild(sourceFile, function (node) {
95
+ var _results$classes2, _results$interfaces2;
96
+ var _getDeclarationsFromN2 = getDeclarationsFromNode(node, checker, sourceFile),
97
+ classes = _getDeclarationsFromN2.classes,
98
+ interfaces = _getDeclarationsFromN2.interfaces;
99
+ (_results$classes2 = results.classes).push.apply(_results$classes2, (0, _toConsumableArray2["default"])(classes));
100
+ (_results$interfaces2 = results.interfaces).push.apply(_results$interfaces2, (0, _toConsumableArray2["default"])(interfaces));
101
+ });
102
+ }
102
103
  }
103
104
  introspects.push(results);
104
105
  };
@@ -106,17 +107,159 @@ var introspectionUtil = {
106
107
  _loop();
107
108
  }
108
109
  return introspects;
110
+ },
111
+ getExports: function getExports(sourceFile) {
112
+ var exports = [];
113
+ var traverse = function traverse(node) {
114
+ if (ts.isExportDeclaration(node)) {
115
+ exports.push(node);
116
+ }
117
+ ts.forEachChild(node, traverse);
118
+ };
119
+ traverse(sourceFile);
120
+ return exports;
121
+ },
122
+ getClassDeclarationFromImportedFile: function getClassDeclarationFromImportedFile(exportDeclaration, dirName, program) {
123
+ if (!ts.isExportDeclaration(exportDeclaration)) {
124
+ return undefined;
125
+ }
126
+ var exportClause = exportDeclaration.exportClause;
127
+ if (!exportClause || !ts.isNamedExports(exportClause)) {
128
+ return undefined;
129
+ }
130
+ var _iterator = _createForOfIteratorHelper(exportClause.elements),
131
+ _step;
132
+ try {
133
+ var _loop2 = function _loop2() {
134
+ var element = _step.value;
135
+ if (element.propertyName) {
136
+ var propertyName = element.propertyName.text;
137
+ var moduleSpecifier = exportDeclaration.moduleSpecifier.text;
138
+ var sourceFile = _spruceSkillUtils.diskUtil.resolveFile(dirName, moduleSpecifier.replace(/^\.\//, ''));
139
+ if (!sourceFile) {
140
+ return {
141
+ v: undefined
142
+ };
143
+ }
144
+
145
+ // Load the source file containing the class declaration
146
+ var declarationSourceFile = program.getSourceFile(sourceFile);
147
+ if (!declarationSourceFile) {
148
+ return {
149
+ v: undefined
150
+ };
151
+ }
152
+ var traverse = function traverse(node) {
153
+ if (ts.isClassDeclaration(node) && node.name && node.name.text === propertyName) {
154
+ return node;
155
+ }
156
+ var _iterator2 = _createForOfIteratorHelper(node.getChildren(declarationSourceFile)),
157
+ _step2;
158
+ try {
159
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
160
+ var child = _step2.value;
161
+ var result = traverse(child);
162
+ if (result) {
163
+ return result;
164
+ }
165
+ }
166
+ } catch (err) {
167
+ _iterator2.e(err);
168
+ } finally {
169
+ _iterator2.f();
170
+ }
171
+ return undefined;
172
+ };
173
+ return {
174
+ v: traverse(declarationSourceFile)
175
+ };
176
+ }
177
+ },
178
+ _ret;
179
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
180
+ _ret = _loop2();
181
+ if (_ret) return _ret.v;
182
+ }
183
+ } catch (err) {
184
+ _iterator.e(err);
185
+ } finally {
186
+ _iterator.f();
187
+ }
188
+ return undefined;
189
+ },
190
+ hasClassDefinition: function hasClassDefinition(sourceFile) {
191
+ var hasClass = false;
192
+ var traverse = function traverse(node) {
193
+ if (ts.isClassDeclaration(node)) {
194
+ hasClass = true;
195
+ }
196
+ if (!hasClass) {
197
+ ts.forEachChild(node, traverse);
198
+ }
199
+ };
200
+ traverse(sourceFile);
201
+ return hasClass;
109
202
  }
110
203
  };
111
204
  var _default = exports["default"] = introspectionUtil;
205
+ function getDeclarationsFromNode(node, checker, sourceFile) {
206
+ var classes = [];
207
+ var interfaces = [];
208
+
209
+ // if this is a class declaration
210
+ if (ts.isClassDeclaration(node) && node.name) {
211
+ var symbol = checker.getSymbolAtLocation(node.name);
212
+ if (symbol !== null && symbol !== void 0 && symbol.valueDeclaration) {
213
+ var _parentClassSymbol, _parentClassSymbol2, _details$constructors;
214
+ var details = serializeSymbol({
215
+ checker: checker,
216
+ symbol: symbol
217
+ });
218
+ // Get the construct signatures
219
+ var constructorType = checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
220
+ var parentClassSymbol;
221
+ if (node.heritageClauses && node.heritageClauses[0]) {
222
+ parentClassSymbol = checker.getTypeAtLocation(node.heritageClauses[0].types[0]).getSymbol();
223
+ }
224
+ var parentClassName = // @ts-ignore
225
+ (_parentClassSymbol = parentClassSymbol) === null || _parentClassSymbol === void 0 || (_parentClassSymbol = _parentClassSymbol.valueDeclaration) === null || _parentClassSymbol === void 0 || (_parentClassSymbol = _parentClassSymbol.name) === null || _parentClassSymbol === void 0 ? void 0 : _parentClassSymbol.text;
226
+ // @ts-ignore
227
+ var parentClassPath = (_parentClassSymbol2 = parentClassSymbol) === null || _parentClassSymbol2 === void 0 || (_parentClassSymbol2 = _parentClassSymbol2.parent) === null || _parentClassSymbol2 === void 0 ? void 0 : _parentClassSymbol2.getName().replace('"', '');
228
+ var isAbstractClass = tsutils.isModifierFlagSet(node, ts.ModifierFlags.Abstract);
229
+ details.constructors = constructorType.getConstructSignatures().map(function (s) {
230
+ return serializeSignature({
231
+ signature: s,
232
+ checker: checker
233
+ });
234
+ });
235
+ classes.push({
236
+ className: node.name.text,
237
+ classPath: sourceFile.fileName,
238
+ parentClassName: parentClassName,
239
+ parentClassPath: parentClassPath,
240
+ staticProperties: pluckStaticProperties(node),
241
+ optionsInterfaceName: (_details$constructors = details.constructors) === null || _details$constructors === void 0 || (_details$constructors = _details$constructors[0].parameters) === null || _details$constructors === void 0 || (_details$constructors = _details$constructors[0]) === null || _details$constructors === void 0 ? void 0 : _details$constructors.type,
242
+ isAbstract: isAbstractClass
243
+ });
244
+ }
245
+ } else if (ts.isInterfaceDeclaration(node)) {
246
+ interfaces.push({
247
+ interfaceName: node.name.text
248
+ });
249
+ }
250
+ return {
251
+ classes: classes,
252
+ interfaces: interfaces
253
+ };
254
+ }
112
255
  function pluckStaticProperties(node) {
113
256
  var staticProps = {};
114
- var _iterator = _createForOfIteratorHelper(node.members),
115
- _step;
257
+ var _iterator3 = _createForOfIteratorHelper(node.members),
258
+ _step3;
116
259
  try {
117
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
260
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
118
261
  var _member$name, _member$initializer;
119
- var member = _step.value;
262
+ var member = _step3.value;
120
263
  //@ts-ignore
121
264
  var name = (_member$name = member.name) === null || _member$name === void 0 ? void 0 : _member$name.escapedText;
122
265
  //@ts-ignore
@@ -126,9 +269,9 @@ function pluckStaticProperties(node) {
126
269
  }
127
270
  }
128
271
  } catch (err) {
129
- _iterator.e(err);
272
+ _iterator3.e(err);
130
273
  } finally {
131
- _iterator.f();
274
+ _iterator3.f();
132
275
  }
133
276
  return staticProps;
134
277
  }