UNPKG

1.6 kBSource Map (JSON)View Raw
1{"version":3,"file":"utils.js","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA6D;AAC7D,2DAAuE;AAEvE,SAAgB,UAAU,CAAC,IAAU;IACnC,OAAO;QACC,QAAQ,CAAC,IAAY;;gBACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC7B,IAAI,CAAC,IAAI,EAAE;oBACT,MAAM,IAAI,gCAAmB,CAAC,iBAAiB,CAAC,CAAC;iBAClD;gBACD,OAAO,gBAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;YAC5C,CAAC;SAAA;QACK,SAAS,CAAC,IAAY,EAAE,IAAY;;gBACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACpC,CAAC;SAAA;QACK,WAAW,CAAC,IAAY;;gBAC5B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YACrE,CAAC;SAAA;QACK,MAAM,CAAC,IAAY;;gBACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC;SAAA;KACF,CAAC;AACJ,CAAC;AAnBD,gCAmBC","sourcesContent":["import { virtualFs, workspaces } from '@angular-devkit/core';\nimport { SchematicsException, Tree } from '@angular-devkit/schematics';\n\nexport function createHost(tree: Tree): workspaces.WorkspaceHost {\n return {\n async readFile(path: string): Promise<string> {\n const data = tree.read(path);\n if (!data) {\n throw new SchematicsException('File not found.');\n }\n return virtualFs.fileBufferToString(data);\n },\n async writeFile(path: string, data: string): Promise<void> {\n return tree.overwrite(path, data);\n },\n async isDirectory(path: string): Promise<boolean> {\n return !tree.exists(path) && tree.getDir(path).subfiles.length > 0;\n },\n async isFile(path: string): Promise<boolean> {\n return tree.exists(path);\n }\n };\n}\n"]}
\No newline at end of file