ng-packagr 12.0.1 → 12.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.
@@ -93,7 +93,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
93
93
  cache.content = stylesheetProcessor.process(fileName);
94
94
  }
95
95
  catch (err) {
96
- log_1.error('\n' + err.message);
96
+ log_1.error('\n' + err.message + ` in stylesheet file ${fileName}.`);
97
97
  throw err;
98
98
  }
99
99
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../src/lib/ts/cache-compiler-host.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,4CAA4C;AAC5C,6BAA6B;AAC7B,wCAA+C;AAC/C,sCAAqC;AAErC,+CAA8D;AAG9D,wCAAqC;AAErC,SAAgB,iBAAiB,CAC/B,KAAiB,EACjB,UAA0B,EAC1B,eAAmC,EACnC,qBAA+C,EAC/C,mBAAyC,EACzC,mBAA8B,UAAU,CAAC,KAAK,CAAC,gBAAgB,EAC/D,cAAc,GAAG,IAAI;IAErB,MAAM,MAAM,GAAG,EAAE,CAAC,kBAAkB,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IACtE,MAAM,YAAY,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC;IAEjF,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,eAAO,CAAC,qBAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,IAAI,WAAI,CAAC,OAAO,CAAC,CAAC;YACzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACjB;QAED,OAAO,IAAI,CAA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CAAC;KACF,CAAC;AACJ,CAAC;AA/ID,8CA+IC","sourcesContent":["import * as ts from 'typescript';\nimport * as ng from '@angular/compiler-cli';\nimport * as path from 'path';\nimport { ensureUnixPath } from '../utils/path';\nimport { error } from '../utils/log';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { EntryPointNode, fileUrl } from '../ng-package/nodes';\nimport { BuildGraph } from '../graph/build-graph';\nimport { FileCache } from '../file-system/file-cache';\nimport { Node } from '../graph/node';\n\nexport function cacheCompilerHost(\n graph: BuildGraph,\n entryPoint: EntryPointNode,\n compilerOptions: ng.CompilerOptions,\n moduleResolutionCache: ts.ModuleResolutionCache,\n stylesheetProcessor?: StylesheetProcessor,\n sourcesFileCache: FileCache = entryPoint.cache.sourcesFileCache,\n setParentNodes = true,\n): ng.CompilerHost {\n const tsHost = ts.createCompilerHost(compilerOptions, setParentNodes);\n const compilerHost = ng.createCompilerHost({ options: compilerOptions, tsHost });\n\n const getNode = (fileName: string) => {\n const nodeUri = fileUrl(ensureUnixPath(fileName));\n let node = graph.get(nodeUri);\n\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n\n return node;\n };\n\n const addDependee = (fileName: string) => {\n const node = getNode(fileName);\n entryPoint.dependsOn(node);\n };\n\n return {\n ...compilerHost,\n\n // ts specific\n fileExists: (fileName: string) => {\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.exists === undefined) {\n cache.exists = compilerHost.fileExists.call(this, fileName);\n }\n return cache.exists;\n },\n\n getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (!cache.sourceFile) {\n cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);\n }\n return cache.sourceFile;\n },\n\n writeFile: (\n fileName: string,\n data: string,\n writeByteOrderMark: boolean,\n onError?: (message: string) => void,\n sourceFiles?: ReadonlyArray<ts.SourceFile>,\n ) => {\n if (fileName.endsWith('.d.ts')) {\n sourceFiles.forEach(source => {\n const cache = sourcesFileCache.getOrCreate(source.fileName);\n if (!cache.declarationFileName) {\n cache.declarationFileName = ensureUnixPath(fileName);\n }\n });\n }\n\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n },\n\n readFile: (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = compilerHost.readFile.call(this, fileName);\n }\n return cache.content;\n },\n\n // ng specific\n moduleNameToFileName: (moduleName: string, containingFile: string) => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule && resolvedModule.resolvedFileName;\n },\n\n resolveModuleNames: (moduleNames: string[], containingFile: string) => {\n return moduleNames.map(moduleName => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule;\n });\n },\n\n resourceNameToFileName: (resourceName: string, containingFilePath: string) => {\n const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);\n const containingNode = getNode(containingFilePath);\n const resourceNode = getNode(resourcePath);\n containingNode.dependsOn(resourceNode);\n\n return resourcePath;\n },\n\n readResource: (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n if (/(html|htm|svg)$/.test(path.extname(fileName))) {\n // template\n cache.content = compilerHost.readFile.call(this, fileName);\n } else {\n // stylesheet\n try {\n cache.content = stylesheetProcessor.process(fileName);\n } catch (err) {\n error('\\n' + err.message);\n throw err;\n }\n }\n\n if (cache.content === undefined) {\n throw new Error(`Cannot read file ${fileName}.`);\n };\n\n cache.exists = true;\n }\n\n return cache.content;\n },\n };\n}\n"]}
1
+ {"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../src/lib/ts/cache-compiler-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ACjC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAEtB,MAAM,KAAK,GAAG,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACrD,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC/B,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE;oBAClD,WAAW;oBACX,KAAK,CAAC,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;iBAC5D;qBAAM;oBACL,aAAa;oBACb,IAAI;wBACF,KAAK,CAAC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;qBACvD;oBAAC,OAAO,GAAG,EAAE;wBACZ,WAAK,CAAC,IAAI,GAAG,GAAG,CAAC,OAAO,GAAG,uBAAuB,QAAQ,GAAG,CAAC,CAAC;wBAC/D,MAAM,GAAG,CAAC;qBACX;iBACF;gBAED,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;oBAC/B,MAAM,IAAI,KAAK,CAAC,oBAAoB,QAAQ,GAAG,CAAC,CAAC;iBAClD;gBAAA,CAAC;gBAEF,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;aACrB;YAED,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC;AA/ID,8CA+IC","sourcesContent":["import * as ts from 'typescript';\nimport * as ng from '@angular/compiler-cli';\nimport * as path from 'path';\nimport { ensureUnixPath } from '../utils/path';\nimport { error } from '../utils/log';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { EntryPointNode, fileUrl } from '../ng-package/nodes';\nimport { BuildGraph } from '../graph/build-graph';\nimport { FileCache } from '../file-system/file-cache';\nimport { Node } from '../graph/node';\n\nexport function cacheCompilerHost(\n graph: BuildGraph,\n entryPoint: EntryPointNode,\n compilerOptions: ng.CompilerOptions,\n moduleResolutionCache: ts.ModuleResolutionCache,\n stylesheetProcessor?: StylesheetProcessor,\n sourcesFileCache: FileCache = entryPoint.cache.sourcesFileCache,\n setParentNodes = true,\n): ng.CompilerHost {\n const tsHost = ts.createCompilerHost(compilerOptions, setParentNodes);\n const compilerHost = ng.createCompilerHost({ options: compilerOptions, tsHost });\n\n const getNode = (fileName: string) => {\n const nodeUri = fileUrl(ensureUnixPath(fileName));\n let node = graph.get(nodeUri);\n\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n\n return node;\n };\n\n const addDependee = (fileName: string) => {\n const node = getNode(fileName);\n entryPoint.dependsOn(node);\n };\n\n return {\n ...compilerHost,\n\n // ts specific\n fileExists: (fileName: string) => {\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.exists === undefined) {\n cache.exists = compilerHost.fileExists.call(this, fileName);\n }\n return cache.exists;\n },\n\n getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (!cache.sourceFile) {\n cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);\n }\n return cache.sourceFile;\n },\n\n writeFile: (\n fileName: string,\n data: string,\n writeByteOrderMark: boolean,\n onError?: (message: string) => void,\n sourceFiles?: ReadonlyArray<ts.SourceFile>,\n ) => {\n if (fileName.endsWith('.d.ts')) {\n sourceFiles.forEach(source => {\n const cache = sourcesFileCache.getOrCreate(source.fileName);\n if (!cache.declarationFileName) {\n cache.declarationFileName = ensureUnixPath(fileName);\n }\n });\n }\n\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n },\n\n readFile: (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = compilerHost.readFile.call(this, fileName);\n }\n return cache.content;\n },\n\n // ng specific\n moduleNameToFileName: (moduleName: string, containingFile: string) => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule && resolvedModule.resolvedFileName;\n },\n\n resolveModuleNames: (moduleNames: string[], containingFile: string) => {\n return moduleNames.map(moduleName => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule;\n });\n },\n\n resourceNameToFileName: (resourceName: string, containingFilePath: string) => {\n const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);\n const containingNode = getNode(containingFilePath);\n const resourceNode = getNode(resourcePath);\n containingNode.dependsOn(resourceNode);\n\n return resourcePath;\n },\n\n readResource: (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n if (/(html|htm|svg)$/.test(path.extname(fileName))) {\n // template\n cache.content = compilerHost.readFile.call(this, fileName);\n } else {\n // stylesheet\n try {\n cache.content = stylesheetProcessor.process(fileName);\n } catch (err) {\n error('\\n' + err.message + ` in stylesheet file ${fileName}.`);\n throw err;\n }\n }\n\n if (cache.content === undefined) {\n throw new Error(`Cannot read file ${fileName}.`);\n };\n\n cache.exists = true;\n }\n\n return cache.content;\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "12.0.1",
3
+ "version": "12.0.2",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",