ng-packagr 4.0.0 → 4.2.0

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 (78) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +12 -12
  3. package/cli/main.d.ts +1 -0
  4. package/cli/main.js +4 -2
  5. package/cli/main.js.map +1 -1
  6. package/lib/brocc/build-graph.d.ts +1 -1
  7. package/lib/brocc/build-graph.js.map +1 -1
  8. package/lib/brocc/depth.js.map +1 -1
  9. package/lib/brocc/node.js.map +1 -1
  10. package/lib/brocc/select.js.map +1 -1
  11. package/lib/brocc/transform.di.js.map +1 -1
  12. package/lib/brocc/transform.js.map +1 -1
  13. package/lib/commands/build.command.d.ts +2 -0
  14. package/lib/commands/build.command.js +1 -0
  15. package/lib/commands/build.command.js.map +1 -1
  16. package/lib/commands/command.js.map +1 -1
  17. package/lib/file/file-cache.js +0 -1
  18. package/lib/file/file-cache.js.map +1 -1
  19. package/lib/file/file-watcher.js.map +1 -1
  20. package/lib/flatten/downlevel-transformer.js.map +1 -1
  21. package/lib/flatten/external-module-id-strategy.js.map +1 -1
  22. package/lib/flatten/flatten.js.map +1 -1
  23. package/lib/flatten/rollup.js +3 -0
  24. package/lib/flatten/rollup.js.map +1 -1
  25. package/lib/flatten/uglify.js.map +1 -1
  26. package/lib/flatten/umd-module-id-strategy.js.map +1 -1
  27. package/lib/ng-package-format/entry-point.d.ts +12 -12
  28. package/lib/ng-package-format/entry-point.js.map +1 -1
  29. package/lib/ng-package-format/package.d.ts +9 -9
  30. package/lib/ng-package-format/package.js.map +1 -1
  31. package/lib/ng-package-format/shared.d.ts +1 -1
  32. package/lib/ng-v5/discover-packages.js.map +1 -1
  33. package/lib/ng-v5/entry-point/resources/postcss-clean.js.map +1 -1
  34. package/lib/ng-v5/entry-point/resources/stylesheet-processor.d.ts +4 -4
  35. package/lib/ng-v5/entry-point/resources/stylesheet-processor.js +12 -10
  36. package/lib/ng-v5/entry-point/resources/stylesheet-processor.js.map +1 -1
  37. package/lib/ng-v5/entry-point/ts/compile-ngc.transform.js +7 -4
  38. package/lib/ng-v5/entry-point/ts/compile-ngc.transform.js.map +1 -1
  39. package/lib/ng-v5/entry-point/write-bundles.transform.js.map +1 -1
  40. package/lib/ng-v5/entry-point/write-package.transform.js +2 -1
  41. package/lib/ng-v5/entry-point/write-package.transform.js.map +1 -1
  42. package/lib/ng-v5/init/analyse-sources.transform.js +6 -4
  43. package/lib/ng-v5/init/analyse-sources.transform.js.map +1 -1
  44. package/lib/ng-v5/init/init-tsconfig.di.d.ts +1 -1
  45. package/lib/ng-v5/init/init-tsconfig.di.js.map +1 -1
  46. package/lib/ng-v5/init/init-tsconfig.transform.d.ts +1 -1
  47. package/lib/ng-v5/init/init-tsconfig.transform.js +1 -1
  48. package/lib/ng-v5/init/init-tsconfig.transform.js.map +1 -1
  49. package/lib/ng-v5/nodes.d.ts +3 -4
  50. package/lib/ng-v5/nodes.js +1 -2
  51. package/lib/ng-v5/nodes.js.map +1 -1
  52. package/lib/ng-v5/package.di.js.map +1 -1
  53. package/lib/ng-v5/package.transform.js +15 -23
  54. package/lib/ng-v5/package.transform.js.map +1 -1
  55. package/lib/ng-v5/packagr.d.ts +2 -2
  56. package/lib/ng-v5/packagr.js.map +1 -1
  57. package/lib/ngc/compile-source-files.d.ts +1 -2
  58. package/lib/ngc/compile-source-files.js +2 -15
  59. package/lib/ngc/compile-source-files.js.map +1 -1
  60. package/lib/ngc/create-emit-callback.js +2 -2
  61. package/lib/ngc/create-emit-callback.js.map +1 -1
  62. package/lib/ts/cache-compiler-host.js.map +1 -1
  63. package/lib/ts/conf/tsconfig.ngc.json +0 -2
  64. package/lib/ts/redirect-write-file-compiler-host.js +1 -1
  65. package/lib/ts/redirect-write-file-compiler-host.js.map +1 -1
  66. package/lib/ts/tsconfig.d.ts +14 -7
  67. package/lib/ts/tsconfig.js +69 -54
  68. package/lib/ts/tsconfig.js.map +1 -1
  69. package/lib/util/array.js.map +1 -1
  70. package/lib/util/copy.d.ts +2 -2
  71. package/lib/util/copy.js +5 -18
  72. package/lib/util/copy.js.map +1 -1
  73. package/lib/util/glob.js.map +1 -1
  74. package/lib/util/log.js.map +1 -1
  75. package/lib/util/path.js.map +1 -1
  76. package/lib/util/promisify.js.map +1 -1
  77. package/lib/util/rimraf.js.map +1 -1
  78. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../src/lib/ng-package-format/entry-point.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAK7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;IACE,+DAA+D;IAC/C,WAAgB;IAChC,wGAAwG;IACxF,aAA8B;IAC9C,gFAAgF;IAC/D,OAAqC;IACtD,6EAA6E;IAC7D,QAAgB;IAChC,gGAAgG;IAC/E,aAAsC;QARvC,gBAAW,GAAX,WAAW,CAAK;QAEhB,kBAAa,GAAb,aAAa,CAAiB;QAE7B,YAAO,GAAP,OAAO,CAA8B;QAEtC,aAAQ,GAAR,QAAQ,CAAQ;QAEf,kBAAa,GAAb,aAAa,CAAyB;IACtD,CAAC;IAEJ,sEAAsE;IACtE,IAAW,aAAa;QACtB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,iDAAiD;IACjD,IAAW,qBAAqB;QAC9B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,oEAAoE;IACpE,IAAW,eAAe;QACxB,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;QAC5C,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,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C;QAClC,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACd,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACd,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC;IACjD,CAAC;IAEO,eAAe,CAAC,YAAoB,GAAG;QAC7C,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,QAAQ;iBACjB,SAAS,CAAC,CAAC,CAAC;iBACZ,KAAK,CAAC,GAAG,CAAC;iBACV,IAAI,CAAC,SAAS,CAAC,CAAC;QACrB,CAAC;QAAC,IAAI,CAAC,CAAC;YACN,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACH,IAAW,WAAW;QACpB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC;IAClD,CAAC;CACF;AA/ID,oCA+IC","sourcesContent":["import * as path from 'path';\nimport { SchemaClass } from '@ngtools/json-schema';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { DirectoryPath, SourceFilePath, CssUrl, DestinationFiles } from './shared';\n\n/**\n * An entry point - quoting Angular Package Format - is:\n *\n * > a module intended to be imported by the user. It is referenced by a unique module ID and\n * > exports the public API referenced by that module ID. An example is `@angular/core` or\n * > `@angular/core/testing`. Both entry points exist in the `@angular/core` package, but they\n * > export different symbols. A package can have many entry points.\n *\n * #### Public API, source file tree and build output\n *\n * An entry point serves as the root of a source tree.\n * The entry point's public API references one TypeScript source file (`*.ts`).\n * That source file, e.g. `public_api.ts`, references other source files who in turn may reference\n * other source files, thus creating a tree of source code files.\n * The source files may be TypeScript (`*.ts`), Templates (`.html`) or Stylesheets\n * (`.css`, `.scss`, ..), or other formats.\n *\n * The compilation process for an entry point is a series of transformations applied to the source\n * files, e.g. TypeScript compilation, Inlining of Stylesheets and Templates, and so on.\n * As a result of the compilation process, an entry point is transpiled to a set of artefacts\n * (the build output) which include a FESM'15 Bundle, a FESM'5 Bundle, AoT metadata, TypeScript\n * type definitions, and so on.\n *\n * #### Representation in the domain\n *\n * The set of artefacts is reflected by `NgArtefacts`;\n * one `NgEntryPoint` relates to one `NgArtefacts`.\n * The parent package of an entry point is reflected by `NgPackage`.\n */\nexport class NgEntryPoint {\n constructor(\n /** Values from the `package.json` file of this entry point. */\n public readonly packageJson: any,\n /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */\n public readonly ngPackageJson: NgPackageConfig,\n /** Corresponding JSON schema class instantiated from `ngPackageJson` values. */\n private readonly $schema: SchemaClass<NgPackageConfig>,\n /** Absolute directory path of this entry point's `package.json` location. */\n public readonly basePath: string,\n /** XX: additional auto-configured data passed for scondary entry point's. Needs better docs. */\n private readonly secondaryData?: { [key: string]: any }\n ) {}\n\n /** Absolute file path of the entry point's source code entry file. */\n public get entryFilePath(): SourceFilePath {\n return path.resolve(this.basePath, this.entryFile);\n }\n\n /** Whether or not the entrypoint is secondary */\n public get isSecondaryEntryPoint(): boolean {\n return !!this.secondaryData;\n }\n\n /** Absolute directory path of this entry point's 'package.json'. */\n public get destinationPath(): DirectoryPath {\n if (this.secondaryData) {\n return this.secondaryData.destinationPath;\n } else {\n return path.resolve(this.basePath, this.$get('dest'));\n }\n }\n\n public get destinationFiles(): DestinationFiles {\n let primaryDestPath = this.destinationPath;\n let secondaryDir = '';\n\n if (this.secondaryData) {\n primaryDestPath = this.secondaryData.primaryDestinationPath;\n secondaryDir = path.relative(primaryDestPath, this.secondaryData.destinationPath);\n }\n\n const flatModuleFile = this.flatModuleFile;\n const pathJoinWithDest = (...paths: string[]) => path.join(primaryDestPath, ...paths);\n\n return {\n metadata: pathJoinWithDest(secondaryDir, `${flatModuleFile}.metadata.json`),\n declarations: pathJoinWithDest(secondaryDir, `${flatModuleFile}.d.ts`),\n esm2015: pathJoinWithDest('esm2015', secondaryDir, `${flatModuleFile}.js`),\n esm5: pathJoinWithDest('esm5', secondaryDir, `${flatModuleFile}.js`),\n fesm2015: pathJoinWithDest('fesm2015', `${flatModuleFile}.js`),\n fesm5: pathJoinWithDest('fesm5', `${flatModuleFile}.js`),\n umd: pathJoinWithDest('bundles', `${flatModuleFile}.umd.js`),\n umdMinified: pathJoinWithDest('bundles', `${flatModuleFile}.umd.min.js`)\n };\n }\n\n public $get(key: string): any {\n return this.$schema.$$get(key);\n }\n\n public get entryFile(): SourceFilePath {\n return this.$get('lib.entryFile');\n }\n\n public get cssUrl(): CssUrl {\n return this.$get('lib.cssUrl');\n }\n\n public get umdModuleIds(): { [key: string]: string } {\n return this.$get('lib.umdModuleIds');\n }\n\n public get jsxConfig(): string {\n return this.$get('lib.jsx');\n }\n\n public get flatModuleFile(): string {\n return this.$get('lib.flatModuleFile') || this.flattenModuleId('-');\n }\n\n public get styleIncludePaths(): string[] {\n const includePaths = this.$get('lib.styleIncludePaths') || [];\n return includePaths.map(\n includePath => (path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath))\n );\n }\n\n public get languageLevel(): string[] {\n return this.$get('lib.languageLevel');\n }\n\n /**\n * The module ID is an \"identifier of a module used in the import statements, e.g.\n * '@angular/core'. The ID often maps directly to a path on the filesystem, but this\n * is not always the case due to various module resolution strategies.\"\n */\n public get moduleId(): string {\n if (this.secondaryData) {\n return this.secondaryData.moduleId;\n } else {\n return this.packageJson['name'];\n }\n }\n\n /**\n * The UMD module ID registers a module on the old-fashioned JavaScript global scope.\n * Used by UMD bundles only.\n * Example: `@my/foo/bar` registers as `global['my']['foo']['bar']`.\n */\n public get umdId(): string {\n return this.$get('lib.umdId') || this.flattenModuleId();\n }\n\n /**\n * The AMD ID reflects a named module that is distributed in the UMD bundles.\n * @link http://requirejs.org/docs/whyamd.html#namedmodules\n */\n public get amdId(): string {\n return this.$get('lib.amdId') || this.moduleId;\n }\n\n private flattenModuleId(separator: string = '.') {\n if (this.moduleId.startsWith('@')) {\n return this.moduleId\n .substring(1)\n .split('/')\n .join(separator);\n } else {\n return this.moduleId.split('/').join(separator);\n }\n }\n\n /**\n * Enables the `\"sideEffects\": false` flag in `package.json`.\n * The flag is enabled and set to `false` by default which results in more aggressive optimizations applied by webpack v4 builds consuming the library.\n * To override the default behaviour, you need to set `\"sideEffects\": true` explicitly in your `package.json`.\n *\n * @link https://github.com/webpack/webpack/tree/master/examples/side-effects\n */\n public get sideEffects(): boolean | string[] {\n return this.packageJson['sideEffects'] || false;\n }\n}\n"]}
