@deepracticex/template
Version:
Template package demonstrating Deepractice package development standards
1 lines • 3.37 kB
Source Map (JSON)
{"version":3,"sources":["../src/index.ts","../src/core/processor.ts","../src/api/example.ts"],"sourcesContent":["/**\n * @deepracticex/template\n *\n * Template package demonstrating Deepractice package standards\n * - Layered architecture (api/types/core)\n * - Path aliases with ~\n * - Interface-first naming\n * - BDD testing with Cucumber\n */\n\n// Export public API\nexport { DefaultExample, createExample } from \"~/api/index\";\n\n// Export types\nexport type { Example, ExampleConfig, ExampleResult } from \"~/types/index\";\n\n// Default export - ready-to-use instance\nimport { createExample } from \"~/api/example\";\nexport default createExample();\n","/**\n * Core business logic - not exported\n * This is internal implementation that can be freely refactored\n */\nimport type { ExampleConfig } from \"~/types/config\";\n\nexport class Processor {\n private config: Required<ExampleConfig>;\n\n constructor(config: ExampleConfig = {}) {\n this.config = {\n enabled: config.enabled ?? true,\n timeout: config.timeout ?? 5000,\n debug: config.debug ?? false,\n };\n }\n\n async process(input: string): Promise<string> {\n if (!this.config.enabled) {\n throw new Error(\"Processor is disabled\");\n }\n\n if (this.config.debug) {\n console.log(`Processing: ${input}`);\n }\n\n // Simulate async processing\n await this.delay(100);\n\n return `Processed: ${input}`;\n }\n\n getStatus(): string {\n return this.config.enabled ? \"active\" : \"inactive\";\n }\n\n private delay(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n","/**\n * Main API implementation\n */\nimport type { Example, ExampleConfig } from \"~/types/index\";\nimport { Processor } from \"~/core/index\";\n\nexport class DefaultExample implements Example {\n private processor: Processor;\n\n constructor(config: ExampleConfig = {}) {\n this.processor = new Processor(config);\n }\n\n async execute(input: string): Promise<string> {\n return this.processor.process(input);\n }\n\n status(): string {\n return this.processor.getStatus();\n }\n\n dispose(): void {\n // Clean up resources if needed\n }\n}\n\n/**\n * Factory function to create an Example instance\n */\nexport function createExample(config: ExampleConfig = {}): Example {\n return new DefaultExample(config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,YAAN,MAAgB;AAAA,EACb;AAAA,EAER,YAAY,SAAwB,CAAC,GAAG;AACtC,SAAK,SAAS;AAAA,MACZ,SAAS,OAAO,WAAW;AAAA,MAC3B,SAAS,OAAO,WAAW;AAAA,MAC3B,OAAO,OAAO,SAAS;AAAA,IACzB;AAAA,EACF;AAAA,EAEA,MAAM,QAAQ,OAAgC;AAC5C,QAAI,CAAC,KAAK,OAAO,SAAS;AACxB,YAAM,IAAI,MAAM,uBAAuB;AAAA,IACzC;AAEA,QAAI,KAAK,OAAO,OAAO;AACrB,cAAQ,IAAI,eAAe,KAAK,EAAE;AAAA,IACpC;AAGA,UAAM,KAAK,MAAM,GAAG;AAEpB,WAAO,cAAc,KAAK;AAAA,EAC5B;AAAA,EAEA,YAAoB;AAClB,WAAO,KAAK,OAAO,UAAU,WAAW;AAAA,EAC1C;AAAA,EAEQ,MAAM,IAA2B;AACvC,WAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAAA,EACzD;AACF;;;ACjCO,IAAM,iBAAN,MAAwC;AAAA,EACrC;AAAA,EAER,YAAY,SAAwB,CAAC,GAAG;AACtC,SAAK,YAAY,IAAI,UAAU,MAAM;AAAA,EACvC;AAAA,EAEA,MAAM,QAAQ,OAAgC;AAC5C,WAAO,KAAK,UAAU,QAAQ,KAAK;AAAA,EACrC;AAAA,EAEA,SAAiB;AACf,WAAO,KAAK,UAAU,UAAU;AAAA,EAClC;AAAA,EAEA,UAAgB;AAAA,EAEhB;AACF;AAKO,SAAS,cAAc,SAAwB,CAAC,GAAY;AACjE,SAAO,IAAI,eAAe,MAAM;AAClC;;;AFbA,IAAO,gBAAQ,cAAc;","names":[]}