UNPKG

3.29 kBSource Map (JSON)View Raw
1{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../modules/schematics/src/reducer/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAeoC;AACpC,yDAS+B;AAG/B,mBAAyB,OAAuB;IAC9C,OAAO,UAAC,IAAU,EAAE,OAAyB;QAC3C,IAAM,aAAa,GAAG,IAAA,4BAAU,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,GAAG,IAAA,gCAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,OAAO,CAAC,MAAM,GAAG,IAAA,2BAAS,EAAC,OAAO,CAAC,CAAC;QAEpC,IAAM,UAAU,GAAG,IAAA,2BAAS,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,GAAG,IAAA,uCAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QAED,IAAM,eAAe,kCAChB,6BAAW,KACd,SAAS,EAAE,UAAC,CAAS;gBACnB,OAAA,6BAAW,CAAC,KAAK,CACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAChC;YAHD,CAGC,KACC,OAAkB,CACvB,CAAC;QAEF,IAAM,cAAc,GAAG,IAAA,kBAAK,EAAC,IAAA,gBAAG,EAAC,SAAS,CAAC,EAAE;YAC3C,OAAO,CAAC,SAAS;gBACf,CAAC,CAAC,IAAA,mBAAM,EAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAnC,CAAmC,CAAC;gBACvD,CAAC,CAAC,IAAA,iBAAI,GAAE;YACV,IAAA,2BAAc,EAAC,eAAe,CAAC;YAC/B,IAAA,iBAAI,EAAC,UAAU,CAAC,IAAI,CAAC;SACtB,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,2BAAc,EAAC,IAAA,kBAAK,EAAC,CAAC,IAAA,mCAAiB,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACnD,IAAA,2BAAc,EACZ,IAAA,kBAAK,EAAC,CAAC,IAAA,4CAA0B,EAAC,OAAO,CAAC,EAAE,IAAA,sBAAS,EAAC,cAAc,CAAC,CAAC,CAAC,CACxE;SACF,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAvCD,4BAuCC","sourcesContent":["import {\n Rule,\n SchematicContext,\n SchematicsException,\n Tree,\n apply,\n applyTemplates,\n branchAndMerge,\n chain,\n filter,\n mergeWith,\n move,\n noop,\n template,\n url,\n} from '@angular-devkit/schematics';\nimport {\n getProjectPath,\n findModuleFromOptions,\n stringUtils,\n addReducerToState,\n addReducerImportToNgModule,\n parseName,\n getProject,\n getPrefix,\n} from '../../schematics-core';\nimport { Schema as ReducerOptions } from './schema';\n\nexport default function (options: ReducerOptions): Rule {\n return (host: Tree, context: SchematicContext) => {\n const projectConfig = getProject(host, options);\n options.path = getProjectPath(host, options);\n options.prefix = getPrefix(options);\n\n const parsedPath = parseName(options.path, options.name);\n options.name = parsedPath.name;\n options.path = parsedPath.path;\n\n if (options.module) {\n options.module = findModuleFromOptions(host, options);\n }\n\n const templateOptions = {\n ...stringUtils,\n 'if-flat': (s: string) =>\n stringUtils.group(\n options.flat ? '' : s,\n options.group ? 'reducers' : ''\n ),\n ...(options as object),\n };\n\n const templateSource = apply(url('./files'), [\n options.skipTests\n ? filter((path) => !path.endsWith('.spec.ts.template'))\n : noop(),\n applyTemplates(templateOptions),\n move(parsedPath.path),\n ]);\n\n return chain([\n branchAndMerge(chain([addReducerToState(options)])),\n branchAndMerge(\n chain([addReducerImportToNgModule(options), mergeWith(templateSource)])\n ),\n ])(host, context);\n };\n}\n"]}
\No newline at end of file