1
+ {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../src/lib/ng-package-format/entry-point.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAK7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE;IACE,+DAA+D;IAC/C,WAAgB;IAChC,wGAAwG;IACxF,aAA8B;IAC9C,gFAAgF;IAC/D,OAAqC;IACtD,6EAA6E;IAC7D,QAAgB;IAChC,gGAAgG;IAC/E,aAAsC;QARvC,gBAAW,GAAX,WAAW,CAAK;QAEhB,kBAAa,GAAb,aAAa,CAAiB;QAE7B,YAAO,GAAP,OAAO,CAA8B;QAEtC,aAAQ,GAAR,QAAQ,CAAQ;QAEf,kBAAa,GAAb,aAAa,CAAyB;IACtD,CAAC;IAEJ,sEAAsE;IACtE,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,iDAAiD;IACjD,IAAW,qBAAqB;QAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;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YACL,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SACjC;IACH,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC;IACjD,CAAC;IAEO,eAAe,CAAC,YAAoB,GAAG;QAC7C,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC,QAAQ;iBACjB,SAAS,CAAC,CAAC,CAAC;iBACZ,KAAK,CAAC,GAAG,CAAC;iBACV,IAAI,CAAC,SAAS,CAAC,CAAC;SACpB;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACjD;IACH,CAAC;IAED;;;;;;OAMG;IACH,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC;IAClD,CAAC;CACF;AA/ID,oCA+IC","sourcesContent":["import * as path from 'path';\nimport { SchemaClass } from '@ngtools/json-schema';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { DirectoryPath, SourceFilePath, CssUrl, DestinationFiles } from './shared';\n\n/**\n * An entry point - quoting Angular Package Format - is:\n *\n * > a module intended to be imported by the user. It is referenced by a unique module ID and\n * > exports the public API referenced by that module ID. An example is `@angular/core` or\n * > `@angular/core/testing`. Both entry points exist in the `@angular/core` package, but they\n * > export different symbols. A package can have many entry points.\n *\n * #### Public API, source file tree and build output\n *\n * An entry point serves as the root of a source tree.\n * The entry point's public API references one TypeScript source file (`*.ts`).\n * That source file, e.g. `public_api.ts`, references other source files who in turn may reference\n * other source files, thus creating a tree of source code files.\n * The source files may be TypeScript (`*.ts`), Templates (`.html`) or Stylesheets\n * (`.css`, `.scss`, ..), or other formats.\n *\n * The compilation process for an entry point is a series of transformations applied to the source\n * files, e.g. TypeScript compilation, Inlining of Stylesheets and Templates, and so on.\n * As a result of the compilation process, an entry point is transpiled to a set of artefacts\n * (the build output) which include a FESM'15 Bundle, a FESM'5 Bundle, AoT metadata, TypeScript\n * type definitions, and so on.\n *\n * #### Representation in the domain\n *\n * The set of artefacts is reflected by `NgArtefacts`;\n * one `NgEntryPoint` relates to one `NgArtefacts`.\n * The parent package of an entry point is reflected by `NgPackage`.\n */\nexport class NgEntryPoint {\n constructor(\n /** Values from the `package.json` file of this entry point. */\n public readonly packageJson: any,\n /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */\n public readonly ngPackageJson: NgPackageConfig,\n /** Corresponding JSON schema class instantiated from `ngPackageJson` values. */\n private readonly $schema: SchemaClass<NgPackageConfig>,\n /** Absolute directory path of this entry point's `package.json` location. */\n public readonly basePath: string,\n /** XX: additional auto-configured data passed for scondary entry point's. Needs better docs. */\n private readonly secondaryData?: { [key: string]: any }\n ) {}\n\n /** Absolute file path of the entry point's source code entry file. */\n public get entryFilePath(): SourceFilePath {\n return path.resolve(this.basePath, this.entryFile);\n }\n\n /** Whether or not the entrypoint is secondary */\n public get isSecondaryEntryPoint(): boolean {\n return !!this.secondaryData;\n }\n\n /** Absolute directory path of this entry point's 'package.json'. */\n public get destinationPath(): DirectoryPath {\n if (this.secondaryData) {\n return this.secondaryData.destinationPath;\n } else {\n return path.resolve(this.basePath, this.$get('dest'));\n }\n }\n\n public get destinationFiles(): DestinationFiles {\n let primaryDestPath = this.destinationPath;\n let secondaryDir = '';\n\n if (this.secondaryData) {\n primaryDestPath = this.secondaryData.primaryDestinationPath;\n secondaryDir = path.relative(primaryDestPath, this.secondaryData.destinationPath);\n }\n\n const flatModuleFile = this.flatModuleFile;\n const pathJoinWithDest = (...paths: string[]) => path.join(primaryDestPath, ...paths);\n\n return {\n metadata: pathJoinWithDest(secondaryDir, `${flatModuleFile}.metadata.json`),\n declarations: pathJoinWithDest(secondaryDir, `${flatModuleFile}.d.ts`),\n esm2015: pathJoinWithDest('esm2015', secondaryDir, `${flatModuleFile}.js`),\n esm5: pathJoinWithDest('esm5', secondaryDir, `${flatModuleFile}.js`),\n fesm2015: pathJoinWithDest('fesm2015', `${flatModuleFile}.js`),\n fesm5: pathJoinWithDest('fesm5', `${flatModuleFile}.js`),\n umd: pathJoinWithDest('bundles', `${flatModuleFile}.umd.js`),\n umdMinified: pathJoinWithDest('bundles', `${flatModuleFile}.umd.min.js`)\n };\n }\n\n public $get(key: string): any {\n return this.$schema.$$get(key);\n }\n\n public get entryFile(): SourceFilePath {\n return this.$get('lib.entryFile');\n }\n\n public get cssUrl(): CssUrl {\n return this.$get('lib.cssUrl');\n }\n\n public get umdModuleIds(): { [key: string]: string } {\n return this.$get('lib.umdModuleIds');\n }\n\n public get jsxConfig(): string {\n return this.$get('lib.jsx');\n }\n\n public get flatModuleFile(): string {\n return this.$get('lib.flatModuleFile') || this.flattenModuleId('-');\n }\n\n public get styleIncludePaths(): string[] {\n const includePaths = this.$get('lib.styleIncludePaths') || [];\n return includePaths.map(\n includePath => (path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath))\n );\n }\n\n public get languageLevel(): string[] {\n return this.$get('lib.languageLevel');\n }\n\n /**\n * The module ID is an \"identifier of a module used in the import statements, e.g.\n * '@angular/core'. The ID often maps directly to a path on the filesystem, but this\n * is not always the case due to various module resolution strategies.\"\n */\n public get moduleId(): string {\n if (this.secondaryData) {\n return this.secondaryData.moduleId;\n } else {\n return this.packageJson['name'];\n }\n }\n\n /**\n * The UMD module ID registers a module on the old-fashioned JavaScript global scope.\n * Used by UMD bundles only.\n * Example: `@my/foo/bar` registers as `global['my']['foo']['bar']`.\n */\n public get umdId(): string {\n return this.$get('lib.umdId') || this.flattenModuleId();\n }\n\n /**\n * The AMD ID reflects a named module that is distributed in the UMD bundles.\n * @link http://requirejs.org/docs/whyamd.html#namedmodules\n */\n public get amdId(): string {\n return this.$get('lib.amdId') || this.moduleId;\n }\n\n private flattenModuleId(separator: string = '.') {\n if (this.moduleId.startsWith('@')) {\n return this.moduleId\n .substring(1)\n .split('/')\n .join(separator);\n } else {\n return this.moduleId.split('/').join(separator);\n }\n }\n\n /**\n * Enables the `\"sideEffects\": false` flag in `package.json`.\n * The flag is enabled and set to `false` by default which results in more aggressive optimizations applied by webpack v4 builds consuming the library.\n * To override the default behaviour, you need to set `\"sideEffects\": true` explicitly in your `package.json`.\n *\n * @link https://github.com/webpack/webpack/tree/master/examples/side-effects\n */\n public get sideEffects(): boolean | string[] {\n return this.packageJson['sideEffects'] || false;\n }\n}\n"]}
@@ -42,14 +42,14 @@ export declare class NgPackage {
42
42
  */
43
43
  readonly secondaries: NgEntryPoint[];
44
44
  constructor(basePath: string,
45
- /**
46
- * A reference to the primary entry point.
47
- */
48
- primary: NgEntryPoint,
49
- /**
50
- * An array of seconary entry points.
51
- */
52
- secondaries?: NgEntryPoint[]);
45
+ /**
46
+ * A reference to the primary entry point.
47
+ */
48
+ primary: NgEntryPoint,
49
+ /**
50
+ * An array of seconary entry points.
51
+ */
52
+ secondaries?: NgEntryPoint[]);
53
53
  /** Absolute path of the package's source folder, derived from the user's (primary) package location. */
54
54
  readonly src: DirectoryPath;
55
55
  /** Delete output path before build */
@@ -58,6 +58,6 @@ export declare class NgPackage {
58
58
  readonly dest: DirectoryPath;
59
59
  readonly keepLifecycleScripts: boolean;
60
60
  readonly whitelistedNonPeerDependencies: string[];
61
- private absolutePathFromPrimary(key);
61
+ private absolutePathFromPrimary;
62
62
  entryPoint(moduleId: string): NgEntryPoint;
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/lib/ng-package-format/package.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAClG,CAAC;CACF;AAhDD,8BAgDC","sourcesContent":["import * as path from 'path';\nimport { NgEntryPoint } from './entry-point';\nimport { DirectoryPath } from './shared';\n\n/**\n * A package being built. Quoting Angular Package Format, a package is:\n *\n * > the smallest set of files that are published to NPM and installed together, for example\n * > `@angular/core`. (..) The package is installed with `npm install @angular/core`.\n *\n * #### Package and Entry Points\n *\n * A package is composed of several (one or more) entry points.\n * A package must contain at least the primary entry point but can have many secondary entry\n * points.\n * The module ID of the primary entry point, e.g. `@angular/core`, matches the package name, e.g.\n * the package name is given to the command `npm install @angular/core`.\n * The source code files within a package are referenced by the entry points.\n *\n * #### Representation in the domain\n *\n * A _Package_ is reflected by `NgPackage`.\n * An _Entry Point_ is reflected by `NgEntryPoint`.\n * One `NgPackage` relates to one (or many) `NgEentryPoint`,\n * one `NgEntryPoint` relates to one `NgPackage`.\n *\n * #### Watch Out\n *\n * The user's configuration `ngPackage` suggests that it reflects a `NgPackage`.\n * However, the values given in the `lib` property reflect an `NgEntryPoint`.\n * In case the package contains only one entry point, `ngPackage.lib` reflects the primary entry\n * point.\n *\n * @link https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#\n */\nexport class NgPackage {\n constructor(\n private readonly basePath: string,\n /**\n * A reference to the primary entry point.\n */\n public readonly primary: NgEntryPoint,\n /**\n * An array of seconary entry points.\n */\n public readonly secondaries: NgEntryPoint[] = []\n ) {}\n\n /** Absolute path of the package's source folder, derived from the user's (primary) package location. */\n public get src(): DirectoryPath {\n return this.basePath;\n }\n\n /** Delete output path before build */\n public get deleteDestPath(): boolean {\n return this.primary.$get('deleteDestPath');\n }\n\n /** Absolute path of the package's destination directory. */\n public get dest(): DirectoryPath {\n return this.absolutePathFromPrimary('dest');\n }\n\n public get keepLifecycleScripts(): boolean {\n return this.primary.$get('keepLifecycleScripts') === true;\n }\n\n public get whitelistedNonPeerDependencies(): string[] {\n // XX: default array values from JSON schema not recognized\n const defValue = ['tslib'];\n const value = (this.primary.$get('whitelistedNonPeerDependencies') as string[]) || defValue;\n\n // Always append 'tslib' and dedupe\n return value.concat('tslib').filter((value, index, self) => self.indexOf(value) === index);\n }\n\n private absolutePathFromPrimary(key: string) {\n return path.resolve(this.basePath, this.primary.$get(key));\n }\n\n public entryPoint(moduleId: string): NgEntryPoint {\n return [this.primary, ...this.secondaries].find(entryPoint => entryPoint.moduleId === moduleId);\n }\n}\n"]}
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/lib/ng-package-format/package.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH;IACE,YACmB,QAAgB;IACjC;;OAEG;IACa,OAAqB;IACrC;;OAEG;IACa,cAA8B,EAAE;QAR/B,aAAQ,GAAR,QAAQ,CAAQ;QAIjB,YAAO,GAAP,OAAO,CAAc;QAIrB,gBAAW,GAAX,WAAW,CAAqB;IAC/C,CAAC;IAEJ,wGAAwG;IACxG,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,sCAAsC;IACtC,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC;IAED,4DAA4D;IAC5D,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,IAAW,oBAAoB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;IAC5D,CAAC;IAED,IAAW,8BAA8B;QACvC,2DAA2D;QAC3D,MAAM,QAAQ,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,MAAM,KAAK,GAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAc,IAAI,QAAQ,CAAC;QAE5F,mCAAmC;QACnC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC;IAC7F,CAAC;IAEO,uBAAuB,CAAC,GAAW;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7D,CAAC;IAEM,UAAU,CAAC,QAAgB;QAChC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IAClG,CAAC;CACF;AAhDD,8BAgDC","sourcesContent":["import * as path from 'path';\nimport { NgEntryPoint } from './entry-point';\nimport { DirectoryPath } from './shared';\n\n/**\n * A package being built. Quoting Angular Package Format, a package is:\n *\n * > the smallest set of files that are published to NPM and installed together, for example\n * > `@angular/core`. (..) The package is installed with `npm install @angular/core`.\n *\n * #### Package and Entry Points\n *\n * A package is composed of several (one or more) entry points.\n * A package must contain at least the primary entry point but can have many secondary entry\n * points.\n * The module ID of the primary entry point, e.g. `@angular/core`, matches the package name, e.g.\n * the package name is given to the command `npm install @angular/core`.\n * The source code files within a package are referenced by the entry points.\n *\n * #### Representation in the domain\n *\n * A _Package_ is reflected by `NgPackage`.\n * An _Entry Point_ is reflected by `NgEntryPoint`.\n * One `NgPackage` relates to one (or many) `NgEentryPoint`,\n * one `NgEntryPoint` relates to one `NgPackage`.\n *\n * #### Watch Out\n *\n * The user's configuration `ngPackage` suggests that it reflects a `NgPackage`.\n * However, the values given in the `lib` property reflect an `NgEntryPoint`.\n * In case the package contains only one entry point, `ngPackage.lib` reflects the primary entry\n * point.\n *\n * @link https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit#\n */\nexport class NgPackage {\n constructor(\n private readonly basePath: string,\n /**\n * A reference to the primary entry point.\n */\n public readonly primary: NgEntryPoint,\n /**\n * An array of seconary entry points.\n */\n public readonly secondaries: NgEntryPoint[] = []\n ) {}\n\n /** Absolute path of the package's source folder, derived from the user's (primary) package location. */\n public get src(): DirectoryPath {\n return this.basePath;\n }\n\n /** Delete output path before build */\n public get deleteDestPath(): boolean {\n return this.primary.$get('deleteDestPath');\n }\n\n /** Absolute path of the package's destination directory. */\n public get dest(): DirectoryPath {\n return this.absolutePathFromPrimary('dest');\n }\n\n public get keepLifecycleScripts(): boolean {\n return this.primary.$get('keepLifecycleScripts') === true;\n }\n\n public get whitelistedNonPeerDependencies(): string[] {\n // XX: default array values from JSON schema not recognized\n const defValue = ['tslib'];\n const value = (this.primary.$get('whitelistedNonPeerDependencies') as string[]) || defValue;\n\n // Always append 'tslib' and dedupe\n return value.concat('tslib').filter((value, index, self) => self.indexOf(value) === index);\n }\n\n private absolutePathFromPrimary(key: string) {\n return path.resolve(this.basePath, this.primary.$get(key));\n }\n\n public entryPoint(moduleId: string): NgEntryPoint {\n return [this.primary, ...this.secondaries].find(entryPoint => entryPoint.moduleId === moduleId);\n }\n}\n"]}
@@ -9,7 +9,7 @@ export declare type SourceFilePath = string;
9
9
  export declare type DirectoryPath = string;
10
10
  export declare enum CssUrl {
11
11
  inline = "inline",
12
- none = "none",
12
+ none = "none"
13
13
  }
14
14
  /** A list of output absolute paths for various formats */
15
15
  export interface DestinationFiles {
@@ -1 +1 @@
1
- {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/ng-v5/discover-packages.ts"],"names":[],"mapp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AC,KAAK,CAAC,iCAAiC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,IAAI,mBAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACtE,CAAC,CAAA,CAAC","sourcesContent":["import { SchemaClassFactory } from '@ngtools/json-schema';\nimport { pathExistsSync, lstat } from 'fs-extra';\nimport * as path from 'path';\nimport * as log from '../util/log';\nimport { ensureUnixPath } from '../util/path';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { NgEntryPoint } from '../ng-package-format/entry-point';\nimport { NgPackage } from '../ng-package-format/package';\nimport { globFiles } from '../util/glob';\n\nconst ngPackageSchemaJson = require('../../ng-package.schema.json');\n\n/** Creates a SchemaClass for `NgPackageConfig` */\nconst NgPackageSchemaClass = SchemaClassFactory<NgPackageConfig>(ngPackageSchemaJson);\n\n/** Instantiates a concrete schema from `NgPackageConfig` */\nconst instantiateSchemaClass = (ngPackageJson: NgPackageConfig) => new NgPackageSchemaClass(ngPackageJson);\n\ninterface UserPackage {\n packageJson: object;\n ngPackageJson: object;\n basePath: string;\n}\n\n/**\n * Resolves a user's package by testing for 'package.json', 'ng-package.json', or 'ng-package.js'.\n *\n * @param folderPathOrFilePath A path pointing either to a file or a directory\n * @return The user's package\n */\nconst resolveUserPackage = async (folderPathOrFilePath: string): Promise<UserPackage | undefined> => {\n const readConfigFile = async (filePath: string) => (pathExistsSync(filePath) ? import(filePath) : undefined);\n const fullPath = path.resolve(folderPathOrFilePath);\n const pathStats = await lstat(fullPath);\n const basePath = pathStats.isDirectory() ? fullPath : path.dirname(fullPath);\n const packageJson = await readConfigFile(path.join(basePath, 'package.json'));\n\n let ngPackageJson: undefined | object;\n\n if (packageJson['ngPackage']) {\n // Read `ngPackage` from `package.json`\n ngPackageJson = { ...packageJson['ngPackage'] };\n } else if (pathStats.isDirectory()) {\n ngPackageJson = await readConfigFile(path.join(basePath, 'ng-package.json'));\n if (!ngPackageJson) {\n ngPackageJson = await readConfigFile(path.join(basePath, 'ng-package.js'));\n }\n } else {\n ngPackageJson = await readConfigFile(fullPath);\n }\n\n if (ngPackageJson) {\n return {\n basePath,\n packageJson,\n ngPackageJson\n };\n }\n\n if (pathStats.isDirectory()) {\n // return even if it's undefined and use defaults when it's not a file\n return undefined;\n }\n\n if (pathStats.isFile()) {\n // a project file was specified but was in valid\n if (path.basename(folderPathOrFilePath) === 'package.json') {\n throw new Error(`Cannot read a package from 'package.json' without 'ngPackage' property.`);\n }\n\n throw new Error(`Trying to read a package from unsupported file extension. Path=${folderPathOrFilePath}`);\n }\n\n throw new Error(`Cannot discover package sources at ${folderPathOrFilePath}`);\n};\n\n/** Reads a primary entry point from it's package file. */\nconst primaryEntryPoint = ({ packageJson, ngPackageJson, basePath }: UserPackage): NgEntryPoint =>\n new NgEntryPoint(packageJson, ngPackageJson, instantiateSchemaClass(ngPackageJson), basePath);\n\n/**\n * Scans `directoryPath` and sub-folders, looking for `package.json` files.\n * Similar to `find ${directoryPath} --name package.json --exec dirname {}`.\n *\n * @param directoryPath Path pointing to a directory\n * @param excludeFolder A sub-folder of `directoryPath` that is excluded from search results.\n */\nconst findSecondaryPackagesPaths = async (directoryPath: string, excludeFolder: string): Promise<string[]> => {\n const ignore = [\n '**/node_modules/**',\n `${path.resolve(directoryPath, excludeFolder)}/**`,\n `${directoryPath}/package.json`\n ];\n\n const filePaths = await globFiles(`${directoryPath}/**/package.json`, {\n ignore,\n cwd: directoryPath\n });\n\n return filePaths.map(path.dirname);\n};\n\n/**\n * Reads a secondary entry point from it's package file.\n *\n * @param primaryDirectoryPath A path pointing to the directory of the primary entry point.\n * @param primary The primary entry point.\n */\nconst secondaryEntryPoint = (\n primaryDirectoryPath: string,\n primary: NgEntryPoint,\n { packageJson, ngPackageJson, basePath }: UserPackage\n): NgEntryPoint => {\n if (path.resolve(basePath) === path.resolve(primaryDirectoryPath)) {\n log.error(`Cannot read secondary entry point. It's already a primary entry point. path=${basePath}`);\n throw new Error(`Secondary entry point is already a primary.`);\n }\n\n const relativeSourcePath = path.relative(primaryDirectoryPath, basePath);\n const secondaryModuleId = ensureUnixPath(`${primary.moduleId}/${relativeSourcePath}`);\n\n return new NgEntryPoint(packageJson, ngPackageJson, instantiateSchemaClass(ngPackageJson), basePath, {\n moduleId: secondaryModuleId,\n primaryDestinationPath: primary.destinationPath,\n destinationPath: path.join(primary.destinationPath, relativeSourcePath)\n });\n};\n\nexport const discoverPackages = async ({ project }: { project: string }): Promise<NgPackage> => {\n project = path.isAbsolute(project) ? project : path.resolve(project);\n\n const primaryPackage = await resolveUserPackage(project);\n const primary = primaryEntryPoint(primaryPackage);\n log.debug(`Found primary entry point: ${primary.moduleId}`);\n\n const secondaries = await findSecondaryPackagesPaths(primaryPackage.basePath, primary.$get('dest'))\n .then(folderPaths =>\n Promise.all(\n folderPaths.map(folderPath =>\n resolveUserPackage(folderPath).catch(() => {\n log.warn(`Cannot read secondary entry point at ${folderPath}. Skipping.`);\n\n return null;\n })\n )\n )\n )\n .then(secondaryPackages =>\n secondaryPackages\n .filter(value => !!value)\n .map(secondaryPackage => secondaryEntryPoint(primaryPackage.basePath, primary, secondaryPackage))\n );\n if (secondaries.length > 0) {\n log.debug(`Found secondary entry points: ${secondaries.map(e => e.moduleId).join(', ')}`);\n }\n\n return new NgPackage(primaryPackage.basePath, primary, secondaries);\n};\n"]}
1
+ {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/ng-v5/discover-packages.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,sDAA0D;AAC1D,uCAAiD;AACjD,6BAA6B;AAC7B,mCAAmC;AACnC,uCAA8C;AAE9C,kEAAgE;AAChE,0DAAyD;AACzD,uCAAyC;AAEzC,MAAM,mBAAmB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AA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AAW,GAAG,MAAM,0BAA0B,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAChG,IAAI,CAAC,WAAW,CAAC,EAAE,CAClB,OAAO,CAAC,GAAG,CACT,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAC3B,kBAAkB,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;QACxC,GAAG,CAAC,IAAI,CAAC,wCAAwC,UAAU,aAAa,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CACH,CACF,CACF;SACA,IAAI,CAAC,iBAAiB,CAAC,EAAE,CACxB,iBAAiB;SACd,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACxB,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC,mBAAmB,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CACpG,CAAC;IACJ,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,GAAG,CAAC,KAAK,CAAC,iCAAiC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC3F;IAED,OAAO,IAAI,mBAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACtE,CAAC,CAAA,CAAC","sourcesContent":["import { SchemaClassFactory } from '@ngtools/json-schema';\nimport { pathExistsSync, lstat } from 'fs-extra';\nimport * as path from 'path';\nimport * as log from '../util/log';\nimport { ensureUnixPath } from '../util/path';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { NgEntryPoint } from '../ng-package-format/entry-point';\nimport { NgPackage } from '../ng-package-format/package';\nimport { globFiles } from '../util/glob';\n\nconst ngPackageSchemaJson = require('../../ng-package.schema.json');\n\n/** Creates a SchemaClass for `NgPackageConfig` */\nconst NgPackageSchemaClass = SchemaClassFactory<NgPackageConfig>(ngPackageSchemaJson);\n\n/** Instantiates a concrete schema from `NgPackageConfig` */\nconst instantiateSchemaClass = (ngPackageJson: NgPackageConfig) => new NgPackageSchemaClass(ngPackageJson);\n\ninterface UserPackage {\n packageJson: object;\n ngPackageJson: object;\n basePath: string;\n}\n\n/**\n * Resolves a user's package by testing for 'package.json', 'ng-package.json', or 'ng-package.js'.\n *\n * @param folderPathOrFilePath A path pointing either to a file or a directory\n * @return The user's package\n */\nconst resolveUserPackage = async (folderPathOrFilePath: string): Promise<UserPackage | undefined> => {\n const readConfigFile = async (filePath: string) => (pathExistsSync(filePath) ? import(filePath) : undefined);\n const fullPath = path.resolve(folderPathOrFilePath);\n const pathStats = await lstat(fullPath);\n const basePath = pathStats.isDirectory() ? fullPath : path.dirname(fullPath);\n const packageJson = await readConfigFile(path.join(basePath, 'package.json'));\n\n let ngPackageJson: undefined | object;\n\n if (packageJson['ngPackage']) {\n // Read `ngPackage` from `package.json`\n ngPackageJson = { ...packageJson['ngPackage'] };\n } else if (pathStats.isDirectory()) {\n ngPackageJson = await readConfigFile(path.join(basePath, 'ng-package.json'));\n if (!ngPackageJson) {\n ngPackageJson = await readConfigFile(path.join(basePath, 'ng-package.js'));\n }\n } else {\n ngPackageJson = await readConfigFile(fullPath);\n }\n\n if (ngPackageJson) {\n return {\n basePath,\n packageJson,\n ngPackageJson\n };\n }\n\n if (pathStats.isDirectory()) {\n // return even if it's undefined and use defaults when it's not a file\n return undefined;\n }\n\n if (pathStats.isFile()) {\n // a project file was specified but was in valid\n if (path.basename(folderPathOrFilePath) === 'package.json') {\n throw new Error(`Cannot read a package from 'package.json' without 'ngPackage' property.`);\n }\n\n throw new Error(`Trying to read a package from unsupported file extension. Path=${folderPathOrFilePath}`);\n }\n\n throw new Error(`Cannot discover package sources at ${folderPathOrFilePath}`);\n};\n\n/** Reads a primary entry point from it's package file. */\nconst primaryEntryPoint = ({ packageJson, ngPackageJson, basePath }: UserPackage): NgEntryPoint =>\n new NgEntryPoint(packageJson, ngPackageJson, instantiateSchemaClass(ngPackageJson), basePath);\n\n/**\n * Scans `directoryPath` and sub-folders, looking for `package.json` files.\n * Similar to `find ${directoryPath} --name package.json --exec dirname {}`.\n *\n * @param directoryPath Path pointing to a directory\n * @param excludeFolder A sub-folder of `directoryPath` that is excluded from search results.\n */\nconst findSecondaryPackagesPaths = async (directoryPath: string, excludeFolder: string): Promise<string[]> => {\n const ignore = [\n '**/node_modules/**',\n `${path.resolve(directoryPath, excludeFolder)}/**`,\n `${directoryPath}/package.json`\n ];\n\n const filePaths = await globFiles(`${directoryPath}/**/package.json`, {\n ignore,\n cwd: directoryPath\n });\n\n return filePaths.map(path.dirname);\n};\n\n/**\n * Reads a secondary entry point from it's package file.\n *\n * @param primaryDirectoryPath A path pointing to the directory of the primary entry point.\n * @param primary The primary entry point.\n */\nconst secondaryEntryPoint = (\n primaryDirectoryPath: string,\n primary: NgEntryPoint,\n { packageJson, ngPackageJson, basePath }: UserPackage\n): NgEntryPoint => {\n if (path.resolve(basePath) === path.resolve(primaryDirectoryPath)) {\n log.error(`Cannot read secondary entry point. It's already a primary entry point. path=${basePath}`);\n throw new Error(`Secondary entry point is already a primary.`);\n }\n\n const relativeSourcePath = path.relative(primaryDirectoryPath, basePath);\n const secondaryModuleId = ensureUnixPath(`${primary.moduleId}/${relativeSourcePath}`);\n\n return new NgEntryPoint(packageJson, ngPackageJson, instantiateSchemaClass(ngPackageJson), basePath, {\n moduleId: secondaryModuleId,\n primaryDestinationPath: primary.destinationPath,\n destinationPath: path.join(primary.destinationPath, relativeSourcePath)\n });\n};\n\nexport const discoverPackages = async ({ project }: { project: string }): Promise<NgPackage> => {\n project = path.isAbsolute(project) ? project : path.resolve(project);\n\n const primaryPackage = await resolveUserPackage(project);\n const primary = primaryEntryPoint(primaryPackage);\n log.debug(`Found primary entry point: ${primary.moduleId}`);\n\n const secondaries = await findSecondaryPackagesPaths(primaryPackage.basePath, primary.$get('dest'))\n .then(folderPaths =>\n Promise.all(\n folderPaths.map(folderPath =>\n resolveUserPackage(folderPath).catch(() => {\n log.warn(`Cannot read secondary entry point at ${folderPath}. Skipping.`);\n\n return null;\n })\n )\n )\n )\n .then(secondaryPackages =>\n secondaryPackages\n .filter(value => !!value)\n .map(secondaryPackage => secondaryEntryPoint(primaryPackage.basePath, primary, secondaryPackage))\n );\n if (secondaries.length > 0) {\n log.debug(`Found secondary entry points: ${secondaries.map(e => e.moduleId).join(', ')}`);\n }\n\n return new NgPackage(primaryPackage.basePath, primary, secondaries);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"postcss-clean.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/resources/postcss-clean.ts"],"names":[],"mappings":";;AAAA,mCAAmC;AACnC,sCAAsC;AAEtC,yCAAyC;AAEzC,kBAAe,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as postcss from 'postcss';\nimport * as cleanCss from 'clean-css';\n\nimport * as log from '../../../util/log';\n\nexport default postcss.plugin('clean', (options = {}) => {\n const cleancss = new cleanCss(options);\n return (css, result) => {\n const { warnings, styles } = cleancss.minify(css.toString());\n warnings.forEach(log.warn);\n result.root = postcss.parse(styles);\n };\n});\n"]}
1
+ {"version":3,"file":"postcss-clean.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/resources/postcss-clean.ts"],"names":[],"mappings":";;AAAA,mCAAmC;AACnC,sCAAsC;AAEtC,yCAAyC;AAEzC,kBAAe,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE;IACtD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACrB,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC7D,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as postcss from 'postcss';\nimport * as cleanCss from 'clean-css';\n\nimport * as log from '../../../util/log';\n\nexport default postcss.plugin('clean', (options = {}) => {\n const cleancss = new cleanCss(options);\n return (css, result) => {\n const { warnings, styles } = cleancss.minify(css.toString());\n warnings.forEach(log.warn);\n result.root = postcss.parse(styles);\n };\n});\n"]}
@@ -1,11 +1,11 @@
1
1
  import { CssUrl } from '../../../ng-package-format/shared';
2
2
  export declare class StylesheetProcessor {
3
3
  readonly basePath: string;
4
- readonly cssUrl: CssUrl;
5
- readonly styleIncludePaths: string[];
4
+ readonly cssUrl?: CssUrl;
5
+ readonly styleIncludePaths?: string[];
6
6
  private postCssProcessor;
7
7
  constructor(basePath: string, cssUrl?: CssUrl, styleIncludePaths?: string[]);
8
8
  process(filePath: string, content: string): string;
9
- private renderPreProcessor(filePath, content);
10
- private createPostCssProcessor(basePath, cssUrl?, styleIncludePaths?);
9
+ private renderPreProcessor;
10
+ private createPostCssProcessor;
11
11
  }
@@ -18,7 +18,7 @@ class StylesheetProcessor {
18
18
  this.basePath = basePath;
19
19
  this.cssUrl = cssUrl;
20
20
  this.styleIncludePaths = styleIncludePaths;
21
- this.postCssProcessor = this.createPostCssProcessor(basePath, cssUrl, styleIncludePaths);
21
+ this.postCssProcessor = this.createPostCssProcessor(basePath, cssUrl);
22
22
  }
23
23
  process(filePath, content) {
24
24
  // Render pre-processor language (sass, styl, less)
@@ -33,42 +33,44 @@ class StylesheetProcessor {
33
33
  return result.css;
34
34
  }
35
35
  renderPreProcessor(filePath, content) {
36
- switch (path.extname(filePath)) {
37
- case '.scss':
36
+ const ext = path.extname(filePath);
37
+ log.debug(`rendering ${ext} from ${filePath}`);
38
+ switch (ext) {
38
39
  case '.sass':
39
- log.debug(`rendering sass from ${filePath}`);
40
+ case '.scss':
40
41
  return sass
41
42
  .renderSync({
42
43
  file: filePath,
43
44
  data: content,
45
+ indentedSyntax: '.sass' === ext,
44
46
  importer: nodeSassTildeImporter,
45
47
  includePaths: this.styleIncludePaths
46
48
  })
47
49
  .css.toString();
48
50
  case '.less':
49
- log.debug(`rendering less from ${filePath}`);
50
51
  // this is the only way I found to make LESS sync
51
- let cmd = `node node_modules/less/bin/lessc ${filePath}`;
52
+ let cmd = `node node_modules/less/bin/lessc ${filePath} --less-plugin-npm-import="prefix=~"`;
52
53
  if (this.styleIncludePaths.length) {
53
54
  cmd = `${cmd} --include-path=${this.styleIncludePaths.join(':')}`;
54
55
  }
55
56
  return child_process_1.execSync(cmd).toString();
56
57
  case '.styl':
57
58
  case '.stylus':
58
- log.debug(`rendering styl from ${filePath}`);
59
59
  return (stylus(content)
60
+ // add paths for resolve
60
61
  .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])
62
+ // add support for resolving plugins from node_modules
61
63
  .set('filename', filePath)
64
+ // turn on url resolver in stylus, same as flag --resolve-url
62
65
  .set('resolve url', true)
63
66
  .define('url', stylus.resolver(undefined))
64
67
  .render());
65
68
  case '.css':
66
69
  default:
67
- log.debug(`reading css from ${filePath}`);
68
70
  return content;
69
71
  }
70
72
  }
71
- createPostCssProcessor(basePath, cssUrl, styleIncludePaths) {
73
+ createPostCssProcessor(basePath, cssUrl) {
72
74
  log.debug(`determine browserslist for ${basePath}`);
73
75
  const browsers = browserslist(undefined, { path: basePath });
74
76
  const postCssPlugins = [];
@@ -77,7 +79,7 @@ class StylesheetProcessor {
77
79
  postCssPlugins.push(postcssUrl({ url: cssUrl }));
78
80
  }
79
81
  // this is important to be executed post running `postcssUrl`
80
- postCssPlugins.push(autoprefixer({ browsers }), postcss_clean_1.default({
82
+ postCssPlugins.push(autoprefixer({ browsers, grid: true }), postcss_clean_1.default({
81
83
  level: {
82
84
  2: {
83
85
  specialComments: false
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/resources/stylesheet-processor.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,yCAAyC;AACzC,8DAA2D;AAC3D,iDAAyC;AAEzC,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,mDAA2C;AAC3C,kCAAkC;AAClC,iCAAiC;AAEjC;IAGE,YAAqB,QAAgB,EAAW,MAAe,EAAW,iBAA4B;QAAjF,aAAQ,GAAR,QAAQ,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAS;QAAW,sBAAiB,GAAjB,iBAAiB,CAAW;QACpG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,OAAe;QACvC,mDAAmD;QACnD,MAAM,WAAW,GAAW,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAA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CAAC,EAAE,QAAQ,EAAE,CAAC,EAC1B,uBAAY,CAAC;YACX,KAAK,EAAE;gBACL,CAAC,EAAE;oBACD,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CACH,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AA9FD,kDA8FC","sourcesContent":["import * as path from 'path';\nimport * as log from '../../../util/log';\nimport { CssUrl } from '../../../ng-package-format/shared';\nimport { execSync } from 'child_process';\n\n// CSS Tools\nimport * as autoprefixer from 'autoprefixer';\nimport * as browserslist from 'browserslist';\nimport * as nodeSassTildeImporter from 'node-sass-tilde-importer';\nimport * as postcss from 'postcss';\nimport * as postcssUrl from 'postcss-url';\nimport postcssClean from './postcss-clean';\nimport * as sass from 'node-sass';\nimport * as stylus from 'stylus';\n\nexport class StylesheetProcessor {\n private postCssProcessor: postcss.Processor;\n\n constructor(readonly basePath: string, readonly cssUrl?: CssUrl, readonly styleIncludePaths?: string[]) {\n this.postCssProcessor = this.createPostCssProcessor(basePath, cssUrl, styleIncludePaths);\n }\n\n process(filePath: string, content: string) {\n // Render pre-processor language (sass, styl, less)\n const renderedCss: string = this.renderPreProcessor(filePath, content);\n\n // Render postcss (autoprefixing and friends)\n const result = this.postCssProcessor.process(renderedCss, {\n from: filePath,\n to: filePath.replace(path.extname(filePath), '.css')\n });\n\n // Log warnings from postcss\n result.warnings().forEach(msg => log.warn(msg.toString()));\n\n return result.css;\n }\n\n private renderPreProcessor(filePath: string, content: string): string {\n switch (path.extname(filePath)) {\n case '.scss':\n case '.sass':\n log.debug(`rendering sass from ${filePath}`);\n return sass\n .renderSync({\n file: filePath,\n data: content,\n importer: nodeSassTildeImporter,\n includePaths: this.styleIncludePaths\n })\n .css.toString();\n\n case '.less':\n log.debug(`rendering less from ${filePath}`);\n // this is the only way I found to make LESS sync\n let cmd = `node node_modules/less/bin/lessc ${filePath}`;\n if (this.styleIncludePaths.length) {\n cmd = `${cmd} --include-path=${this.styleIncludePaths.join(':')}`;\n }\n\n return execSync(cmd).toString();\n\n case '.styl':\n case '.stylus':\n log.debug(`rendering styl from ${filePath}`);\n return (\n stylus(content)\n // add paths for resolve\n .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])\n // add support for resolving plugins from node_modules\n .set('filename', filePath)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver(undefined))\n .render()\n );\n\n case '.css':\n default:\n log.debug(`reading css from ${filePath}`);\n return content;\n }\n }\n\n private createPostCssProcessor(basePath: string, cssUrl?: CssUrl, styleIncludePaths?: string[]): postcss.Processor {\n log.debug(`determine browserslist for ${basePath}`);\n const browsers = browserslist(undefined, { path: basePath });\n\n const postCssPlugins = [];\n\n if (cssUrl !== CssUrl.none) {\n log.debug(`postcssUrl: ${cssUrl}`);\n postCssPlugins.push(postcssUrl({ url: cssUrl }));\n }\n\n // this is important to be executed post running `postcssUrl`\n postCssPlugins.push(\n autoprefixer({ browsers }),\n postcssClean({\n level: {\n 2: {\n specialComments: false\n }\n }\n })\n );\n\n return postcss(postCssPlugins);\n }\n}\n"]}
1
+ {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/resources/stylesheet-processor.ts"],"names":[],"mappings":";;AAAA,6BAA6B;AAC7B,yCAAyC;AACzC,8DAA2D;AAC3D,iDAAyC;AAEzC,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,mDAA2C;AAC3C,kCAAkC;AAClC,iCAAiC;AAEjC;IAGE,YAAqB,QAAgB,EAAW,MAAe,EAAW,iBAA4B;QAAjF,aAAQ,GAAR,QAAQ,CAAQ;QAAW,WAAM,GAAN,MAAM,CAAS;QAAW,sBAAiB,GAAjB,iBAAiB,CAAW;QACpG,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,QAAQ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AE,IAAI,EAAE,CAAC,EACtC,uBAAY,CAAC;YACX,KAAK,EAAE;gBACL,CAAC,EAAE;oBACD,eAAe,EAAE,KAAK;iBACvB;aACF;SACF,CAAC,CACH,CAAC;QAEF,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AA/FD,kDA+FC","sourcesContent":["import * as path from 'path';\nimport * as log from '../../../util/log';\nimport { CssUrl } from '../../../ng-package-format/shared';\nimport { execSync } from 'child_process';\n\n// CSS Tools\nimport * as autoprefixer from 'autoprefixer';\nimport * as browserslist from 'browserslist';\nimport * as nodeSassTildeImporter from 'node-sass-tilde-importer';\nimport * as postcss from 'postcss';\nimport * as postcssUrl from 'postcss-url';\nimport postcssClean from './postcss-clean';\nimport * as sass from 'node-sass';\nimport * as stylus from 'stylus';\n\nexport class StylesheetProcessor {\n private postCssProcessor: postcss.Processor;\n\n constructor(readonly basePath: string, readonly cssUrl?: CssUrl, readonly styleIncludePaths?: string[]) {\n this.postCssProcessor = this.createPostCssProcessor(basePath, cssUrl);\n }\n\n process(filePath: string, content: string) {\n // Render pre-processor language (sass, styl, less)\n const renderedCss: string = this.renderPreProcessor(filePath, content);\n\n // Render postcss (autoprefixing and friends)\n const result = this.postCssProcessor.process(renderedCss, {\n from: filePath,\n to: filePath.replace(path.extname(filePath), '.css')\n });\n\n // Log warnings from postcss\n result.warnings().forEach(msg => log.warn(msg.toString()));\n\n return result.css;\n }\n\n private renderPreProcessor(filePath: string, content: string): string {\n const ext = path.extname(filePath);\n\n log.debug(`rendering ${ext} from ${filePath}`);\n\n switch (ext) {\n case '.sass':\n case '.scss':\n return sass\n .renderSync({\n file: filePath,\n data: content,\n indentedSyntax: '.sass' === ext,\n importer: nodeSassTildeImporter,\n includePaths: this.styleIncludePaths\n })\n .css.toString();\n\n case '.less':\n // this is the only way I found to make LESS sync\n let cmd = `node node_modules/less/bin/lessc ${filePath} --less-plugin-npm-import=\"prefix=~\"`;\n if (this.styleIncludePaths.length) {\n cmd = `${cmd} --include-path=${this.styleIncludePaths.join(':')}`;\n }\n\n return execSync(cmd).toString();\n\n case '.styl':\n case '.stylus':\n return (\n stylus(content)\n // add paths for resolve\n .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])\n // add support for resolving plugins from node_modules\n .set('filename', filePath)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver(undefined))\n .render()\n );\n\n case '.css':\n default:\n return content;\n }\n }\n\n private createPostCssProcessor(basePath: string, cssUrl?: CssUrl): postcss.Processor {\n log.debug(`determine browserslist for ${basePath}`);\n const browsers = browserslist(undefined, { path: basePath });\n\n const postCssPlugins = [];\n\n if (cssUrl !== CssUrl.none) {\n log.debug(`postcssUrl: ${cssUrl}`);\n postCssPlugins.push(postcssUrl({ url: cssUrl }));\n }\n\n // this is important to be executed post running `postcssUrl`\n postCssPlugins.push(\n autoprefixer({ browsers, grid: true }),\n postcssClean({\n level: {\n 2: {\n specialComments: false\n }\n }\n })\n );\n\n return postcss(postCssPlugins);\n }\n}\n"]}
@@ -12,25 +12,28 @@ const path = require("path");
12
12
  const ts = require("typescript");
13
13
  const transform_1 = require("../../../brocc/transform");
14
14
  const compile_source_files_1 = require("../../../ngc/compile-source-files");
15
+ const tsconfig_1 = require("../../../ts/tsconfig");
15
16
  const log = require("../../../util/log");
16
17
  const nodes_1 = require("../../nodes");
17
18
  const stylesheet_processor_1 = require("../resources/stylesheet-processor");
18
19
  exports.compileNgcTransform = transform_1.transformFromPromise((graph) => __awaiter(this, void 0, void 0, function* () {
19
20
  log.info(`Compiling TypeScript sources through ngc`);
20
21
  const entryPoint = graph.find(nodes_1.isEntryPointInProgress());
21
- const tsConfig = entryPoint.data.tsConfig;
22
+ const entryPoints = graph.filter(nodes_1.isEntryPoint);
23
+ // Add paths mappings for dependencies
24
+ const tsConfig = tsconfig_1.setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints);
22
25
  // Compile TypeScript sources
23
26
  const { esm2015, esm5, declarations } = entryPoint.data.destinationFiles;
24
- const { compilationFileCache, moduleResolutionCache } = entryPoint.cache;
27
+ const { sourcesFileCache, moduleResolutionCache } = entryPoint.cache;
25
28
  const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;
26
29
  const stylesheetProcessor = new stylesheet_processor_1.StylesheetProcessor(basePath, cssUrl, styleIncludePaths);
27
30
  yield Promise.all([
28
- compile_source_files_1.compileSourceFiles(tsConfig, compilationFileCache, moduleResolutionCache, stylesheetProcessor, {
31
+ compile_source_files_1.compileSourceFiles(tsConfig, sourcesFileCache, moduleResolutionCache, stylesheetProcessor, {
29
32
  outDir: path.dirname(esm2015),
30
33
  declaration: true,
31
34
  target: ts.ScriptTarget.ES2015
32
35
  }, path.dirname(declarations)),
33
- compile_source_files_1.compileSourceFiles(tsConfig, compilationFileCache, moduleResolutionCache, stylesheetProcessor, {
36
+ compile_source_files_1.compileSourceFiles(tsConfig, sourcesFileCache, moduleResolutionCache, stylesheetProcessor, {
34
37
  outDir: path.dirname(esm5),
35
38
  target: ts.ScriptTarget.ES5,
36
39
  downlevelIteration: true,
@@ -1 +1 @@
1
- {"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/ts/compile-ngc.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,iCAAiC;AACjC,wDAA2E;AAC3E,4EAAuE;AAEvE,yCAAyC;AACzC,uCAAgF;AAChF,4EAAwE;AAE3D,QAAA,mBAAmB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IAC/E,GAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAmB,CAAC;IAC1E,MAAM,QAAQ,GAAa,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;IAEpD,6BAA6B;IAC7B,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC;IACzE,MAAM,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;IACzE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC3E,MAAM,mBAAmB,GAAG,IAAI,0CAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAEzF,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,yCAAkB,CAChB,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB;YACE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YAC7B,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;SAC/B,EACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAC3B;QAED,yCAAkB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE;YAC7F,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAC1B,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG;YAC3B,kBAAkB,EAAE,IAAI;YACxB,kDAAkD;YAClD,WAAW,EAAE,KAAK;YAClB,cAAc,EAAE,SAAS;YACzB,gBAAgB,EAAE,IAAI;YACtB,mBAAmB,EAAE,IAAI;YACzB,kBAAkB,EAAE,KAAK;SAC1B,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport * as ts from 'typescript';\nimport { Transform, transformFromPromise } from '../../../brocc/transform';\nimport { compileSourceFiles } from '../../../ngc/compile-source-files';\nimport { TsConfig } from '../../../ts/tsconfig';\nimport * as log from '../../../util/log';\nimport { isEntryPointInProgress, EntryPointNode, isPackage } from '../../nodes';\nimport { StylesheetProcessor } from '../resources/stylesheet-processor';\n\nexport const compileNgcTransform: Transform = transformFromPromise(async graph => {\n log.info(`Compiling TypeScript sources through ngc`);\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const tsConfig: TsConfig = entryPoint.data.tsConfig;\n\n // Compile TypeScript sources\n const { esm2015, esm5, declarations } = entryPoint.data.destinationFiles;\n const { compilationFileCache, moduleResolutionCache } = entryPoint.cache;\n const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;\n const stylesheetProcessor = new StylesheetProcessor(basePath, cssUrl, styleIncludePaths);\n\n await Promise.all([\n compileSourceFiles(\n tsConfig,\n compilationFileCache,\n moduleResolutionCache,\n stylesheetProcessor,\n {\n outDir: path.dirname(esm2015),\n declaration: true,\n target: ts.ScriptTarget.ES2015\n },\n path.dirname(declarations)\n ),\n\n compileSourceFiles(tsConfig, compilationFileCache, moduleResolutionCache, stylesheetProcessor, {\n outDir: path.dirname(esm5),\n target: ts.ScriptTarget.ES5,\n downlevelIteration: true,\n // the options are here, to improve the build time\n declaration: false,\n declarationDir: undefined,\n skipMetadataEmit: true,\n skipTemplateCodegen: true,\n strictMetadataEmit: false\n })\n ]);\n\n return graph;\n});\n"]}
1
+ {"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../../src/lib/ng-v5/entry-point/ts/compile-ngc.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,6BAA6B;AAC7B,iCAAiC;AACjC,wDAA2E;AAC3E,4EAAuE;AACvE,mDAAoE;AACpE,yCAAyC;AACzC,uCAAmF;AACnF,4EAAwE;AAE3D,QAAA,mBAAmB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IAC/E,GAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAA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AAC;KACH,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import * as path from 'path';\nimport * as ts from 'typescript';\nimport { Transform, transformFromPromise } from '../../../brocc/transform';\nimport { compileSourceFiles } from '../../../ngc/compile-source-files';\nimport { setDependenciesTsConfigPaths } from '../../../ts/tsconfig';\nimport * as log from '../../../util/log';\nimport { isEntryPointInProgress, EntryPointNode, isEntryPoint } from '../../nodes';\nimport { StylesheetProcessor } from '../resources/stylesheet-processor';\n\nexport const compileNgcTransform: Transform = transformFromPromise(async graph => {\n log.info(`Compiling TypeScript sources through ngc`);\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const entryPoints = graph.filter(isEntryPoint) as EntryPointNode[];\n // Add paths mappings for dependencies\n const tsConfig = setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints);\n\n // Compile TypeScript sources\n const { esm2015, esm5, declarations } = entryPoint.data.destinationFiles;\n const { sourcesFileCache, moduleResolutionCache } = entryPoint.cache;\n const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;\n const stylesheetProcessor = new StylesheetProcessor(basePath, cssUrl, styleIncludePaths);\n\n await Promise.all([\n compileSourceFiles(\n tsConfig,\n sourcesFileCache,\n moduleResolutionCache,\n stylesheetProcessor,\n {\n outDir: path.dirname(esm2015),\n declaration: true,\n target: ts.ScriptTarget.ES2015\n },\n path.dirname(declarations)\n ),\n\n compileSourceFiles(tsConfig, sourcesFileCache, moduleResolutionCache, stylesheetProcessor, {\n outDir: path.dirname(esm5),\n target: ts.ScriptTarget.ES5,\n downlevelIteration: true,\n // the options are here, to improve the build time\n declaration: false,\n declarationDir: undefined,\n skipMetadataEmit: true,\n skipTemplateCodegen: true,\n strictMetadataEmit: false\n })\n ]);\n\n return graph;\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-bundles.transform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G,cAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAC5G,cAAc,CAAC,YAAY,GAAG,cAAM,CAClC,cAAc,CAAC,YAAY,CAAC,MAAM,CAChC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EACzB,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAC7B,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAC/B,CACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { map, switchMap } from 'rxjs/operators';\nimport { from as fromPromise, pipe } from 'rxjs';\nimport { Transform } from '../../brocc/transform';\nimport { FlattenOpts, flattenToFesm, flattenToUmd, flattenToUmdMin } from '../../flatten/flatten';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { isEntryPoint, isEntryPointInProgress, EntryPointNode } from '../nodes';\nimport * as log from '../../util/log';\nimport { DestinationFiles } from '../../ng-package-format/shared';\nimport { BuildGraph } from '../../brocc/build-graph';\nimport { DependencyList } from '../../flatten/external-module-id-strategy';\nimport { unique } from '../../util/array';\n\nexport const writeBundlesTransform: Transform = pipe(\n switchMap(graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n\n // Add UMD module IDs for dependencies\n const dependencyUmdIds = entryPoint\n .filter(isEntryPoint)\n .map(ep => ep.data.entryPoint)\n .reduce((prev, ep: NgEntryPoint) => {\n prev[ep.moduleId] = ep.umdId;\n\n return prev;\n }, {});\n\n const opts: FlattenOpts = {\n destFile: '',\n entryFile: '',\n sourceRoot: tsConfig.options.sourceRoot,\n flatModuleFile: ngEntryPoint.flatModuleFile,\n esmModuleId: ngEntryPoint.moduleId,\n umdModuleId: ngEntryPoint.umdId,\n amdId: ngEntryPoint.amdId,\n umdModuleIds: {\n ...ngEntryPoint.umdModuleIds,\n ...dependencyUmdIds\n },\n dependencyList: getDependencyListForGraph(graph)\n };\n\n return fromPromise(writeFlatBundleFiles(destinationFiles, opts)).pipe(map(() => graph));\n })\n);\n\nasync function writeFlatBundleFiles(destinationFiles: DestinationFiles, opts: FlattenOpts): Promise<void> {\n const { esm2015, fesm2015, esm5, fesm5, umd, umdMinified } = destinationFiles;\n\n log.info('Bundling to FESM2015');\n await flattenToFesm({\n ...opts,\n entryFile: esm2015,\n destFile: fesm2015\n });\n\n log.info('Bundling to FESM5');\n await flattenToFesm({\n ...opts,\n entryFile: esm5,\n destFile: fesm5\n });\n\n log.info('Bundling to UMD');\n await flattenToUmd({\n ...opts,\n entryFile: esm5,\n destFile: umd,\n dependencyList: opts.dependencyList\n });\n\n log.info('Minifying UMD bundle');\n await flattenToUmdMin(umd, umdMinified);\n}\n\n/** Get all list of dependencies for the entire 'BuildGraph' */\nfunction getDependencyListForGraph(graph: BuildGraph): DependencyList {\n // We need to do this because if A dependecy on bundled B\n // And A has a secondary entry point A/1 we want only to bundle B if it's used.\n // Also if A/1 depends on A we don't want to bundle A thus we mark this a dependency.\n\n const dependencyList: DependencyList = {\n dependencies: [],\n bundledDependencies: []\n };\n\n for (const entry of graph.filter(isEntryPoint)) {\n const { bundledDependencies = [], dependencies = {}, peerDependencies = {} } = entry.data.entryPoint.packageJson;\n\n dependencyList.bundledDependencies = unique(dependencyList.bundledDependencies.concat(bundledDependencies));\n dependencyList.dependencies = unique(\n dependencyList.dependencies.concat(\n Object.keys(dependencies),\n Object.keys(peerDependencies),\n entry.data.entryPoint.moduleId\n )\n );\n }\n\n return dependencyList;\n}\n"]}
1
+ {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,8CAAgD;AAChD,+BAAiD;AAEjD,mDAAkG;AAElG,oCAAgF;AAChF,sCAAsC;AAItC,4CAA0C;AAE7B,QAAA,qBAAqB,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,CAAC,YAAY,CAAC,EACzB,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAC7B,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAC/B,CACF,CAAC;KACH;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { map, switchMap } from 'rxjs/operators';\nimport { from as fromPromise, pipe } from 'rxjs';\nimport { Transform } from '../../brocc/transform';\nimport { FlattenOpts, flattenToFesm, flattenToUmd, flattenToUmdMin } from '../../flatten/flatten';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { isEntryPoint, isEntryPointInProgress, EntryPointNode } from '../nodes';\nimport * as log from '../../util/log';\nimport { DestinationFiles } from '../../ng-package-format/shared';\nimport { BuildGraph } from '../../brocc/build-graph';\nimport { DependencyList } from '../../flatten/external-module-id-strategy';\nimport { unique } from '../../util/array';\n\nexport const writeBundlesTransform: Transform = pipe(\n switchMap(graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n\n // Add UMD module IDs for dependencies\n const dependencyUmdIds = entryPoint\n .filter(isEntryPoint)\n .map(ep => ep.data.entryPoint)\n .reduce((prev, ep: NgEntryPoint) => {\n prev[ep.moduleId] = ep.umdId;\n\n return prev;\n }, {});\n\n const opts: FlattenOpts = {\n destFile: '',\n entryFile: '',\n sourceRoot: tsConfig.options.sourceRoot,\n flatModuleFile: ngEntryPoint.flatModuleFile,\n esmModuleId: ngEntryPoint.moduleId,\n umdModuleId: ngEntryPoint.umdId,\n amdId: ngEntryPoint.amdId,\n umdModuleIds: {\n ...ngEntryPoint.umdModuleIds,\n ...dependencyUmdIds\n },\n dependencyList: getDependencyListForGraph(graph)\n };\n\n return fromPromise(writeFlatBundleFiles(destinationFiles, opts)).pipe(map(() => graph));\n })\n);\n\nasync function writeFlatBundleFiles(destinationFiles: DestinationFiles, opts: FlattenOpts): Promise<void> {\n const { esm2015, fesm2015, esm5, fesm5, umd, umdMinified } = destinationFiles;\n\n log.info('Bundling to FESM2015');\n await flattenToFesm({\n ...opts,\n entryFile: esm2015,\n destFile: fesm2015\n });\n\n log.info('Bundling to FESM5');\n await flattenToFesm({\n ...opts,\n entryFile: esm5,\n destFile: fesm5\n });\n\n log.info('Bundling to UMD');\n await flattenToUmd({\n ...opts,\n entryFile: esm5,\n destFile: umd,\n dependencyList: opts.dependencyList\n });\n\n log.info('Minifying UMD bundle');\n await flattenToUmdMin(umd, umdMinified);\n}\n\n/** Get all list of dependencies for the entire 'BuildGraph' */\nfunction getDependencyListForGraph(graph: BuildGraph): DependencyList {\n // We need to do this because if A dependecy on bundled B\n // And A has a secondary entry point A/1 we want only to bundle B if it's used.\n // Also if A/1 depends on A we don't want to bundle A thus we mark this a dependency.\n\n const dependencyList: DependencyList = {\n dependencies: [],\n bundledDependencies: []\n };\n\n for (const entry of graph.filter(isEntryPoint)) {\n const { bundledDependencies = [], dependencies = {}, peerDependencies = {} } = entry.data.entryPoint.packageJson;\n\n dependencyList.bundledDependencies = unique(dependencyList.bundledDependencies.concat(bundledDependencies));\n dependencyList.dependencies = unique(\n dependencyList.dependencies.concat(\n Object.keys(dependencies),\n Object.keys(peerDependencies),\n entry.data.entryPoint.moduleId\n )\n );\n }\n\n return dependencyList;\n}\n"]}
@@ -16,6 +16,7 @@ const rimraf_1 = require("../../util/rimraf");
16
16
  const log = require("../../util/log");
17
17
  const glob_1 = require("../../util/glob");
18
18
  const nodes_1 = require("../nodes");
19
+ const copy_1 = require("../../util/copy");
19
20
  exports.writePackageTransform = transform_1.transformFromPromise((graph) => __awaiter(this, void 0, void 0, function* () {
20
21
  const entryPoint = graph.find(nodes_1.isEntryPointInProgress());
21
22
  const ngEntryPoint = entryPoint.data.entryPoint;
@@ -31,7 +32,7 @@ exports.writePackageTransform = transform_1.transformFromPromise((graph) => __aw
31
32
  yield Promise.all(declarationFiles.map(value => {
32
33
  const relativePath = path.relative(ngEntryPoint.entryFilePath, value);
33
34
  const destination = path.resolve(destinationFiles.declarations, relativePath);
34
- return fs.copy(value, destination);
35
+ return copy_1.copyFile(value, destination);
35
36
  }));
36
37
  }
37
38
  // 6. WRITE PACKAGE.JSON
@@ -1 +1 @@
1
- {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,qDAAwE;AAGxE,0CAAiD;AACjD,8CAA2C;AAC3C,sCAAsC;AACtC,0CAA4C;AAC5C,oCAAkE;AAErD,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAmB,CAAC;IAC1E,MAAM,YAAY,GAAiB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9D,MAAM,SAAS,GAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,IAAI,CAAC;IAC7F,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IAE7C,sCAAsC;IACtC,GAAG,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACtC,6FAA6F;IAC7F,MAAM,gBAAgB,GAAG,MAAM,gBAAS,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,EAAE;QAChG,MAAM,EAAE,CAAC,oBAAoB,EAAE,GAAG,SAAS,CAAC,IAAI,KAAK,CAAC;KACvD,CAAC,CAAC;IAEH,EAAE,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QAC5B,MAAM,OAAO,CAAC,GAAG,CACf,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAC3B,MAAM,YAAY,GAAG,IA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Content":["import * as fs from 'fs-extra';\nimport * as path from 'path';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { NgPackage } from '../../ng-package-format/package';\nimport { ensureUnixPath } from '../../util/path';\nimport { rimraf } from '../../util/rimraf';\nimport * as log from '../../util/log';\nimport { globFiles } from '../../util/glob';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\n\nexport const writePackageTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackage: NgPackage = graph.find(node => node.type === 'application/ng-package').data;\n const { destinationFiles } = entryPoint.data;\n\n // 5. COPY SOURCE FILES TO DESTINATION\n log.info('Copying declaration files');\n // we don't want to copy `dist` and 'node_modules' declaration files but only files in source\n const declarationFiles = await globFiles(`${path.dirname(ngEntryPoint.entryFilePath)}/**/*.d.ts`, {\n ignore: ['**/node_modules/**', `${ngPackage.dest}/**`]\n });\n\n if (declarationFiles.length) {\n await Promise.all(\n declarationFiles.map(value => {\n const relativePath = path.relative(ngEntryPoint.entryFilePath, value);\n const destination = path.resolve(destinationFiles.declarations, relativePath);\n return fs.copy(value, destination);\n })\n );\n }\n\n // 6. WRITE PACKAGE.JSON\n log.info('Writing package metadata');\n const relativeUnixFromDestPath = (filePath: string) =>\n ensureUnixPath(path.relative(ngEntryPoint.destinationPath, filePath));\n\n await writePackageJson(ngEntryPoint, ngPackage, {\n main: relativeUnixFromDestPath(destinationFiles.umd),\n module: relativeUnixFromDestPath(destinationFiles.fesm5),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n esm5: relativeUnixFromDestPath(destinationFiles.esm5),\n esm2015: relativeUnixFromDestPath(destinationFiles.esm2015),\n fesm5: relativeUnixFromDestPath(destinationFiles.fesm5),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n // XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?\n metadata: relativeUnixFromDestPath(destinationFiles.metadata),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.sideEffects\n });\n\n log.success(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n});\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the enty point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The proprties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param additionalProperties Additional properties, e.g. binary artefacts (bundle files), to merge into `package.json`\n */\nexport async function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] }\n): Promise<void> {\n log.debug('Writing package.json');\n\n // set additional properties\n const packageJson = { ...entryPoint.packageJson, ...additionalProperties };\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n // this is only required for primary\n if (!entryPoint.isSecondaryEntryPoint && !(packageJson.dependencies && packageJson.dependencies.tslib)) {\n const { dependencies: angularDependencies = {} } = require('@angular/compiler/package.json');\n const tsLibVersion = angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion\n };\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicated installs or version conflicts\n // in the node_modules folder of an application\n const whitelist = pkg.whitelistedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', whitelist);\n } catch (e) {\n await rimraf(entryPoint.destinationPath);\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (pkg.keepLifecycleScripts !== true) {\n log.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n log.warn(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`\n );\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n packageJson.name = entryPoint.moduleId;\n\n // `outputJson()` creates intermediate directories, if they do not exist\n // -- https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputJson.md\n await fs.outputJson(path.join(entryPoint.destinationPath, 'package.json'), packageJson, { spaces: 2 });\n}\n\nfunction checkNonPeerDependencies(packageJson: { [key: string]: any }, property: string, whitelist: RegExp[]) {\n if (packageJson[property]) {\n Object.keys(packageJson[property]).forEach(dep => {\n if (whitelist.find(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is whitelisted in '${property}'`);\n } else {\n log.warn(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to 'peerDependencies' or remove it from '${property}'.`\n );\n throw new Error(`Dependency ${dep} must be explicitly whitelisted.`);\n }\n });\n }\n}\n"]}
1
+ {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,qDAAwE;AAGxE,0CAAiD;AACjD,8CAA2C;AAC3C,sCAAsC;AACtC,0CAA4C;AAC5C,oCAAkE;AAClE,0CAA2C;AAE9B,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAmB,CAAC;IAC1E,MAAM,YAAY,GAAiB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9D,MAAM,SAAS,GAAc,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC,IAAI,CAAC;IAC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;aAChE;iBAAM;gBACL,GAAG,CAAC,IAAI,CACN,mCAAmC,QAAQ,gDAAgD,GAAG,6CAA6C,QAAQ,IAAI,CACxJ,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,cAAc,GAAG,kCAAkC,CAAC,CAAC;aACtE;QACH,CAAC,CAAC,CAAC;KACJ;AACH,CAAC","sourcesContent":["import * as fs from 'fs-extra';\nimport * as path from 'path';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { NgEntryPoint } from '../../ng-package-format/entry-point';\nimport { NgPackage } from '../../ng-package-format/package';\nimport { ensureUnixPath } from '../../util/path';\nimport { rimraf } from '../../util/rimraf';\nimport * as log from '../../util/log';\nimport { globFiles } from '../../util/glob';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { copyFile } from '../../util/copy';\n\nexport const writePackageTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackage: NgPackage = graph.find(node => node.type === 'application/ng-package').data;\n const { destinationFiles } = entryPoint.data;\n\n // 5. COPY SOURCE FILES TO DESTINATION\n log.info('Copying declaration files');\n // we don't want to copy `dist` and 'node_modules' declaration files but only files in source\n const declarationFiles = await globFiles(`${path.dirname(ngEntryPoint.entryFilePath)}/**/*.d.ts`, {\n ignore: ['**/node_modules/**', `${ngPackage.dest}/**`]\n });\n\n if (declarationFiles.length) {\n await Promise.all(\n declarationFiles.map(value => {\n const relativePath = path.relative(ngEntryPoint.entryFilePath, value);\n const destination = path.resolve(destinationFiles.declarations, relativePath);\n return copyFile(value, destination);\n })\n );\n }\n\n // 6. WRITE PACKAGE.JSON\n log.info('Writing package metadata');\n const relativeUnixFromDestPath = (filePath: string) =>\n ensureUnixPath(path.relative(ngEntryPoint.destinationPath, filePath));\n\n await writePackageJson(ngEntryPoint, ngPackage, {\n main: relativeUnixFromDestPath(destinationFiles.umd),\n module: relativeUnixFromDestPath(destinationFiles.fesm5),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n esm5: relativeUnixFromDestPath(destinationFiles.esm5),\n esm2015: relativeUnixFromDestPath(destinationFiles.esm2015),\n fesm5: relativeUnixFromDestPath(destinationFiles.fesm5),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n // XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?\n metadata: relativeUnixFromDestPath(destinationFiles.metadata),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.sideEffects\n });\n\n log.success(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n});\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the enty point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The proprties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param additionalProperties Additional properties, e.g. binary artefacts (bundle files), to merge into `package.json`\n */\nexport async function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] }\n): Promise<void> {\n log.debug('Writing package.json');\n\n // set additional properties\n const packageJson = { ...entryPoint.packageJson, ...additionalProperties };\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n // this is only required for primary\n if (!entryPoint.isSecondaryEntryPoint && !(packageJson.dependencies && packageJson.dependencies.tslib)) {\n const { dependencies: angularDependencies = {} } = require('@angular/compiler/package.json');\n const tsLibVersion = angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion\n };\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicated installs or version conflicts\n // in the node_modules folder of an application\n const whitelist = pkg.whitelistedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', whitelist);\n } catch (e) {\n await rimraf(entryPoint.destinationPath);\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (pkg.keepLifecycleScripts !== true) {\n log.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n log.warn(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`\n );\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n packageJson.name = entryPoint.moduleId;\n\n // `outputJson()` creates intermediate directories, if they do not exist\n // -- https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputJson.md\n await fs.outputJson(path.join(entryPoint.destinationPath, 'package.json'), packageJson, { spaces: 2 });\n}\n\nfunction checkNonPeerDependencies(packageJson: { [key: string]: any }, property: string, whitelist: RegExp[]) {\n if (packageJson[property]) {\n Object.keys(packageJson[property]).forEach(dep => {\n if (whitelist.find(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is whitelisted in '${property}'`);\n } else {\n log.warn(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} to 'peerDependencies' or remove it from '${property}'.`\n );\n throw new Error(`Dependency ${dep} must be explicitly whitelisted.`);\n }\n });\n }\n}\n"]}
@@ -8,8 +8,9 @@ const log = require("../../util/log");
8
8
  const nodes_1 = require("../nodes");
9
9
  const cache_compiler_host_1 = require("../../ts/cache-compiler-host");
10
10
  const array_1 = require("../../util/array");
11
+ const tsconfig_1 = require("../../ts/tsconfig");
11
12
  exports.analyseSourcesTransform = rxjs_1.pipe(operators_1.map(graph => {
12
- const entryPoints = graph.filter(nodes_1.isEntryPoint);
13
+ const entryPoints = graph.filter(x => nodes_1.isEntryPoint(x) && x.state !== 'done');
13
14
  for (let entryPoint of entryPoints) {
14
15
  analyseEntryPoint(entryPoint, entryPoints);
15
16
  }
@@ -22,11 +23,12 @@ exports.analyseSourcesTransform = rxjs_1.pipe(operators_1.map(graph => {
22
23
  * @param entryPoints List of all entry points.
23
24
  */
24
25
  function analyseEntryPoint(entryPoint, entryPoints) {
25
- const { tsConfig } = entryPoint.data;
26
- const { analysisFileCache, analysisModuleResolutionCache } = entryPoint.cache;
26
+ const { sourcesFileCache, analysisModuleResolutionCache } = entryPoint.cache;
27
27
  const { moduleId } = entryPoint.data.entryPoint;
28
28
  log.debug(`Analysing sources for ${moduleId}`);
29
- const compilerHost = Object.assign({}, cache_compiler_host_1.cacheCompilerHost(tsConfig.options, analysisFileCache, analysisModuleResolutionCache), { readResource: () => '' });
29
+ // Add paths mappings for dependencies
30
+ const tsConfig = tsconfig_1.setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints, true);
31
+ const compilerHost = Object.assign({}, cache_compiler_host_1.cacheCompilerHost(tsConfig.options, sourcesFileCache, analysisModuleResolutionCache), { readResource: () => '' });
30
32
  const program = ng.createProgram({
31
33
  rootNames: tsConfig.rootNames,
32
34
  options: tsConfig.options,
@@ -1 +1 @@
1
- {"version":3,"file":"analyse-sources.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/analyse-sources.transform.ts"],"names":[],"mappings":";;AAAA,4CAA4C;AAC5C,iCAAiC;AACjC,+BAA4B;AAC5B,8CAAqC;AACrC,sCAAsC;AAEtC,oCAAwD;AACxD,sEAAiE;AACjE,4CAAmD;AAEtC,QAAA,uBAAuB,GAAc,WAAI,CACpD,eAAG,CAAC,KAAK,CAAC,EAAE;IACV,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAqB,CAAC;IAEnE,GAAG,CAAC,CAAC,IAAI,UAAU,IAAI,WAAW,CAAC,CAAC,CAAC;QACnC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,KAAK,CAAC;AAC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ript';\nimport { pipe } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport * as log from '../../util/log';\nimport { Transform } from '../../brocc/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { cacheCompilerHost } from '../../ts/cache-compiler-host';\nimport { unique, flatten } from '../../util/array';\n\nexport const analyseSourcesTransform: Transform = pipe(\n map(graph => {\n const entryPoints = graph.filter(isEntryPoint) as EntryPointNode[];\n\n for (let entryPoint of entryPoints) {\n analyseEntryPoint(entryPoint, entryPoints);\n }\n\n return graph;\n })\n);\n\n/**\n * Analyses an entrypoint, searching for TypeScript dependencies and additional resources (Templates and Stylesheets).\n *\n * @param entryPoint Current entry point that should be analysed.\n * @param entryPoints List of all entry points.\n */\nfunction analyseEntryPoint(entryPoint: EntryPointNode, entryPoints: EntryPointNode[]) {\n const { tsConfig } = entryPoint.data;\n const { analysisFileCache, analysisModuleResolutionCache } = entryPoint.cache;\n const { moduleId } = entryPoint.data.entryPoint;\n\n log.debug(`Analysing sources for ${moduleId}`);\n\n const compilerHost = {\n ...cacheCompilerHost(tsConfig.options, analysisFileCache, analysisModuleResolutionCache),\n readResource: () => ''\n };\n\n const program: ng.Program = ng.createProgram({\n rootNames: tsConfig.rootNames,\n options: tsConfig.options,\n host: compilerHost\n });\n\n const diagnostics = program.getNgSemanticDiagnostics();\n if (diagnostics.length) {\n throw new Error(ng.formatDiagnostics(diagnostics));\n }\n\n // this is a workaround due to the below\n // https://github.com/angular/angular/issues/24010\n let moduleStatements: string[] = [];\n\n program\n .getTsProgram()\n .getSourceFiles()\n .filter(x => !/node_modules|\\.ngfactory|\\.ngstyle|(\\.d\\.ts$)/.test(x.fileName))\n .forEach(sourceFile => {\n sourceFile.statements\n .filter(x => ts.isImportDeclaration(x) || ts.isExportDeclaration(x))\n .forEach((node: ts.ImportDeclaration | ts.ExportDeclaration) => {\n const { moduleSpecifier } = node;\n if (!moduleSpecifier) {\n return;\n }\n\n const text = moduleSpecifier.getText();\n const trimmedText = text.substring(1, text.length - 1);\n if (!trimmedText.startsWith('.')) {\n moduleStatements.push(trimmedText);\n }\n });\n });\n\n moduleStatements = unique(moduleStatements);\n moduleStatements.forEach(moduleName => {\n const dep = entryPoints.find(ep => ep.data.entryPoint.moduleId === moduleName);\n if (dep) {\n log.debug(`Found entry point dependency: ${moduleId} -> ${moduleName}`);\n\n if (moduleId === moduleName) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on itself.`);\n }\n\n entryPoint.dependsOn(dep);\n }\n });\n}\n"]}
1
+ {"version":3,"file":"analyse-sources.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/analyse-sources.transform.ts"],"names":[],"mappings":";;AAAA,4CAA4C;AAC5C,iCAAiC;AACjC,+BAA4B;AAC5B,8CAAqC;AACrC,sCAAsC;AAEtC,oCAAwD;AACxD,sEAAiE;AACjE,4CAA0C;AAC1C,gDAAiE;AAEpD,QAAA,uBAAuB,GAAc,WAAI,CACpD,eAAG,CAAC,KAAK,CAAC,EAAE;IACV,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,oBAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAqB,CAAC;IACjG,KAAK,IAAI,UAAU,IAAI,WAAW,EAAE;QAClC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;KAC5C;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,CACH,CAAC;AAEF;;;;;GAKG;AACH,2BAA2B,UAA0B,EAAE,WAA6B;IAClF,MAAM,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;IAC7E,MAAM,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAEhD,GAAG,CAAC,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAC;IAE/C,sCAAsC;IACtC,MAAM,QAAQ,GAAG,uCAA4B,CA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IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACvD,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;gBAChC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;aACpC;QACH,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEL,gBAAgB,GAAG,cAAM,CAAC,gBAAgB,CAAC,CAAC;IAC5C,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACpC,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;QAC/E,IAAI,GAAG,EAAE;YACP,GAAG,CAAC,KAAK,CAAC,iCAAiC,QAAQ,OAAO,UAAU,EAAE,CAAC,CAAC;YAExE,IAAI,QAAQ,KAAK,UAAU,EAAE;gBAC3B,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,uCAAuC,CAAC,CAAC;aACnF;YAED,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SAC3B;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import * as ng from '@angular/compiler-cli';\nimport * as ts from 'typescript';\nimport { pipe } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport * as log from '../../util/log';\nimport { Transform } from '../../brocc/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { cacheCompilerHost } from '../../ts/cache-compiler-host';\nimport { unique } from '../../util/array';\nimport { setDependenciesTsConfigPaths } from '../../ts/tsconfig';\n\nexport const analyseSourcesTransform: Transform = pipe(\n map(graph => {\n const entryPoints = graph.filter(x => isEntryPoint(x) && x.state !== 'done') as EntryPointNode[];\n for (let entryPoint of entryPoints) {\n analyseEntryPoint(entryPoint, entryPoints);\n }\n\n return graph;\n })\n);\n\n/**\n * Analyses an entrypoint, searching for TypeScript dependencies and additional resources (Templates and Stylesheets).\n *\n * @param entryPoint Current entry point that should be analysed.\n * @param entryPoints List of all entry points.\n */\nfunction analyseEntryPoint(entryPoint: EntryPointNode, entryPoints: EntryPointNode[]) {\n const { sourcesFileCache, analysisModuleResolutionCache } = entryPoint.cache;\n const { moduleId } = entryPoint.data.entryPoint;\n\n log.debug(`Analysing sources for ${moduleId}`);\n\n // Add paths mappings for dependencies\n const tsConfig = setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints, true);\n\n const compilerHost = {\n ...cacheCompilerHost(tsConfig.options, sourcesFileCache, analysisModuleResolutionCache),\n readResource: () => ''\n };\n\n const program: ng.Program = ng.createProgram({\n rootNames: tsConfig.rootNames,\n options: tsConfig.options,\n host: compilerHost\n });\n\n const diagnostics = program.getNgSemanticDiagnostics();\n if (diagnostics.length) {\n throw new Error(ng.formatDiagnostics(diagnostics));\n }\n\n // this is a workaround due to the below\n // https://github.com/angular/angular/issues/24010\n let moduleStatements: string[] = [];\n\n program\n .getTsProgram()\n .getSourceFiles()\n .filter(x => !/node_modules|\\.ngfactory|\\.ngstyle|(\\.d\\.ts$)/.test(x.fileName))\n .forEach(sourceFile => {\n sourceFile.statements\n .filter(x => ts.isImportDeclaration(x) || ts.isExportDeclaration(x))\n .forEach((node: ts.ImportDeclaration | ts.ExportDeclaration) => {\n const { moduleSpecifier } = node;\n if (!moduleSpecifier) {\n return;\n }\n\n const text = moduleSpecifier.getText();\n const trimmedText = text.substring(1, text.length - 1);\n if (!trimmedText.startsWith('.')) {\n moduleStatements.push(trimmedText);\n }\n });\n });\n\n moduleStatements = unique(moduleStatements);\n moduleStatements.forEach(moduleName => {\n const dep = entryPoints.find(ep => ep.data.entryPoint.moduleId === moduleName);\n if (dep) {\n log.debug(`Found entry point dependency: ${moduleId} -> ${moduleName}`);\n\n if (moduleId === moduleName) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on itself.`);\n }\n\n entryPoint.dependsOn(dep);\n }\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { ParsedConfiguration } from '@angular/compiler-cli/src/perform_compile';
1
+ import { ParsedConfiguration } from '@angular/compiler-cli';
2
2
  import { InjectionToken, Provider } from 'injection-js';
3
3
  import { Transform } from '../../brocc/transform';
4
4
  import { TransformProvider } from '../../brocc/transform.di';
@@ -1 +1 @@
1
- {"version":3,"file":"init-tsconfig.di.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/init-tsconfig.di.ts"],"names":[],"mappings":";;AAEA,+CAAwD;AAExD,2DAA+E;AAC/E,gDAAoE;AACpE,uEAAyE;AAE5D,QAAA,eAAe,GAAG,CAAC,MAA0B,EAAY,EAAE;IACtE,MAAM,CAAC;QACL,OAAO,EAAE,+BAAuB;QAChC,UAAU,EAAE,GAAG,EAAE;YACf,MAAM,CAAC,gCAAqB,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAI,6BAAc,CAAW,uBAAuB,CAAC,CAAC;AAEhF,QAAA,0BAA0B,GAAa,uBAAe,EAAE,CAAC;AAEzD,QAAA,oBAAoB,GAAG,IAAI,6BAAc,CAAY,6BAA6B,CAAC,CAAC;AAEpF,QAAA,wBAAwB,GAAsB,+BAAgB,CAAC;IAC1E,OAAO,EAAE,4BAAoB;IAC7B,UAAU,EAAE,sDAA4B;IACxC,IAAI,EAAE,CAAC,+BAAuB,CAAC;CAChC,CAAC,CAAC","sourcesContent":["// XX: has or is using name 'ParsedConfiguration' ... but cannot be named\nimport { ParsedConfiguration } from '@angular/compiler-cli/src/perform_compile';\nimport { InjectionToken, Provider } from 'injection-js';\nimport { Transform } from '../../brocc/transform';\nimport { TransformProvider, provideTransform } from '../../brocc/transform.di';\nimport { createDefaultTsConfig, TsConfig } from '../../ts/tsconfig';\nimport { initTsConfigTransformFactory } from './init-tsconfig.transform';\n\nexport const provideTsConfig = (values?: TsConfig | string): Provider => {\n return {\n provide: DEFAULT_TS_CONFIG_TOKEN,\n useFactory: () => {\n return createDefaultTsConfig(values);\n },\n deps: []\n };\n};\n\nexport const DEFAULT_TS_CONFIG_TOKEN = new InjectionToken<TsConfig>('ng.v5.defaultTsConfig');\n\nexport const DEFAULT_TS_CONFIG_PROVIDER: Provider = provideTsConfig();\n\nexport const INIT_TS_CONFIG_TOKEN = new InjectionToken<Transform>('ng.v5.initTsConfigTransform');\n\nexport const INIT_TS_CONFIG_TRANSFORM: TransformProvider = provideTransform({\n provide: INIT_TS_CONFIG_TOKEN,\n useFactory: initTsConfigTransformFactory,\n deps: [DEFAULT_TS_CONFIG_TOKEN]\n});\n"]}
1
+ {"version":3,"file":"init-tsconfig.di.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/init-tsconfig.di.ts"],"names":[],"mappings":";;AACA,+CAAwD;AAExD,2DAA+E;AAC/E,gDAA0D;AAC1D,uEAAyE;AAE5D,QAAA,eAAe,GAAG,CAAC,MAAqC,EAAY,EAAE;IACjF,OAAO;QACL,OAAO,EAAE,+BAAuB;QAChC,UAAU,EAAE,GAAG,EAAE;YACf,OAAO,gCAAqB,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,EAAE;KACT,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,uBAAuB,GAAG,IAAI,6BAAc,CAAsB,uBAAuB,CAAC,CAAC;AAE3F,QAAA,0BAA0B,GAAa,uBAAe,EAAE,CAAC;AAEzD,QAAA,oBAAoB,GAAG,IAAI,6BAAc,CAAY,6BAA6B,CAAC,CAAC;AAEpF,QAAA,wBAAwB,GAAsB,+BAAgB,CAAC;IAC1E,OAAO,EAAE,4BAAoB;IAC7B,UAAU,EAAE,sDAA4B;IACxC,IAAI,EAAE,CAAC,+BAAuB,CAAC;CAChC,CAAC,CAAC","sourcesContent":["import { ParsedConfiguration } from '@angular/compiler-cli';\nimport { InjectionToken, Provider } from 'injection-js';\nimport { Transform } from '../../brocc/transform';\nimport { TransformProvider, provideTransform } from '../../brocc/transform.di';\nimport { createDefaultTsConfig } from '../../ts/tsconfig';\nimport { initTsConfigTransformFactory } from './init-tsconfig.transform';\n\nexport const provideTsConfig = (values?: ParsedConfiguration | string): Provider => {\n return {\n provide: DEFAULT_TS_CONFIG_TOKEN,\n useFactory: () => {\n return createDefaultTsConfig(values);\n },\n deps: []\n };\n};\n\nexport const DEFAULT_TS_CONFIG_TOKEN = new InjectionToken<ParsedConfiguration>('ng.v5.defaultTsConfig');\n\nexport const DEFAULT_TS_CONFIG_PROVIDER: Provider = provideTsConfig();\n\nexport const INIT_TS_CONFIG_TOKEN = new InjectionToken<Transform>('ng.v5.initTsConfigTransform');\n\nexport const INIT_TS_CONFIG_TRANSFORM: TransformProvider = provideTransform({\n provide: INIT_TS_CONFIG_TOKEN,\n useFactory: initTsConfigTransformFactory,\n deps: [DEFAULT_TS_CONFIG_TOKEN]\n});\n"]}
@@ -1,3 +1,3 @@
1
- import { ParsedConfiguration } from '@angular/compiler-cli/src/perform_compile';
1
+ import { ParsedConfiguration } from '@angular/compiler-cli';
2
2
  import { Transform } from '../../brocc/transform';
3
3
  export declare const initTsConfigTransformFactory: (defaultTsConfig: ParsedConfiguration) => Transform;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  const transform_1 = require("../../brocc/transform");
12
- const tsconfig_1 = require("../../ts/tsconfig");
13
12
  const nodes_1 = require("../nodes");
13
+ const tsconfig_1 = require("../../ts/tsconfig");
14
14
  exports.initTsConfigTransformFactory = (defaultTsConfig) => transform_1.transformFromPromise((graph) => __awaiter(this, void 0, void 0, function* () {
15
15
  // Initialize tsconfig for each entry point
16
16
  const entryPoints = graph.filter(nodes_1.isEntryPoint);
@@ -1 +1 @@
1
- {"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,qDAAwE;AACxE,gDAAiE;AACjE,oCAAwD;AAE3C,QAAA,4BAA4B,GAAG,CAAC,eAAyB,EAAa,EAAE,CACnF,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjC,2CAA2C;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAqB,CAAC;IACnE,6BAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["// XX: has or is using name 'ParsedConfiguration' ... but cannot be named\nimport { ParsedConfiguration } from '@angular/compiler-cli/src/perform_compile';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { TsConfig, initializeTsConfig } from '../../ts/tsconfig';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\n\nexport const initTsConfigTransformFactory = (defaultTsConfig: TsConfig): Transform =>\n transformFromPromise(async graph => {\n // Initialize tsconfig for each entry point\n const entryPoints = graph.filter(isEntryPoint) as EntryPointNode[];\n initializeTsConfig(defaultTsConfig, entryPoints);\n return graph;\n });\n"]}
1
+ {"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-v5/init/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;AACA,qDAAwE;AACxE,oCAAwD;AACxD,gDAAuD;AAE1C,QAAA,4BAA4B,GAAG,CAAC,eAAoC,EAAa,EAAE,CAC9F,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjC,2CAA2C;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAqB,CAAC;IACnE,6BAAkB,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import { ParsedConfiguration } from '@angular/compiler-cli';\nimport { Transform, transformFromPromise } from '../../brocc/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { initializeTsConfig } from '../../ts/tsconfig';\n\nexport const initTsConfigTransformFactory = (defaultTsConfig: ParsedConfiguration): Transform =>\n transformFromPromise(async graph => {\n // Initialize tsconfig for each entry point\n const entryPoints = graph.filter(isEntryPoint) as EntryPointNode[];\n initializeTsConfig(defaultTsConfig, entryPoints);\n return graph;\n });\n"]}