ng-packagr 10.0.3 → 10.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/cli/main.js +1 -2
  3. package/cli/main.js.map +1 -1
  4. package/lib/flatten/external-module-id-strategy.js +1 -1
  5. package/lib/flatten/external-module-id-strategy.js.map +1 -1
  6. package/lib/flatten/uglify.d.ts +1 -1
  7. package/lib/flatten/uglify.js +3 -12
  8. package/lib/flatten/uglify.js.map +1 -1
  9. package/lib/graph/transform.d.ts +1 -1
  10. package/lib/graph/transform.di.d.ts +1 -1
  11. package/lib/graph/transform.di.js +1 -1
  12. package/lib/graph/transform.di.js.map +1 -1
  13. package/lib/graph/transform.js.map +1 -1
  14. package/lib/ng-package/discover-packages.js +21 -6
  15. package/lib/ng-package/discover-packages.js.map +1 -1
  16. package/lib/ng-package/entry-point/entry-point.d.ts +5 -5
  17. package/lib/ng-package/entry-point/entry-point.js +1 -1
  18. package/lib/ng-package/entry-point/entry-point.js.map +1 -1
  19. package/lib/ng-package/entry-point/entry-point.transform.d.ts +1 -1
  20. package/lib/ng-package/entry-point/entry-point.transform.js +1 -1
  21. package/lib/ng-package/entry-point/entry-point.transform.js.map +1 -1
  22. package/lib/ng-package/entry-point/init-tsconfig.transform.js +2 -2
  23. package/lib/ng-package/entry-point/init-tsconfig.transform.js.map +1 -1
  24. package/lib/ng-package/entry-point/write-bundles.transform.js +2 -2
  25. package/lib/ng-package/entry-point/write-bundles.transform.js.map +1 -1
  26. package/lib/ng-package/entry-point/write-package.transform.js +1 -1
  27. package/lib/ng-package/entry-point/write-package.transform.js.map +1 -1
  28. package/lib/ng-package/package.d.ts +3 -3
  29. package/lib/ng-package/package.js +2 -2
  30. package/lib/ng-package/package.js.map +1 -1
  31. package/lib/ngc/create-emit-callback.js +1 -1
  32. package/lib/ngc/create-emit-callback.js.map +1 -1
  33. package/lib/packagr.d.ts +1 -1
  34. package/lib/packagr.js +1 -1
  35. package/lib/packagr.js.map +1 -1
  36. package/lib/styles/stylesheet-processor.js +5 -5
  37. package/lib/styles/stylesheet-processor.js.map +1 -1
  38. package/lib/ts/tsconfig.js +1 -0
  39. package/lib/ts/tsconfig.js.map +1 -1
  40. package/lib/utils/color.d.ts +3 -0
  41. package/lib/utils/color.js +14 -0
  42. package/lib/utils/color.js.map +1 -0
  43. package/lib/utils/log.js +9 -9
  44. package/lib/utils/log.js.map +1 -1
  45. package/lib/utils/path.js +9 -2
  46. package/lib/utils/path.js.map +1 -1
  47. package/package.json +9 -10
  48. package/public_api.js +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,47 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [10.1.2](https://github.com/ng-packagr/ng-packagr/compare/v10.1.1...v10.1.2) (2020-09-26)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * fix windows less spawn error ([9174c0b](https://github.com/ng-packagr/ng-packagr/commit/9174c0bca7290a4505f33f7fa13332785ea47459))
11
+
12
+ ### [10.1.1](https://github.com/ng-packagr/ng-packagr/compare/v10.1.0...v10.1.1) (2020-09-25)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add basePath as sourceRoot ([681fb1c](https://github.com/ng-packagr/ng-packagr/commit/681fb1c36b68efb3078dc3d846776e9e749ebf44))
18
+ * replace execFile with execFileSync to fix a potential malicious cmd injection ([bda0fff](https://github.com/ng-packagr/ng-packagr/commit/bda0fff3443301f252930a73fdc8fb9502de596d))
19
+
20
+ ## [10.1.0](https://github.com/ng-packagr/ng-packagr/compare/v10.0.4...v10.1.0) (2020-08-27)
21
+
22
+
23
+ ### Features
24
+
25
+ * add support for TypeScript 4 ([eb8b0c2](https://github.com/ng-packagr/ng-packagr/commit/eb8b0c2553aa1847f4ab42f29a1a25e67f644d29))
26
+ * show warning on deprecated option usage ([551a4d9](https://github.com/ng-packagr/ng-packagr/commit/551a4d9a866a8c337189f807d755856b995ffc9b))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * update commander to version ^6.0.0 ([ec736e5](https://github.com/ng-packagr/ng-packagr/commit/ec736e5df6978be79dca236683936941f349a8e5))
32
+
33
+
34
+ ### Performance
35
+
36
+ * cache normalized paths ([92f68e3](https://github.com/ng-packagr/ng-packagr/commit/92f68e3f09f66c990413e09cda5d742ad00c5b7f))
37
+
38
+ ### [10.0.4](https://github.com/ng-packagr/ng-packagr/compare/v10.0.3...v10.0.4) (2020-08-13)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * update @rollup/plugin-commonjs to version ^15.0.0 ([cc3254a](https://github.com/ng-packagr/ng-packagr/commit/cc3254aa230e1c94991514e780facc2eb19b4546))
44
+ * update @rollup/plugin-node-resolve to version ^9.0.0 ([47606fd](https://github.com/ng-packagr/ng-packagr/commit/47606fd2ae254e024d9fdcac11489e114ced145a))
45
+
5
46
  ### [10.0.3](https://github.com/ng-packagr/ng-packagr/compare/v10.0.2...v10.0.3) (2020-07-22)
6
47
 
7
48
 
package/cli/main.js CHANGED
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const program = require("commander");
5
5
  const path = require("path");
6
- const updateNotifier = require("update-notifier");
7
6
  const readPkgUp = require("read-pkg-up");
8
7
  const public_api_1 = require("../public_api");
9
8
  const DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');
@@ -12,13 +11,13 @@ function parseProjectPath(parsed) {
12
11
  }
13
12
  program
14
13
  .name('ng-packagr')
14
+ .storeOptionsAsProperties(false)
15
15
  .option('-v, --version', 'Prints version info')
16
16
  .option('-w, --watch', 'Watch for file changes')
17
17
  .option('-p, --project [path]', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
18
18
  .option('-c, --config [config]', 'Path to a tsconfig file.', (value) => value ? path.resolve(value) : undefined);
19
19
  const dir = path.dirname(module.filename);
20
20
  const pkg = readPkgUp.sync({ cwd: dir }).pkg;
21
- updateNotifier({ pkg }).notify();
22
21
  program.on('option:version', () => {
23
22
  public_api_1.version(pkg);
24
23
  process.exit(0);
package/cli/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AACrC,6BAA6B;AAC7B,kDAAkD;AAClD,yCAAyC;AACzC,8CAAwD;AAExD,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAE5E,SAAS,gBAAgB,CAAC,MAAc;IACtC,OAAO,MAAM,IAAI,oBAAoB,CAAC;AACxC,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC;KAC9C,MAAM,CAAC,aAAa,EAAE,wBAAwB,CAAC;KAC/C,MAAM,CACL,sBAAsB,EACtB,uDAAuD,EACvD,gBAAgB,EAChB,oBAAoB,CACrB;KACA,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,EAAE,CAAC,KAAyB,EAAE,EAAE,CACzF,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CACxC,CAAC;AAEJ,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;AAC7C,cAAc,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;AAEjC,OAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAChC,oBAAO,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAClD,oBAAO,CAAC,kBAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport * as program from 'commander';\nimport * as path from 'path';\nimport * as updateNotifier from 'update-notifier';\nimport * as readPkgUp from 'read-pkg-up';\nimport { execute, build, version } from '../public_api';\n\nconst DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');\n\nfunction parseProjectPath(parsed: string): string {\n return parsed || DEFAULT_PROJECT_PATH;\n}\n\nprogram\n .name('ng-packagr')\n .option('-v, --version', 'Prints version info')\n .option('-w, --watch', 'Watch for file changes')\n .option(\n '-p, --project [path]',\n \"Path to the 'ng-package.json' or 'package.json' file.\",\n parseProjectPath,\n DEFAULT_PROJECT_PATH,\n )\n .option('-c, --config [config]', 'Path to a tsconfig file.', (value: string | undefined) =>\n value ? path.resolve(value) : undefined,\n );\n\nconst dir = path.dirname(module.filename);\nconst pkg = readPkgUp.sync({ cwd: dir }).pkg;\nupdateNotifier({ pkg }).notify();\n\nprogram.on('option:version', () => {\n version(pkg);\n process.exit(0);\n});\n\nprogram.parse(process.argv);\n\nconst { config, project, watch } = program.opts();\nexecute(build, { config, project, watch: !!watch }).catch(() => process.exit(111));\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;AAEA,qCAAqC;AACrC,6BAA6B;AAC7B,yCAAyC;AACzC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,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport * as program from 'commander';\nimport * as path from 'path';\nimport * as readPkgUp from 'read-pkg-up';\nimport { execute, build, version } from '../public_api';\n\nconst DEFAULT_PROJECT_PATH = path.resolve(process.cwd(), 'ng-package.json');\n\nfunction parseProjectPath(parsed: string): string {\n return parsed || DEFAULT_PROJECT_PATH;\n}\n\nprogram\n .name('ng-packagr')\n .storeOptionsAsProperties(false)\n .option('-v, --version', 'Prints version info')\n .option('-w, --watch', 'Watch for file changes')\n .option(\n '-p, --project [path]',\n \"Path to the 'ng-package.json' or 'package.json' file.\",\n parseProjectPath,\n DEFAULT_PROJECT_PATH,\n )\n .option('-c, --config [config]', 'Path to a tsconfig file.', (value: string | undefined) =>\n value ? path.resolve(value) : undefined,\n );\n\nconst dir = path.dirname(module.filename);\nconst pkg = readPkgUp.sync({ cwd: dir }).pkg;\n\nprogram.on('option:version', () => {\n version(pkg);\n process.exit(0);\n});\n\nprogram.parse(process.argv);\n\nconst { config, project, watch } = program.opts();\nexecute(build, { config, project, watch: !!watch }).catch(() => process.exit(111));\n"]}
@@ -34,7 +34,7 @@ class ExternalModuleIdStrategy {
34
34
  if (this.moduleFormat !== 'umd') {
35
35
  return /./; // catch all as external
36
36
  }
37
- // tslib should always be embeeded for umd modules
37
+ // tslib should always be embedded for umd modules
38
38
  if (bundledDependencies.length === 0) {
39
39
  return /^((?!tslib).)*$/;
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"external-module-id-strategy.js","sourceRoot":"","sources":["../../../src/lib/flatten/external-module-id-strategy.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAU7B,MAAa,wBAAwB;IACnC,YAAoB,YAAiC,EAAU,cAA8B;QAAzE,iBAAY,GAAZ,YAAY,CAAqB;QAAU,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAEjG,8DAA8D;IAC9D,oBAAoB,CAAC,QAAgB;QACnC,oEAAoE;QACpE,yFAAyF;QACzF,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACrF,yGAAyG;YACzG,OAAO,KAAK,CAAC;SACd;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACnD,IACE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACtB,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC7B;YACA,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,yBAAyB;QACvB,MAAM,EAAE,mBAAmB,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QAE5E,qGAAqG;QACrG,qFAAqF;QACrF,qCAAqC;QACrC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC/B,OAAO,GAAG,CAAC,CAAC,wBAAwB;SACrC;QAED,kDAAkD;QAClD,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;YACpC,OAAO,iBAAiB,CAAC;SAC1B;QAED,wDAAwD;QACxD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AA7CD,4DA6CC","sourcesContent":["import * as path from 'path';\nimport * as rollup from 'rollup';\n\nexport interface DependencyList {\n /** Direct dependencies including peerDependencies and other entry points. */\n dependencies?: string[];\n /** Direct bundled dependencies */\n bundledDependencies?: string[];\n}\n\nexport class ExternalModuleIdStrategy {\n constructor(private moduleFormat: rollup.ModuleFormat, private dependencyList: DependencyList) {}\n\n /** Return true when moduleId is to be treated as external */\n isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (path.isAbsolute(moduleId) || moduleId.startsWith('.') || moduleId.startsWith('/')) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n const externals = this.getNonBundledDependencies();\n if (\n Array.isArray(externals)\n ? !externals.some(x => x === moduleId || moduleId.startsWith(`${x}/`))\n : !externals.test(moduleId)\n ) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Returns a array of strings or a RegExp of non-bundled dependencies.\n */\n getNonBundledDependencies(): string[] | RegExp {\n const { bundledDependencies = [], dependencies = [] } = this.dependencyList;\n\n // return catch all for when there are no 'bundledDependencies' is very important for secondary entry\n // as if this is not the case everything will be bundled in the secondary entry point\n // since no dependencies are defined.\n if (this.moduleFormat !== 'umd') {\n return /./; // catch all as external\n }\n\n // tslib should always be embeeded for umd modules\n if (bundledDependencies.length === 0) {\n return /^((?!tslib).)*$/;\n }\n\n // filter out dependencies that are meant to be external\n return dependencies.filter(x => bundledDependencies.indexOf(x) < 0);\n }\n}\n"]}
1
+ {"version":3,"file":"external-module-id-strategy.js","sourceRoot":"","sources":["../../../src/lib/flatten/external-module-id-strategy.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAU7B,MAAa,wBAAwB;IACnC,YAAoB,YAAiC,EAAU,cAA8B;QAAzE,iBAAY,GAAZ,YAAY,CAAqB;QAAU,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAEjG,8DAA8D;IAC9D,oBAAoB,CAAC,QAAgB;QACnC,oEAAoE;QACpE,yFAAyF;QACzF,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACrF,yGAAyG;YACzG,OAAO,KAAK,CAAC;SACd;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACnD,IACE,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACtB,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACtE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC7B;YACA,OAAO,KAAK,CAAC;SACd;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,yBAAyB;QACvB,MAAM,EAAE,mBAAmB,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QAE5E,qGAAqG;QACrG,qFAAqF;QACrF,qCAAqC;QACrC,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;YAC/B,OAAO,GAAG,CAAC,CAAC,wBAAwB;SACrC;QAED,kDAAkD;QAClD,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC,EAAE;YACpC,OAAO,iBAAiB,CAAC;SAC1B;QAED,wDAAwD;QACxD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACtE,CAAC;CACF;AA7CD,4DA6CC","sourcesContent":["import * as path from 'path';\nimport * as rollup from 'rollup';\n\nexport interface DependencyList {\n /** Direct dependencies including peerDependencies and other entry points. */\n dependencies?: string[];\n /** Direct bundled dependencies */\n bundledDependencies?: string[];\n}\n\nexport class ExternalModuleIdStrategy {\n constructor(private moduleFormat: rollup.ModuleFormat, private dependencyList: DependencyList) {}\n\n /** Return true when moduleId is to be treated as external */\n isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (path.isAbsolute(moduleId) || moduleId.startsWith('.') || moduleId.startsWith('/')) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n const externals = this.getNonBundledDependencies();\n if (\n Array.isArray(externals)\n ? !externals.some(x => x === moduleId || moduleId.startsWith(`${x}/`))\n : !externals.test(moduleId)\n ) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Returns a array of strings or a RegExp of non-bundled dependencies.\n */\n getNonBundledDependencies(): string[] | RegExp {\n const { bundledDependencies = [], dependencies = [] } = this.dependencyList;\n\n // return catch all for when there are no 'bundledDependencies' is very important for secondary entry\n // as if this is not the case everything will be bundled in the secondary entry point\n // since no dependencies are defined.\n if (this.moduleFormat !== 'umd') {\n return /./; // catch all as external\n }\n\n // tslib should always be embedded for umd modules\n if (bundledDependencies.length === 0) {\n return /^((?!tslib).)*$/;\n }\n\n // filter out dependencies that are meant to be external\n return dependencies.filter(x => bundledDependencies.indexOf(x) < 0);\n }\n}\n"]}
@@ -1 +1 @@
1
- export declare function minifyJsFile(inputPath: string, outputPath?: string): Promise<string>;
1
+ export declare function minifyJsFile(inputPath: string, outputPath?: string): Promise<void>;
@@ -22,7 +22,7 @@ function minifyJsFile(inputPath, outputPath) {
22
22
  fs_extra_1.readFile(inputPath),
23
23
  fs_extra_1.readFile(`${inputPath}.map`),
24
24
  ]);
25
- const result = terser_1.minify(inputFileBuffer.toString(), {
25
+ const result = yield terser_1.minify(inputFileBuffer.toString(), {
26
26
  sourceMap: {
27
27
  includeSources: true,
28
28
  content: JSON.parse(inputSourceMapBuffer.toString()),
@@ -32,21 +32,12 @@ function minifyJsFile(inputPath, outputPath) {
32
32
  ecma: 5,
33
33
  bare_returns: true,
34
34
  },
35
- warnings: false,
36
- output: {
35
+ format: {
37
36
  comments: 'some',
38
37
  },
39
38
  });
40
- if (result.warnings) {
41
- for (const warningMessage of result.warnings) {
42
- log_1.warn(warningMessage);
43
- }
44
- }
45
- if (result.error) {
46
- throw result.error;
47
- }
48
39
  yield Promise.all([fs_extra_1.writeFile(outputPath, result.code), fs_extra_1.writeFile(sourcemapOut, result.map)]);
49
- return outputPath;
40
+ return;
50
41
  });
51
42
  }
52
43
  exports.minifyJsFile = minifyJsFile;
@@ -1 +1 @@
1
- {"version":3,"file":"uglify.js","sourceRoot":"","sources":["../../../src/lib/flatten/uglify.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAgC;AAChC,uCAA+C;AAC/C,+BAAgC;AAChC,sCAA2C;AAE3C,SAAsB,YAAY,CAAC,SAAiB,EAAE,UAAmB;;QACvE,WAAK,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAG,GAAG,UAAU,MAAM,CAAC;QACzC,MAAM,CAAC,eAAe,EAAE,oBAAoB,CAAC,GAAa,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1E,mBAAQ,CAAC,SAAS,CAAC;YACnB,mBAAQ,CAAC,GAAG,SAAS,MAAM,CAAC;SAC7B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,eAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE;YAChD,SAAS,EAAE;gBACT,cAAc,EAAE,IAAI;gBACpB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;gBACpD,GAAG,EAAE,eAAQ,CAAC,YAAY,CAAC;aAC5B;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC;gBACP,YAAY,EAAE,IAAI;aACnB;YACD,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE;gBACN,QAAQ,EAAE,MAAM;aACjB;SACF,CAAC,CAAC;QAEH,IAAI,MAAM,CAAC,QAAQ,EAAE;YACnB,KAAK,MAAM,cAAc,IAAI,MAAM,CAAC,QAAQ,EAAE;gBAC5C,UAAI,CAAC,cAAc,CAAC,CAAC;aACtB;SACF;QAED,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,MAAM,MAAM,CAAC,KAAK,CAAC;SACpB;QAED,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAS,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAS,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,UAAU,CAAC;IACpB,CAAC;CAAA;AArCD,oCAqCC","sourcesContent":["import { minify } from 'terser';\nimport { writeFile, readFile } from 'fs-extra';\nimport { basename } from 'path';\nimport { debug, warn } from '../utils/log';\n\nexport async function minifyJsFile(inputPath: string, outputPath?: string): Promise<string> {\n debug(`minifyJsFile: ${inputPath}`);\n\n const sourcemapOut = `${outputPath}.map`;\n const [inputFileBuffer, inputSourceMapBuffer]: Buffer[] = await Promise.all([\n readFile(inputPath),\n readFile(`${inputPath}.map`),\n ]);\n\n const result = minify(inputFileBuffer.toString(), {\n sourceMap: {\n includeSources: true,\n content: JSON.parse(inputSourceMapBuffer.toString()),\n url: basename(sourcemapOut),\n },\n parse: {\n ecma: 5,\n bare_returns: true,\n },\n warnings: false,\n output: {\n comments: 'some',\n },\n });\n\n if (result.warnings) {\n for (const warningMessage of result.warnings) {\n warn(warningMessage);\n }\n }\n\n if (result.error) {\n throw result.error;\n }\n\n await Promise.all([writeFile(outputPath, result.code), writeFile(sourcemapOut, result.map)]);\n return outputPath;\n}\n"]}
1
+ {"version":3,"file":"uglify.js","sourceRoot":"","sources":["../../../src/lib/flatten/uglify.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAgC;AAChC,uCAA+C;AAC/C,+BAAgC;AAChC,sCAAqC;AAErC,SAAsB,YAAY,CAAC,SAAiB,EAAE,UAAmB;;QACvE,WAAK,CAAC,iBAAiB,SAAS,EAAE,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAG,GAAG,UAAU,MAAM,CAAC;QACzC,MAAM,CAAC,eAAe,EAAE,oBAAoB,CAAC,GAAa,MAAM,OAAO,CAAC,GAAG,CAAC;YAC1E,mBAAQ,CAAC,SAAS,CAAC;YACnB,mBAAQ,CAAC,GAAG,SAAS,MAAM,CAAC;SAC7B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,eAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,EAAE;YACtD,SAAS,EAAE;gBACT,cAAc,EAAE,IAAI;gBACpB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAQ,EAAE,CAAC;gBACpD,GAAG,EAAE,eAAQ,CAAC,YAAY,CAAC;aAC5B;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,CAAC;gBACP,YAAY,EAAE,IAAI;aACnB;YACD,MAAM,EAAE;gBACN,QAAQ,EAAE,MAAM;aACjB;SACF,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,oBAAS,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAS,CAAC,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAE7F,OAAO;IACT,CAAC;CAAA;AA3BD,oCA2BC","sourcesContent":["import { minify } from 'terser';\nimport { writeFile, readFile } from 'fs-extra';\nimport { basename } from 'path';\nimport { debug } from '../utils/log';\n\nexport async function minifyJsFile(inputPath: string, outputPath?: string): Promise<void> {\n debug(`minifyJsFile: ${inputPath}`);\n\n const sourcemapOut = `${outputPath}.map`;\n const [inputFileBuffer, inputSourceMapBuffer]: Buffer[] = await Promise.all([\n readFile(inputPath),\n readFile(`${inputPath}.map`),\n ]);\n\n const result = await minify(inputFileBuffer.toString(), {\n sourceMap: {\n includeSources: true,\n content: JSON.parse(inputSourceMapBuffer.toString()),\n url: basename(sourcemapOut),\n },\n parse: {\n ecma: 5,\n bare_returns: true,\n },\n format: {\n comments: 'some',\n },\n });\n\n await Promise.all([writeFile(outputPath, result.code), writeFile(sourcemapOut, result.map)]);\n\n return;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { MonoTypeOperatorFunction, Observable } from 'rxjs';
2
2
  import { BuildGraph } from './build-graph';
3
3
  /**
4
- * A tranformation applied over the build graph.
4
+ * A transformation applied over the build graph.
5
5
  *
6
6
  * By design, a pipeable operator over `BuildGraph`.
7
7
  * - A transformation takes a `BuildGraph` as input (from previous transformations).
@@ -25,7 +25,7 @@ export interface TransformProvider extends FactoryProvider {
25
25
  * ```ts
26
26
  * const FOO_BAR_TOKEN = new InjectionToken<Transform>('fooBar');
27
27
  *
28
- * const FOO_BAR_TRANSFORM provideTransform({
28
+ * const FOO_BAR_TRANSFORM = provideTransform({
29
29
  * provide: FOO_BAR_TOKEN,
30
30
  * useFactory: (foo, bar) => {
31
31
  * return pipe(foo, bar);
@@ -11,7 +11,7 @@ exports.provideTransform = void 0;
11
11
  * ```ts
12
12
  * const FOO_BAR_TOKEN = new InjectionToken<Transform>('fooBar');
13
13
  *
14
- * const FOO_BAR_TRANSFORM provideTransform({
14
+ * const FOO_BAR_TRANSFORM = provideTransform({
15
15
  * provide: FOO_BAR_TOKEN,
16
16
  * useFactory: (foo, bar) => {
17
17
  * return pipe(foo, bar);
@@ -1 +1 @@
1
- {"version":3,"file":"transform.di.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.di.ts"],"names":[],"mappings":";;;AAoBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,uCACK,MAAM,KACT,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,IACvB;AACJ,CAAC;AALD,4CAKC","sourcesContent":["import { InjectionToken, FactoryProvider } from 'injection-js';\nimport { Transform } from './transform';\n\n/**\n * A specialized `FactoryProvider` for a `Transform`.\n */\nexport interface TransformProvider extends FactoryProvider {\n /**\n * An injection token for the `Transform` provided by this provider.\n */\n provide: InjectionToken<Transform>;\n\n /**\n * A function to invoke to create the `Transform`.\n *\n * The factory function is invoked with resolved values of tokens in the `deps` field.\n */\n useFactory: (...args: any[]) => Transform;\n}\n\n/**\n * Creates a provider for a `Transform`.\n *\n * #### Example\n *\n * Creating a transformation `fooBar` that is composed of `foo` and `bar` transforms:\n *\n * ```ts\n * const FOO_BAR_TOKEN = new InjectionToken<Transform>('fooBar');\n *\n * const FOO_BAR_TRANSFORM provideTransform({\n * provide: FOO_BAR_TOKEN,\n * useFactory: (foo, bar) => {\n * return pipe(foo, bar);\n * },\n * deps: [ FOO_TOKEN, BAR_TOKEN ]\n * });\n * ```\n *\n * @param module The provider for the transform\n * @return A (normalized) provider for the transform\n */\nexport function provideTransform(module: TransformProvider): TransformProvider {\n return {\n ...module,\n deps: module.deps || [],\n };\n}\n"]}
1
+ {"version":3,"file":"transform.di.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.di.ts"],"names":[],"mappings":";;;AAoBA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,uCACK,MAAM,KACT,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE,IACvB;AACJ,CAAC;AALD,4CAKC","sourcesContent":["import { InjectionToken, FactoryProvider } from 'injection-js';\nimport { Transform } from './transform';\n\n/**\n * A specialized `FactoryProvider` for a `Transform`.\n */\nexport interface TransformProvider extends FactoryProvider {\n /**\n * An injection token for the `Transform` provided by this provider.\n */\n provide: InjectionToken<Transform>;\n\n /**\n * A function to invoke to create the `Transform`.\n *\n * The factory function is invoked with resolved values of tokens in the `deps` field.\n */\n useFactory: (...args: any[]) => Transform;\n}\n\n/**\n * Creates a provider for a `Transform`.\n *\n * #### Example\n *\n * Creating a transformation `fooBar` that is composed of `foo` and `bar` transforms:\n *\n * ```ts\n * const FOO_BAR_TOKEN = new InjectionToken<Transform>('fooBar');\n *\n * const FOO_BAR_TRANSFORM = provideTransform({\n * provide: FOO_BAR_TOKEN,\n * useFactory: (foo, bar) => {\n * return pipe(foo, bar);\n * },\n * deps: [ FOO_TOKEN, BAR_TOKEN ]\n * });\n * ```\n *\n * @param module The provider for the transform\n * @return A (normalized) provider for the transform\n */\nexport function provideTransform(module: TransformProvider): TransformProvider {\n return {\n ...module,\n deps: module.deps || [],\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.ts"],"names":[],"mappings":";;;AAAA,+BAA2G;AAC3G,8CAAgD;AAqBnC,QAAA,oBAAoB,GAAG,CAAC,WAAkC,EAAa,EAAE,CACpF,WAAI,CACF,qBAAS,CAAC,KAAK,CAAC,EAAE;IAChB,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE3C,IAAI,eAAe,YAAY,OAAO,EAAE;QACtC,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,eAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpF;SAAM;QACL,OAAO,SAAY,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAChE;AACH,CAAC,CAAC,CACH,CAAC","sourcesContent":["import { MonoTypeOperatorFunction, Observable, from as fromPromise, of as observableOf, pipe } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { BuildGraph } from './build-graph';\n\n/**\n * A tranformation applied over the build graph.\n *\n * By design, a pipeable operator over `BuildGraph`.\n * - A transformation takes a `BuildGraph` as input (from previous transformations).\n * - A transformation performs some operations based on the graph's data, potentially modifying nodes in the graph.\n * - It returns a `BuildGraph` that will be passed to subsequent transformations.\n *\n * @link https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators\n */\nexport interface Transform extends MonoTypeOperatorFunction<BuildGraph> {\n (source$: Observable<BuildGraph>): Observable<BuildGraph>;\n}\n\nexport interface PromiseBasedTransform {\n (graph: BuildGraph): Promise<BuildGraph | void> | BuildGraph | void;\n}\n\nexport const transformFromPromise = (transformFn: PromiseBasedTransform): Transform =>\n pipe(\n switchMap(graph => {\n const transformResult = transformFn(graph);\n\n if (transformResult instanceof Promise) {\n return fromPromise(transformResult).pipe(map(result => (result ? result : graph)));\n } else {\n return observableOf(transformResult ? transformResult : graph);\n }\n }),\n );\n"]}
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.ts"],"names":[],"mappings":";;;AAAA,+BAA2G;AAC3G,8CAAgD;AAqBnC,QAAA,oBAAoB,GAAG,CAAC,WAAkC,EAAa,EAAE,CACpF,WAAI,CACF,qBAAS,CAAC,KAAK,CAAC,EAAE;IAChB,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAE3C,IAAI,eAAe,YAAY,OAAO,EAAE;QACtC,OAAO,WAAW,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,eAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;KACpF;SAAM;QACL,OAAO,SAAY,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KAChE;AACH,CAAC,CAAC,CACH,CAAC","sourcesContent":["import { MonoTypeOperatorFunction, Observable, from as fromPromise, of as observableOf, pipe } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\nimport { BuildGraph } from './build-graph';\n\n/**\n * A transformation applied over the build graph.\n *\n * By design, a pipeable operator over `BuildGraph`.\n * - A transformation takes a `BuildGraph` as input (from previous transformations).\n * - A transformation performs some operations based on the graph's data, potentially modifying nodes in the graph.\n * - It returns a `BuildGraph` that will be passed to subsequent transformations.\n *\n * @link https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators\n */\nexport interface Transform extends MonoTypeOperatorFunction<BuildGraph> {\n (source$: Observable<BuildGraph>): Observable<BuildGraph>;\n}\n\nexport interface PromiseBasedTransform {\n (graph: BuildGraph): Promise<BuildGraph | void> | BuildGraph | void;\n}\n\nexport const transformFromPromise = (transformFn: PromiseBasedTransform): Transform =>\n pipe(\n switchMap(graph => {\n const transformResult = transformFn(graph);\n\n if (transformResult instanceof Promise) {\n return fromPromise(transformResult).pipe(map(result => (result ? result : graph)));\n } else {\n return observableOf(transformResult ? transformResult : graph);\n }\n }),\n );\n"]}
@@ -47,6 +47,9 @@ function resolveUserPackage(folderPathOrFilePath, isSecondary = false) {
47
47
  if (!packageJson && !isSecondary) {
48
48
  throw new Error(`Cannot discover package sources at ${folderPathOrFilePath} as 'package.json' was not found.`);
49
49
  }
50
+ if (packageJson && typeof packageJson !== 'object') {
51
+ throw new Error(`Invalid 'package.json' at ${folderPathOrFilePath}.`);
52
+ }
50
53
  let ngPackageJson;
51
54
  if (packageJson && packageJson['ngPackage']) {
52
55
  // Read `ngPackage` from `package.json`
@@ -65,8 +68,19 @@ function resolveUserPackage(folderPathOrFilePath, isSecondary = false) {
65
68
  const _ajv = ajv({
66
69
  schemaId: 'auto',
67
70
  useDefaults: true,
71
+ jsonPointers: true,
68
72
  });
69
73
  const validate = _ajv.compile(ngPackageSchemaJson);
74
+ // Add handler for x-deprecated fields
75
+ _ajv.addKeyword('x-deprecated', {
76
+ validate: (schema, _data, _parentSchema, _dataPath, _parentDataObject, propertyName) => {
77
+ if (schema) {
78
+ log.warn(`Option "${propertyName}" is deprecated${typeof schema == 'string' ? ': ' + schema : '.'}`);
79
+ }
80
+ return true;
81
+ },
82
+ errors: false,
83
+ });
70
84
  const isValid = validate(ngPackageJson);
71
85
  if (!isValid) {
72
86
  throw new Error(`Configuration doesn\'t match the required schema.\n${formatSchemaValidationErrors(validate.errors)}`);
@@ -74,7 +88,7 @@ function resolveUserPackage(folderPathOrFilePath, isSecondary = false) {
74
88
  return {
75
89
  basePath,
76
90
  packageJson: packageJson || {},
77
- ngPackageJson,
91
+ ngPackageJson: ngPackageJson,
78
92
  };
79
93
  }
80
94
  if (pathStats.isDirectory()) {
@@ -117,15 +131,16 @@ function findSecondaryPackagesPaths(directoryPath, excludeFolder) {
117
131
  /**
118
132
  * Reads a secondary entry point from it's package file.
119
133
  *
120
- * @param primaryDirectoryPath A path pointing to the directory of the primary entry point.
121
134
  * @param primary The primary entry point.
135
+ * @param userPackage The user package for the secondary entry point.
122
136
  */
123
- function secondaryEntryPoint(primaryDirectoryPath, primary, { packageJson, ngPackageJson, basePath }) {
124
- if (path.resolve(basePath) === path.resolve(primaryDirectoryPath)) {
137
+ function secondaryEntryPoint(primary, userPackage) {
138
+ const { packageJson, ngPackageJson, basePath } = userPackage;
139
+ if (path.resolve(basePath) === path.resolve(primary.basePath)) {
125
140
  log.error(`Cannot read secondary entry point. It's already a primary entry point. Path: ${basePath}`);
126
141
  throw new Error(`Secondary entry point is already a primary.`);
127
142
  }
128
- const relativeSourcePath = path.relative(primaryDirectoryPath, basePath);
143
+ const relativeSourcePath = path.relative(primary.basePath, basePath);
129
144
  const secondaryModuleId = path_1.ensureUnixPath(`${primary.moduleId}/${relativeSourcePath}`);
130
145
  return new entry_point_1.NgEntryPoint(packageJson, ngPackageJson, basePath, {
131
146
  moduleId: secondaryModuleId,
@@ -144,7 +159,7 @@ function discoverPackages({ project }) {
144
159
  for (const folderPath of folderPaths) {
145
160
  const secondaryPackage = yield resolveUserPackage(folderPath, true);
146
161
  if (secondaryPackage) {
147
- secondaries.push(secondaryEntryPoint(basePath, primary, secondaryPackage));
162
+ secondaries.push(secondaryEntryPoint(primary, secondaryPackage));
148
163
  }
149
164
  }
150
165
  if (secondaries.length > 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/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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;SAC3F;QAED,OAAO,IAAI,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;CAAA;AAtBD,4CAsBC","sourcesContent":["import * as ajv from 'ajv';\nimport { pathExistsSync, lstat } from 'fs-extra';\nimport * as path from 'path';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\nimport { NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\nimport { globFiles } from '../utils/glob';\n\nconst ngPackageSchemaJson = require('../../ng-package.schema.json');\n\ninterface UserPackage {\n packageJson: object;\n ngPackageJson: object;\n basePath: string;\n}\n\nfunction formatSchemaValidationErrors(errors: ajv.ErrorObject[]): string {\n return errors\n .map(err => {\n let message = `Data path ${JSON.stringify(err.dataPath)} ${err.message}`;\n if (err.keyword === 'additionalProperties') {\n message += ` (${(err.params as any).additionalProperty})`;\n }\n\n return message + '.';\n })\n .join('\\n');\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 * @param isSecondary A boolean determining if this is a secondary package\n * @return The user's package\n */\nasync function resolveUserPackage(folderPathOrFilePath: string, isSecondary = false): 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 if (!packageJson && !isSecondary) {\n throw new Error(`Cannot discover package sources at ${folderPathOrFilePath} as 'package.json' was not found.`);\n }\n\n let ngPackageJson: undefined | object;\n if (packageJson && 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 const _ajv = ajv({\n schemaId: 'auto',\n useDefaults: true,\n });\n\n const validate = _ajv.compile(ngPackageSchemaJson);\n const isValid = validate(ngPackageJson);\n if (!isValid) {\n throw new Error(\n `Configuration doesn\\'t match the required schema.\\n${formatSchemaValidationErrors(validate.errors)}`,\n );\n }\n\n return {\n basePath,\n packageJson: 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/**\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 */\nasync function findSecondaryPackagesPaths(directoryPath: string, excludeFolder: string): Promise<string[]> {\n const ignore = [\n '**/node_modules/**',\n '**/.git/**',\n `${path.resolve(directoryPath, excludeFolder)}/**`,\n `${directoryPath}/package.json`,\n `${directoryPath}/ng-package.json`,\n ];\n\n const filePaths = await globFiles(`${directoryPath}/**/{package,ng-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 */\nfunction 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, basePath, {\n moduleId: secondaryModuleId,\n primaryDestinationPath: primary.destinationPath,\n destinationPath: path.join(primary.destinationPath, relativeSourcePath),\n });\n}\n\nexport async function discoverPackages({ project }: { project: string }): Promise<NgPackage> {\n project = path.isAbsolute(project) ? project : path.resolve(project);\n\n const { packageJson, ngPackageJson, basePath } = await resolveUserPackage(project);\n const primary = new NgEntryPoint(packageJson, ngPackageJson, basePath);\n log.debug(`Found primary entry point: ${primary.moduleId}`);\n\n const folderPaths = await findSecondaryPackagesPaths(basePath, primary.$get('dest'));\n const secondaries: NgEntryPoint[] = [];\n\n for (const folderPath of folderPaths) {\n const secondaryPackage = await resolveUserPackage(folderPath, true);\n if (secondaryPackage) {\n secondaries.push(secondaryEntryPoint(basePath, primary, secondaryPackage));\n }\n }\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(basePath, primary, secondaries);\n}\n"]}
1
+ {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/ng-package/discover-packages.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2BAA2B;AAC3B,uCAAiD;AACjD,6BAA6B;AAC7B,oCAAoC;AACpC,wCAA+C;AAC/C,2DAAyD;AACzD,uCAAsC;AACtC,wCAA0C;AAE1C,MAAM,mBA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E5D,MAAM,WAAW,GAAG,MAAM,0BAA0B,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACrF,MAAM,WAAW,GAAmB,EAAE,CAAC;QAEvC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,MAAM,gBAAgB,GAAG,MAAM,kBAAkB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACpE,IAAI,gBAAgB,EAAE;gBACpB,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;aAClE;SACF;QAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,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;SAC3F;QAED,OAAO,IAAI,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;CAAA;AAtBD,4CAsBC","sourcesContent":["import * as ajv from 'ajv';\nimport { pathExistsSync, lstat } from 'fs-extra';\nimport * as path from 'path';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\nimport { NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\nimport { globFiles } from '../utils/glob';\n\nconst ngPackageSchemaJson = require('../../ng-package.schema.json');\n\ninterface UserPackage {\n /** Values from the `package.json` file of this user package. */\n packageJson: Record<string, any>;\n /** NgPackageConfig for this user package. */\n ngPackageJson: Record<string, any>;\n /** Absolute directory path of this user package. */\n basePath: string;\n}\n\nfunction formatSchemaValidationErrors(errors: ajv.ErrorObject[]): string {\n return errors\n .map(err => {\n let message = `Data path ${JSON.stringify(err.dataPath)} ${err.message}`;\n if (err.keyword === 'additionalProperties') {\n message += ` (${(err.params as any).additionalProperty})`;\n }\n\n return message + '.';\n })\n .join('\\n');\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 * @param isSecondary A boolean determining if this is a secondary package\n * @return The user's package\n */\nasync function resolveUserPackage(folderPathOrFilePath: string, isSecondary = false): 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: unknown = await readConfigFile(path.join(basePath, 'package.json'));\n\n if (!packageJson && !isSecondary) {\n throw new Error(`Cannot discover package sources at ${folderPathOrFilePath} as 'package.json' was not found.`);\n }\n\n if (packageJson && typeof packageJson !== 'object') {\n throw new Error(`Invalid 'package.json' at ${folderPathOrFilePath}.`);\n }\n\n let ngPackageJson: unknown;\n if (packageJson && 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 const _ajv = ajv({\n schemaId: 'auto',\n useDefaults: true,\n jsonPointers: true,\n });\n\n const validate = _ajv.compile(ngPackageSchemaJson);\n // Add handler for x-deprecated fields\n _ajv.addKeyword('x-deprecated', {\n validate: (schema, _data, _parentSchema, _dataPath, _parentDataObject, propertyName) => {\n if (schema) {\n log.warn(`Option \"${propertyName}\" is deprecated${typeof schema == 'string' ? ': ' + schema : '.'}`);\n }\n\n return true;\n },\n errors: false,\n });\n\n const isValid = validate(ngPackageJson);\n if (!isValid) {\n throw new Error(\n `Configuration doesn\\'t match the required schema.\\n${formatSchemaValidationErrors(validate.errors)}`,\n );\n }\n\n return {\n basePath,\n packageJson: packageJson || {},\n ngPackageJson: ngPackageJson as Record<string, any>,\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/**\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 */\nasync function findSecondaryPackagesPaths(directoryPath: string, excludeFolder: string): Promise<string[]> {\n const ignore = [\n '**/node_modules/**',\n '**/.git/**',\n `${path.resolve(directoryPath, excludeFolder)}/**`,\n `${directoryPath}/package.json`,\n `${directoryPath}/ng-package.json`,\n ];\n\n const filePaths = await globFiles(`${directoryPath}/**/{package,ng-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 primary The primary entry point.\n * @param userPackage The user package for the secondary entry point.\n */\nfunction secondaryEntryPoint(primary: NgEntryPoint, userPackage: UserPackage): NgEntryPoint {\n const { packageJson, ngPackageJson, basePath } = userPackage;\n if (path.resolve(basePath) === path.resolve(primary.basePath)) {\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(primary.basePath, basePath);\n const secondaryModuleId = ensureUnixPath(`${primary.moduleId}/${relativeSourcePath}`);\n\n return new NgEntryPoint(packageJson, ngPackageJson, basePath, {\n moduleId: secondaryModuleId,\n primaryDestinationPath: primary.destinationPath,\n destinationPath: path.join(primary.destinationPath, relativeSourcePath),\n });\n}\n\nexport async function discoverPackages({ project }: { project: string }): Promise<NgPackage> {\n project = path.isAbsolute(project) ? project : path.resolve(project);\n\n const { packageJson, ngPackageJson, basePath } = await resolveUserPackage(project);\n const primary = new NgEntryPoint(packageJson, ngPackageJson, basePath);\n log.debug(`Found primary entry point: ${primary.moduleId}`);\n\n const folderPaths = await findSecondaryPackagesPaths(basePath, primary.$get('dest'));\n const secondaries: NgEntryPoint[] = [];\n\n for (const folderPath of folderPaths) {\n const secondaryPackage = await resolveUserPackage(folderPath, true);\n if (secondaryPackage) {\n secondaries.push(secondaryEntryPoint(primary, secondaryPackage));\n }\n }\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(basePath, primary, secondaries);\n}\n"]}
@@ -12,7 +12,7 @@ export interface DestinationFiles {
12
12
  esm2015: string;
13
13
  /** Absolute path of this entry point `UMD` bundle */
14
14
  umd: string;
15
- /** Absolute path of this entry point `UMD` Minifief bundle */
15
+ /** Absolute path of this entry point `UMD` minified bundle */
16
16
  umdMinified: string;
17
17
  }
18
18
  /**
@@ -46,21 +46,21 @@ export interface DestinationFiles {
46
46
  */
47
47
  export declare class NgEntryPoint {
48
48
  /** Values from the `package.json` file of this entry point. */
49
- readonly packageJson: any;
49
+ readonly packageJson: Record<string, any>;
50
50
  /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */
51
51
  readonly ngPackageJson: NgPackageConfig;
52
52
  /** Absolute directory path of this entry point's `package.json` location. */
53
53
  readonly basePath: string;
54
- /** XX: additional auto-configured data passed for scondary entry point's. Needs better docs. */
54
+ /** XX: additional auto-configured data passed for secondary entry point's. Needs better docs. */
55
55
  private readonly secondaryData?;
56
56
  constructor(
57
57
  /** Values from the `package.json` file of this entry point. */
58
- packageJson: any,
58
+ packageJson: Record<string, any>,
59
59
  /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */
60
60
  ngPackageJson: NgPackageConfig,
61
61
  /** Absolute directory path of this entry point's `package.json` location. */
62
62
  basePath: string,
63
- /** XX: additional auto-configured data passed for scondary entry point's. Needs better docs. */
63
+ /** XX: additional auto-configured data passed for secondary entry point's. Needs better docs. */
64
64
  secondaryData?: {
65
65
  [key: string]: any;
66
66
  });
@@ -39,7 +39,7 @@ class NgEntryPoint {
39
39
  ngPackageJson,
40
40
  /** Absolute directory path of this entry point's `package.json` location. */
41
41
  basePath,
42
- /** XX: additional auto-configured data passed for scondary entry point's. Needs better docs. */
42
+ /** XX: additional auto-configured data passed for secondary entry point's. Needs better docs. */
43
43
  secondaryData) {
44
44
  this.packageJson = packageJson;
45
45
  this.ngPackageJson = ngPackageJson;
@@ -1 +1 @@
1
- {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/entry-point.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAoB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,YAAY;IACvB;IACE,+DAA+D;IAC/C,WAAgB;IAChC,wGAAwG;IACxF,aAA8B;IAC9C,6EAA6E;IAC7D,QAAgB;IAChC,gGAAgG;IAC/E,aAAsC;QANvC,gBAAW,GAAX,WAAW,CAAK;QAEhB,kBAAa,GAAb,aAAa,CAAiB;QAE9B,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;IAED,oEAAoE;IACpE,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,a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G;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,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC9D;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;AA1ID,oCA0IC","sourcesContent":["import * as path from 'path';\nimport { NgPackageConfig } from '../../../ng-package.schema';\nimport { CssUrl } from '../../styles/stylesheet-processor';\n\n/** A list of output absolute paths for various formats */\nexport interface DestinationFiles {\n /** Absolute path of this entry point `declarations` */\n declarations: string;\n /** Absolute path of this entry point `metadata` */\n metadata: string;\n /** Absolute path of this entry point `FESM2015` module */\n fesm2015: string;\n /** Absolute path of this entry point `ESM2015` module */\n esm2015: string;\n /** Absolute path of this entry point `UMD` bundle */\n umd: string;\n /** Absolute path of this entry point `UMD` Minifief bundle */\n umdMinified: string;\n}\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 /** 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(): string {\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(): string {\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 fesm2015: pathJoinWithDest('fesm2015', `${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 const parts = key.split('.');\n let value = this.ngPackageJson as unknown;\n for (const key of parts) {\n if (typeof value === 'object' && value.hasOwnProperty(key)) {\n value = value[key];\n } else {\n return undefined;\n }\n }\n\n return value;\n }\n\n public get entryFile(): string {\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 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((includePath) =>\n path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath),\n );\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.substring(1).split('/').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/entry-point/entry-point.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAoB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,YAAY;IACvB;IACE,+DAA+D;IAC/C,WAAgC;IAChD,wGAAwG;IACxF,aAA8B;IAC9C,6EAA6E;IAC7D,QAAgB;IAChC,iGAAiG;IAChF,aAAsC;QANvC,gBAAW,GAAX,WAAW,CAAqB;QAEhC,kBAAa,GAAb,aAAa,CAAiB;QAE9B,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;IAED,oEAAoE;IACpE,IAAW,eAAe;QACxB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,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,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,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC9D;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;AA1ID,oCA0IC","sourcesContent":["import * as path from 'path';\nimport { NgPackageConfig } from '../../../ng-package.schema';\nimport { CssUrl } from '../../styles/stylesheet-processor';\n\n/** A list of output absolute paths for various formats */\nexport interface DestinationFiles {\n /** Absolute path of this entry point `declarations` */\n declarations: string;\n /** Absolute path of this entry point `metadata` */\n metadata: string;\n /** Absolute path of this entry point `FESM2015` module */\n fesm2015: string;\n /** Absolute path of this entry point `ESM2015` module */\n esm2015: string;\n /** Absolute path of this entry point `UMD` bundle */\n umd: string;\n /** Absolute path of this entry point `UMD` minified bundle */\n umdMinified: string;\n}\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: Record<string, any>,\n /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */\n public readonly ngPackageJson: 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 secondary 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(): string {\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(): string {\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 fesm2015: pathJoinWithDest('fesm2015', `${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 const parts = key.split('.');\n let value = this.ngPackageJson as unknown;\n for (const key of parts) {\n if (typeof value === 'object' && value.hasOwnProperty(key)) {\n value = value[key];\n } else {\n return undefined;\n }\n }\n\n return value;\n }\n\n public get entryFile(): string {\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 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((includePath) =>\n path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath),\n );\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.substring(1).split('/').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"]}
@@ -23,7 +23,7 @@ import { Transform } from '../../graph/transform';
23
23
  * Sub-transformations are passed to this factory function as arguments.
24
24
  *
25
25
  * @param compileTs Transformation compiling typescript sources to ES2015 modules.
26
- * @param writeBundles Transformation flattening ES2015 modules to ESM2015, ESM5, UMD, and minified UMD.
26
+ * @param writeBundles Transformation flattening ES2015 modules to ESM2015, UMD, and minified UMD.
27
27
  * @param writePackage Transformation writing a distribution-ready `package.json` (for publishing to npm registry).
28
28
  */
29
29
  export declare const entryPointTransformFactory: (compileTs: Transform, writeBundles: Transform, writePackage: Transform) => Transform;
@@ -40,7 +40,7 @@ const nodes_1 = require("../nodes");
40
40
  * Sub-transformations are passed to this factory function as arguments.
41
41
  *
42
42
  * @param compileTs Transformation compiling typescript sources to ES2015 modules.
43
- * @param writeBundles Transformation flattening ES2015 modules to ESM2015, ESM5, UMD, and minified UMD.
43
+ * @param writeBundles Transformation flattening ES2015 modules to ESM2015, UMD, and minified UMD.
44
44
  * @param writePackage Transformation writing a distribution-ready `package.json` (for publishing to npm registry).
45
45
  */
46
46
  exports.entryPointTransformFactory = (compileTs, writeBundles, writePackage) => rxjs_1.pipe(
@@ -1 +1 @@
1
- {"version":3,"file":"entry-point.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/entry-point.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA4B;AAC5B,2CAA8C;AAC9C,+CAAkD;AAClD,qDAAwE;AACxE,uCAAuC;AACvC,oCAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,0BAA0B,GAAG,CACxC,SAAoB,EACpB,YAAuB,EACvB,YAAuB,EACZ,EAAE,CACb,WAAI;AACF,+DAA+D;AAE/D,gCAAoB,CAAC,CAAO,KAAK,EAAE,EAAE;IACnC,4CAA4C;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,CAAC;IAChE,GAAG,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;IAC5F,GAAG,CAAC,GAAG,CAAC,yBAAyB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzE,GAAG,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;AAC5F,CAAC,CAAA,CAAC;AACF,iCAAiC;AACjC,SAAS;AACT,+CAA+C;AAC/C,YAAY,EACZ,YAAY,EACZ,gCAAoB,CAAC,CAAO,KAAK,EAAE,EAAE;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,CAAC;IAChE,UAAU,CAAC,KAAK,GAAG,iBAAU,CAAC;AAChC,CAAC,CAAA,CAAC,CAGH,CAAC","sourcesContent":["import { pipe } from 'rxjs';\nimport { STATE_DONE } from '../../graph/node';\nimport { isInProgress } from '../../graph/select';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport * as log from '../../utils/log';\nimport { byEntryPoint } from '../nodes';\n\n/**\n * A re-write of the `transformSources()` script that transforms an entry point from sources to distributable format.\n *\n * Sources are TypeScript source files accompanied by HTML templates and xCSS stylesheets.\n * See the Angular Package Format for a detailed description of what the distributables include.\n *\n * The current transformation pipeline can be thought of as:\n *\n * - clean\n * - compileTs\n * - downlevelTs\n * - writeBundles\n * - bundleToFesm15\n * - bundleToUmd\n * - bundleToUmdMin\n * - relocateSourceMaps\n * - writePackage\n * - copyStagedFiles (bundles, esm, dts, metadata, sourcemaps)\n * - writePackageJson\n *\n * The transformation pipeline is pluggable through the dependency injection system.\n * Sub-transformations are passed to this factory function as arguments.\n *\n * @param compileTs Transformation compiling typescript sources to ES2015 modules.\n * @param writeBundles Transformation flattening ES2015 modules to ESM2015, ESM5, UMD, and minified UMD.\n * @param writePackage Transformation writing a distribution-ready `package.json` (for publishing to npm registry).\n */\nexport const entryPointTransformFactory = (\n compileTs: Transform,\n writeBundles: Transform,\n writePackage: Transform,\n): Transform =>\n pipe(\n //tap(() => log.info(`Building from sources for entry point`)),\n\n transformFromPromise(async (graph) => {\n // Peek the first entry point from the graph\n const entryPoint = graph.find(byEntryPoint().and(isInProgress));\n log.msg('\\n------------------------------------------------------------------------------');\n log.msg(`Building entry point '${entryPoint.data.entryPoint.moduleId}'`);\n log.msg('------------------------------------------------------------------------------');\n }),\n // TypeScript sources compilation\n compileTs,\n // After TypeScript: bundling and write package\n writeBundles,\n writePackage,\n transformFromPromise(async (graph) => {\n const entryPoint = graph.find(byEntryPoint().and(isInProgress));\n entryPoint.state = STATE_DONE;\n }),\n\n //tap(() => log.info(`Built.`))\n );\n"]}
1
+ {"version":3,"file":"entry-point.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/entry-point.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA4B;AAC5B,2CAA8C;AAC9C,+CAAkD;AAClD,qDAAwE;AACxE,uCAAuC;AACvC,oCAAwC;AAExC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,0BAA0B,GAAG,CACxC,SAAoB,EACpB,YAAuB,EACvB,YAAuB,EACZ,EAAE,CACb,WAAI;AACF,+DAA+D;AAE/D,gCAAoB,CAAC,CAAO,KAAK,EAAE,EAAE;IACnC,4CAA4C;IAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,CAAC;IAChE,GAAG,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;IAC5F,GAAG,CAAC,GAAG,CAAC,yBAAyB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzE,GAAG,CAAC,GAAG,CAAC,gFAAgF,CAAC,CAAC;AAC5F,CAAC,CAAA,CAAC;AACF,iCAAiC;AACjC,SAAS;AACT,+CAA+C;AAC/C,YAAY,EACZ,YAAY,EACZ,gCAAoB,CAAC,CAAO,KAAK,EAAE,EAAE;IACnC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,oBAAY,EAAE,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC,CAAC;IAChE,UAAU,CAAC,KAAK,GAAG,iBAAU,CAAC;AAChC,CAAC,CAAA,CAAC,CAGH,CAAC","sourcesContent":["import { pipe } from 'rxjs';\nimport { STATE_DONE } from '../../graph/node';\nimport { isInProgress } from '../../graph/select';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport * as log from '../../utils/log';\nimport { byEntryPoint } from '../nodes';\n\n/**\n * A re-write of the `transformSources()` script that transforms an entry point from sources to distributable format.\n *\n * Sources are TypeScript source files accompanied by HTML templates and xCSS stylesheets.\n * See the Angular Package Format for a detailed description of what the distributables include.\n *\n * The current transformation pipeline can be thought of as:\n *\n * - clean\n * - compileTs\n * - downlevelTs\n * - writeBundles\n * - bundleToFesm15\n * - bundleToUmd\n * - bundleToUmdMin\n * - relocateSourceMaps\n * - writePackage\n * - copyStagedFiles (bundles, esm, dts, metadata, sourcemaps)\n * - writePackageJson\n *\n * The transformation pipeline is pluggable through the dependency injection system.\n * Sub-transformations are passed to this factory function as arguments.\n *\n * @param compileTs Transformation compiling typescript sources to ES2015 modules.\n * @param writeBundles Transformation flattening ES2015 modules to ESM2015, UMD, and minified UMD.\n * @param writePackage Transformation writing a distribution-ready `package.json` (for publishing to npm registry).\n */\nexport const entryPointTransformFactory = (\n compileTs: Transform,\n writeBundles: Transform,\n writePackage: Transform,\n): Transform =>\n pipe(\n //tap(() => log.info(`Building from sources for entry point`)),\n\n transformFromPromise(async (graph) => {\n // Peek the first entry point from the graph\n const entryPoint = graph.find(byEntryPoint().and(isInProgress));\n log.msg('\\n------------------------------------------------------------------------------');\n log.msg(`Building entry point '${entryPoint.data.entryPoint.moduleId}'`);\n log.msg('------------------------------------------------------------------------------');\n }),\n // TypeScript sources compilation\n compileTs,\n // After TypeScript: bundling and write package\n writeBundles,\n writePackage,\n transformFromPromise(async (graph) => {\n const entryPoint = graph.find(byEntryPoint().and(isInProgress));\n entryPoint.state = STATE_DONE;\n }),\n\n //tap(() => log.info(`Built.`))\n );\n"]}
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.initTsConfigTransformFactory = void 0;
13
- const chalk = require("chalk");
13
+ const color_1 = require("../../utils/color");
14
14
  const transform_1 = require("../../graph/transform");
15
15
  const nodes_1 = require("../nodes");
16
16
  const tsconfig_1 = require("../../ts/tsconfig");
@@ -24,7 +24,7 @@ exports.initTsConfigTransformFactory = (defaultTsConfig) => transform_1.transfor
24
24
  'It is not recommended to publish Ivy libraries to NPM repositories.\n' +
25
25
  'Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility\n' +
26
26
  '******************************************************************************';
27
- log_1.msg(chalk.yellow(ivyMsg));
27
+ log_1.msg(color_1.colors.yellow(ivyMsg));
28
28
  }
29
29
  return graph;
30
30
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,+BAA+B;AAC/B,qDAAwE;AACxE,oCAAwD;AACxD,gDAAuD;AACvD,yCAAsC;AAEzB,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;IAEjD,IAAI,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE;QACrC,MAAM,MAAM,GACV,kFAAkF;YAClF,uEAAuE;YACvE,qFAAqF;YACrF,gFAAgF,CAAC;QAEnF,SAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KAC3B;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import { ParsedConfiguration } from '@angular/compiler-cli';\nimport * as chalk from 'chalk';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { initializeTsConfig } from '../../ts/tsconfig';\nimport { msg } from '../../utils/log';\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\n if (defaultTsConfig.options.enableIvy) {\n const ivyMsg =\n '******************************************************************************\\n' +\n 'It is not recommended to publish Ivy libraries to NPM repositories.\\n' +\n 'Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility\\n' +\n '******************************************************************************';\n\n msg(chalk.yellow(ivyMsg));\n }\n\n return graph;\n });\n"]}
1
+ {"version":3,"file":"init-tsconfig.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/init-tsconfig.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,6CAA2C;AAC3C,qDAAwE;AACxE,oCAAwD;AACxD,gDAAuD;AACvD,yCAAsC;AAEzB,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;IAEjD,IAAI,eAAe,CAAC,OAAO,CAAC,SAAS,EAAE;QACrC,MAAM,MAAM,GACV,kFAAkF;YAClF,uEAAuE;YACvE,qFAAqF;YACrF,gFAAgF,CAAC;QAEnF,SAAG,CAAC,cAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAA,CAAC,CAAC","sourcesContent":["import { ParsedConfiguration } from '@angular/compiler-cli';\nimport { colors } from '../../utils/color';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { isEntryPoint, EntryPointNode } from '../nodes';\nimport { initializeTsConfig } from '../../ts/tsconfig';\nimport { msg } from '../../utils/log';\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\n if (defaultTsConfig.options.enableIvy) {\n const ivyMsg =\n '******************************************************************************\\n' +\n 'It is not recommended to publish Ivy libraries to NPM repositories.\\n' +\n 'Read more here: https://v9.angular.io/guide/ivy#maintaining-library-compatibility\\n' +\n '******************************************************************************';\n\n msg(colors.yellow(ivyMsg));\n }\n\n return graph;\n });\n"]}
@@ -46,7 +46,7 @@ exports.writeBundlesTransform = transform_1.transformFromPromise((graph) => __aw
46
46
  }));
47
47
  /** Get all list of dependencies for the entire 'BuildGraph' */
48
48
  function getDependencyListForGraph(graph) {
49
- // We need to do this because if A dependecy on bundled B
49
+ // We need to do this because if A dependency on bundled B
50
50
  // And A has a secondary entry point A/1 we want only to bundle B if it's used.
51
51
  // Also if A/1 depends on A we don't want to bundle A thus we mark this a dependency.
52
52
  const dependencyList = {
@@ -61,7 +61,7 @@ function getDependencyListForGraph(graph) {
61
61
  if (dependencyList.bundledDependencies.length) {
62
62
  log.warn(`Inlining of 'bundledDependencies' has been deprecated in version 5 and will be removed in future versions.` +
63
63
  '\n' +
64
- `List the depedency in the 'peerDependencies' section instead.`);
64
+ `List the dependency in the 'peerDependencies' section instead.`);
65
65
  }
66
66
  return dependencyList;
67
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwE;AAExE,oCAAgF;AAChF,uCAAuC;AAGvC,6CAA2C;AAC3C,qEAAsE;AACtE,iDAAwD;AACxD,iDAAoD;AAEvC,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAmB,CAAC;IAC1E,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAE/B,sCAAsC;IACtC,MAAM,gBAAgB,GAAG,UAAU;SAChC,MAAM,CAAC,oBAAY,CAAC;SACpB,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;SAC7B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAgB,EAAE,EAAE;QACjC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;QAE7B,OAAO,IAAI,CAAC;IACd,CA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C;IAEF,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,EAAE;QAC9C,MAAM,EAAE,mBAAmB,GAAG,EAAE,EAAE,YAAY,GAAG,EAAE,EAAE,gBAAgB,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;QACjH,cAAc,CAAC,mBAAmB,GAAG,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;KACH;IAED,IAAI,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE;QAC7C,GAAG,CAAC,IAAI,CACN,4GAA4G;YAC1G,IAAI;YACJ,+DAA+D,CAClE,CAAC;KACH;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { Transform, transformFromPromise } from '../../graph/transform';\nimport { NgEntryPoint } from './entry-point';\nimport { isEntryPoint, isEntryPointInProgress, EntryPointNode } from '../nodes';\nimport * as log from '../../utils/log';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { DependencyList } from '../../flatten/external-module-id-strategy';\nimport { unique } from '../../utils/array';\nimport { downlevelCodeWithTsc } from '../../flatten/downlevel-plugin';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { minifyJsFile } from '../../flatten/uglify';\n\nexport const writeBundlesTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\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 { fesm2015, esm2015, umd, umdMinified } = destinationFiles;\n\n const opts = {\n sourceRoot: tsConfig.options.sourceRoot,\n amd: { id: ngEntryPoint.amdId },\n umdModuleIds: {\n ...ngEntryPoint.umdModuleIds,\n ...dependencyUmdIds,\n },\n entry: esm2015,\n dependencyList: getDependencyListForGraph(graph),\n };\n\n log.info('Bundling to FESM2015');\n cache.rollupFESMCache = await rollupBundleFile({\n ...opts,\n moduleName: ngEntryPoint.moduleId,\n format: 'es',\n dest: fesm2015,\n cache: cache.rollupFESMCache,\n });\n\n log.info('Bundling to UMD');\n cache.rollupUMDCache = await rollupBundleFile({\n ...opts,\n moduleName: ngEntryPoint.umdId,\n entry: esm2015,\n format: 'umd',\n dest: umd,\n cache: cache.rollupUMDCache,\n transform: downlevelCodeWithTsc,\n });\n\n log.info('Minifying UMD bundle');\n await minifyJsFile(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 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 if (dependencyList.bundledDependencies.length) {\n log.warn(\n `Inlining of 'bundledDependencies' has been deprecated in version 5 and will be removed in future versions.` +\n '\\n' +\n `List the depedency in the 'peerDependencies' section instead.`,\n );\n }\n\n return dependencyList;\n}\n"]}
1
+ {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAwE;AAExE,oCAAgF;AAChF,uCAAuC;AAGvC,6CAA2C;AAC3C,qEAAsE;AACtE,iDAAwD;AACxD,iDAAoD;AAEvC,QAAA,qBAAqB,GAAc,gCAAoB,CAAC,CAAM,KAAK,EAAC,EAAE;IACjF,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,8BAAsB,EAAE,CAAmB,CAAC;IAC1E,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAE/B,sCAAsC;IACtC,MAAM,gBAAgB,GAAG,UAAU;SAChC,MAAM,CAAC,oBAAY,CAAC;SACpB,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;SAC7B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAgB,EAAE,EAAE;QACjC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;QAE7B,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;IAET,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,gBAAgB,CAAC;IAEjE,MAAM,IAAI,GAAG;QACX,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;QACvC,GAAG,EAAE,EAAE,EAAE,EAAE,YAAY,CAAC,KAAK,EAAE;QAC/B,YAAY,kCACP,YAAY,CAAC,YAAY,GACzB,gBAAgB,CACpB;QACD,KAAK,EAAE,OAAO;QAC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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;KACH;IAED,IAAI,cAAc,CAAC,mBAAmB,CAAC,MAAM,EAAE;QAC7C,GAAG,CAAC,IAAI,CACN,4GAA4G;YAC1G,IAAI;YACJ,gEAAgE,CACnE,CAAC;KACH;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { Transform, transformFromPromise } from '../../graph/transform';\nimport { NgEntryPoint } from './entry-point';\nimport { isEntryPoint, isEntryPointInProgress, EntryPointNode } from '../nodes';\nimport * as log from '../../utils/log';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { DependencyList } from '../../flatten/external-module-id-strategy';\nimport { unique } from '../../utils/array';\nimport { downlevelCodeWithTsc } from '../../flatten/downlevel-plugin';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { minifyJsFile } from '../../flatten/uglify';\n\nexport const writeBundlesTransform: Transform = transformFromPromise(async graph => {\n const entryPoint = graph.find(isEntryPointInProgress()) as EntryPointNode;\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\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 { fesm2015, esm2015, umd, umdMinified } = destinationFiles;\n\n const opts = {\n sourceRoot: tsConfig.options.sourceRoot,\n amd: { id: ngEntryPoint.amdId },\n umdModuleIds: {\n ...ngEntryPoint.umdModuleIds,\n ...dependencyUmdIds,\n },\n entry: esm2015,\n dependencyList: getDependencyListForGraph(graph),\n };\n\n log.info('Bundling to FESM2015');\n cache.rollupFESMCache = await rollupBundleFile({\n ...opts,\n moduleName: ngEntryPoint.moduleId,\n format: 'es',\n dest: fesm2015,\n cache: cache.rollupFESMCache,\n });\n\n log.info('Bundling to UMD');\n cache.rollupUMDCache = await rollupBundleFile({\n ...opts,\n moduleName: ngEntryPoint.umdId,\n entry: esm2015,\n format: 'umd',\n dest: umd,\n cache: cache.rollupUMDCache,\n transform: downlevelCodeWithTsc,\n });\n\n log.info('Minifying UMD bundle');\n await minifyJsFile(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 dependency 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 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 if (dependencyList.bundledDependencies.length) {\n log.warn(\n `Inlining of 'bundledDependencies' has been deprecated in version 5 and will be removed in future versions.` +\n '\\n' +\n `List the dependency in the 'peerDependencies' section instead.`,\n );\n }\n\n return dependencyList;\n}\n"]}
@@ -100,7 +100,7 @@ function writePackageJson(entryPoint, pkg, additionalProperties, isIvy) {
100
100
  }
101
101
  }
102
102
  else if ((_c = packageJson.peerDependencies) === null || _c === void 0 ? void 0 : _c.tslib) {
103
- log.warn(`'tslib' is no longer recommanded to be used as a 'peerDependencies'. Moving it to 'dependencies'.`);
103
+ log.warn(`'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.`);
104
104
  packageJson.dependencies = Object.assign(Object.assign({}, (packageJson.dependencies || {})), { tslib: packageJson.peerDependencies.tslib });
105
105
  delete packageJson.peerDependencies.tslib;
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,qDAAwE;AAGxE,2CAAkD;AAClD,+CAA4C;AAC5C,uCAAuC;AACvC,2CAA6C;AAC7C,oCAAmG;AACnG,2CAAwC;AAE3B,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,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAgB,CAAC;IAC3D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7C,MAAM,WAAW,GAAa;QAC5B,UAAU;QACV,cAAc;QACd,cAAc;QACd,oBAAoB;QACpB,GAAG,SAAS,CAAC,IAAI,KAAK;KACvB,CAAC;IAEF,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE;QAClE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,UAAU,GAAG,MAAM,gBAAS,CAAC,MAAM,EAAE;YACzC,MAAM,EAAE,WAAW;YACnB,KAAK,EAAE,aAAa,CAAC,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WAAW;YACX,UAAU;YACV,cAAc;YACd,iBAAiB;YACjB,MAAM;YACN,YAAY;YACZ,OAAO;SACR,CAAC;QAEF,KAAK,MAAM,IAAI,IAAI,6BAA6B,EAAE;YAChD,IAAI,IAAI,IAAI,WAAW,EAAE;gBACvB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;gBACzB,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,2BAA2B,CAAC,CAAC;aACvD;SACF;QAED,WAAW,CAAC,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;QAEvC,wEAAwE;QACxE,kFAAkF;QAClF,MAAM,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,cAAc,CAAC,EAAE,WAAW,EAAE;YACtF,MAAM,EAAE,CAAC;SACV,CAAC,CAAC;;CACJ;AAED,SAAS,wBAAwB,CAAC,WAAoC,EAAE,QAAgB,EAAE,SAAmB;IAC3G,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE;QAC1B,OAAO;KACR;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE;QACpD,IAAI,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;YAC5C,GAAG,CAAC,KAAK,CAAC,cAAc,GAAG,uBAAuB,QAAQ,GAAG,CAAC,CAAC;SAChE;aAAM;YACL,GAAG,CAAC,IAAI,CACN,mCAAmC,QAAQ,gDAAgD,GAAG,6CAA6C,QAAQ,IAAI,CACxJ,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,cAAc,GAAG,kCAAkC,CAAC,CAAC;SACtE;KACF;AACH,CAAC","sourcesContent":["import * as fs from 'fs-extra';\nimport * as path from 'path';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { NgEntryPoint } from './entry-point';\nimport { NgPackage } from '../package';\nimport { ensureUnixPath } from '../../utils/path';\nimport { rimraf } from '../../utils/rimraf';\nimport * as log from '../../utils/log';\nimport { globFiles } from '../../utils/glob';\nimport { EntryPointNode, isEntryPointInProgress, isPackage, PackageNode, fileUrl } from '../nodes';\nimport { Node } from '../../graph/node';\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 ngPackageNode = graph.find(isPackage) as PackageNode;\n const ngPackage = ngPackageNode.data;\n const { destinationFiles } = entryPoint.data;\n const ignorePaths: string[] = [\n '.gitkeep',\n '**/.DS_Store',\n '**/Thumbs.db',\n '**/node_modules/**',\n `${ngPackage.dest}/**`,\n ];\n\n if (ngPackage.assets.length && !ngEntryPoint.isSecondaryEntryPoint) {\n const assets = ngPackage.assets.map(x => path.join(ngPackage.src, x));\n const assetFiles = await globFiles(assets, {\n ignore: ignorePaths,\n cache: ngPackageNode.cache.globCache,\n });\n\n // COPY ASSET FILES TO DESTINATION\n log.info('Copying assets');\n for (const file of assetFiles) {\n const relativePath = path.relative(ngPackage.src, file);\n const destination = path.resolve(ngPackage.dest, relativePath);\n entryPoint.dependsOn(new Node(fileUrl(ensureUnixPath(relativePath))));\n fs.copySync(file, destination, { overwrite: true, dereference: true });\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 const isIvy = !!entryPoint.data.tsConfig.options.enableIvy;\n\n await writePackageJson(\n ngEntryPoint,\n ngPackage,\n {\n main: relativeUnixFromDestPath(destinationFiles.umd),\n module: relativeUnixFromDestPath(destinationFiles.fesm2015),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n esm2015: relativeUnixFromDestPath(destinationFiles.esm2015),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n // Ivy doesn't generate metadata files\n metadata: isIvy ? undefined : relativeUnixFromDestPath(destinationFiles.metadata),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.sideEffects,\n },\n isIvy,\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 entry 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 properties `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 */\nasync function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] },\n isIvy: boolean,\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) {\n if (!packageJson.peerDependencies?.tslib && !packageJson.dependencies?.tslib) {\n const {\n peerDependencies: angularPeerDependencies = {},\n dependencies: angularDependencies = {},\n } = require('@angular/compiler/package.json');\n const tsLibVersion = angularPeerDependencies.tslib || angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion,\n };\n }\n } else if (packageJson.peerDependencies?.tslib) {\n log.warn(`'tslib' is no longer recommanded to be used as a 'peerDependencies'. Moving it to 'dependencies'.`);\n packageJson.dependencies = {\n ...(packageJson.dependencies || {}),\n tslib: packageJson.peerDependencies.tslib,\n };\n\n delete packageJson.peerDependencies.tslib;\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicate 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 (packageJson.scripts) {\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\n if (isIvy && !entryPoint.isSecondaryEntryPoint) {\n const scripts = packageJson.scripts || (packageJson.scripts = {});\n scripts.prepublishOnly =\n 'node --eval \"console.error(\\'' +\n 'ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\\\\n' +\n 'Please delete and rebuild the package, without compiling with Ivy, before attempting to publish.\\\\n' +\n '\\')\" ' +\n '&& exit 1';\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\n const packageJsonPropertiesToDelete = [\n 'stylelint',\n 'prettier',\n 'browserslist',\n 'devDependencies',\n 'jest',\n 'workspaces',\n 'husky',\n ];\n\n for (const prop of packageJsonPropertiesToDelete) {\n if (prop in packageJson) {\n delete packageJson[prop];\n log.info(`Removing ${prop} section in package.json.`);\n }\n }\n\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, {\n spaces: 2,\n });\n}\n\nfunction checkNonPeerDependencies(packageJson: Record<string, unknown>, property: string, whitelist: RegExp[]) {\n if (!packageJson[property]) {\n return;\n }\n\n for (const dep of Object.keys(packageJson[property])) {\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"]}
1
+ {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAA6B;AAC7B,qDAAwE;AAGxE,2CAAkD;AAClD,+CAA4C;AAC5C,uCAAuC;AACvC,2CAA6C;AAC7C,oCAAmG;AACnG,2CAAwC;AAE3B,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,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAgB,CAAC;IAC3D,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7C,MAAM,WAAW,GAAa;QAC5B,UAAU;QACV,cAAc;QACd,cAAc;QACd,oBAAoB;QACpB,GAAG,SAAS,CAAC,IAAI,KAAK;KACvB,CAAC;IAEF,IAAI,SAAS,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE;QAClE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,UAAU,GAAG,MAAM,gBAAS,CAAC,MAAM,EA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transformFromPromise } from '../../graph/transform';\nimport { NgEntryPoint } from './entry-point';\nimport { NgPackage } from '../package';\nimport { ensureUnixPath } from '../../utils/path';\nimport { rimraf } from '../../utils/rimraf';\nimport * as log from '../../utils/log';\nimport { globFiles } from '../../utils/glob';\nimport { EntryPointNode, isEntryPointInProgress, isPackage, PackageNode, fileUrl } from '../nodes';\nimport { Node } from '../../graph/node';\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 ngPackageNode = graph.find(isPackage) as PackageNode;\n const ngPackage = ngPackageNode.data;\n const { destinationFiles } = entryPoint.data;\n const ignorePaths: string[] = [\n '.gitkeep',\n '**/.DS_Store',\n '**/Thumbs.db',\n '**/node_modules/**',\n `${ngPackage.dest}/**`,\n ];\n\n if (ngPackage.assets.length && !ngEntryPoint.isSecondaryEntryPoint) {\n const assets = ngPackage.assets.map(x => path.join(ngPackage.src, x));\n const assetFiles = await globFiles(assets, {\n ignore: ignorePaths,\n cache: ngPackageNode.cache.globCache,\n });\n\n // COPY ASSET FILES TO DESTINATION\n log.info('Copying assets');\n for (const file of assetFiles) {\n const relativePath = path.relative(ngPackage.src, file);\n const destination = path.resolve(ngPackage.dest, relativePath);\n entryPoint.dependsOn(new Node(fileUrl(ensureUnixPath(relativePath))));\n fs.copySync(file, destination, { overwrite: true, dereference: true });\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 const isIvy = !!entryPoint.data.tsConfig.options.enableIvy;\n\n await writePackageJson(\n ngEntryPoint,\n ngPackage,\n {\n main: relativeUnixFromDestPath(destinationFiles.umd),\n module: relativeUnixFromDestPath(destinationFiles.fesm2015),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n esm2015: relativeUnixFromDestPath(destinationFiles.esm2015),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n // Ivy doesn't generate metadata files\n metadata: isIvy ? undefined : relativeUnixFromDestPath(destinationFiles.metadata),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.sideEffects,\n },\n isIvy,\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 entry 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 properties `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 */\nasync function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] },\n isIvy: boolean,\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) {\n if (!packageJson.peerDependencies?.tslib && !packageJson.dependencies?.tslib) {\n const {\n peerDependencies: angularPeerDependencies = {},\n dependencies: angularDependencies = {},\n } = require('@angular/compiler/package.json');\n const tsLibVersion = angularPeerDependencies.tslib || angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion,\n };\n }\n } else if (packageJson.peerDependencies?.tslib) {\n log.warn(`'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.`);\n packageJson.dependencies = {\n ...(packageJson.dependencies || {}),\n tslib: packageJson.peerDependencies.tslib,\n };\n\n delete packageJson.peerDependencies.tslib;\n }\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicate 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 (packageJson.scripts) {\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\n if (isIvy && !entryPoint.isSecondaryEntryPoint) {\n const scripts = packageJson.scripts || (packageJson.scripts = {});\n scripts.prepublishOnly =\n 'node --eval \"console.error(\\'' +\n 'ERROR: Trying to publish a package that has been compiled by Ivy. This is not allowed.\\\\n' +\n 'Please delete and rebuild the package, without compiling with Ivy, before attempting to publish.\\\\n' +\n '\\')\" ' +\n '&& exit 1';\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\n const packageJsonPropertiesToDelete = [\n 'stylelint',\n 'prettier',\n 'browserslist',\n 'devDependencies',\n 'jest',\n 'workspaces',\n 'husky',\n ];\n\n for (const prop of packageJsonPropertiesToDelete) {\n if (prop in packageJson) {\n delete packageJson[prop];\n log.info(`Removing ${prop} section in package.json.`);\n }\n }\n\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, {\n spaces: 2,\n });\n}\n\nfunction checkNonPeerDependencies(packageJson: Record<string, unknown>, property: string, whitelist: RegExp[]) {\n if (!packageJson[property]) {\n return;\n }\n\n for (const dep of Object.keys(packageJson[property])) {\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"]}
@@ -18,7 +18,7 @@ import { NgEntryPoint } from './entry-point/entry-point';
18
18
  *
19
19
  * A _Package_ is reflected by `NgPackage`.
20
20
  * An _Entry Point_ is reflected by `NgEntryPoint`.
21
- * One `NgPackage` relates to one (or many) `NgEentryPoint`,
21
+ * One `NgPackage` relates to one (or many) `NgEntryPoint`,
22
22
  * one `NgEntryPoint` relates to one `NgPackage`.
23
23
  *
24
24
  * #### Watch Out
@@ -37,7 +37,7 @@ export declare class NgPackage {
37
37
  */
38
38
  readonly primary: NgEntryPoint;
39
39
  /**
40
- * An array of seconary entry points.
40
+ * An array of secondary entry points.
41
41
  */
42
42
  readonly secondaries: NgEntryPoint[];
43
43
  constructor(basePath: string,
@@ -46,7 +46,7 @@ export declare class NgPackage {
46
46
  */
47
47
  primary: NgEntryPoint,
48
48
  /**
49
- * An array of seconary entry points.
49
+ * An array of secondary entry points.
50
50
  */
51
51
  secondaries?: NgEntryPoint[]);
52
52
  /** Absolute path of the package's source folder, derived from the user's (primary) package location. */
@@ -21,7 +21,7 @@ const path = require("path");
21
21
  *
22
22
  * A _Package_ is reflected by `NgPackage`.
23
23
  * An _Entry Point_ is reflected by `NgEntryPoint`.
24
- * One `NgPackage` relates to one (or many) `NgEentryPoint`,
24
+ * One `NgPackage` relates to one (or many) `NgEntryPoint`,
25
25
  * one `NgEntryPoint` relates to one `NgPackage`.
26
26
  *
27
27
  * #### Watch Out
@@ -40,7 +40,7 @@ class NgPackage {
40
40
  */
41
41
  primary,
42
42
  /**
43
- * An array of seconary entry points.
43
+ * An array of secondary entry points.
44
44
  */
45
45
  secondaries = []) {
46
46
  this.basePath = basePath;
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../src/lib/ng-package/package.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAG7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,SAAS;IACpB,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;IACD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,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;AAnDD,8BAmDC","sourcesContent":["import * as path from 'path';\nimport { NgEntryPoint } from './entry-point/entry-point';\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(): string {\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(): string {\n return this.absolutePathFromPrimary('dest');\n }\n\n public get keepLifecycleScripts(): boolean {\n return this.primary.$get('keepLifecycleScripts') === true;\n }\n public get assets(): string[] {\n return this.primary.$get('assets');\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/package.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAG7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,SAAS;IACpB,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;IACD,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,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;AAnDD,8BAmDC","sourcesContent":["import * as path from 'path';\nimport { NgEntryPoint } from './entry-point/entry-point';\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) `NgEntryPoint`,\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 secondary 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(): string {\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(): string {\n return this.absolutePathFromPrimary('dest');\n }\n\n public get keepLifecycleScripts(): boolean {\n return this.primary.$get('keepLifecycleScripts') === true;\n }\n public get assets(): string[] {\n return this.primary.$get('assets');\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,6 +1,6 @@
1
1
  "use strict";
2
2
  // XX: internal in ngc's `main()`, a tsickle emit callback is passed to the tsc compiler
3
- // ... blatanlty copy-paste the emit callback here. it's not a public api.
3
+ // ... blatantly copy-paste the emit callback here. it's not a public api.
4
4
  // ... @link https://github.com/angular/angular/blob/24bf3e2a251634811096b939e61d63297934579e/packages/compiler-cli/src/main.ts#L36-L38
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createEmitCallback = void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"create-emit-callback.js","sourceRoot":"","sources":["../../../src/lib/ngc/create-emit-callback.ts"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,0EAA0E;AAC1E,uIAAuI;;;AAEvI;;;;;;GAMG;AAEH,4IAA4I;AAC5I,MAAM,eAAe,GAAG,oEAAoE,CAAC;AAK7F,kGAAkG;AAClG,SAAgB,kBAAkB,CAAC,OAA4B;IAC7D,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,aAAa,KAAK,YAAY,CAAC;IACzF,MAAM,uBAAuB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IACnE,IAAI,CAAC,mBAAmB,IAAI,CAAC,uBAAuB,EAAE;QACpD,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,OAAO,CAAC,0BAA0B,IAAI,OAAO,CAAC,aAAa,KAAK,eAAe,EAAE;QACnF,IAAI,mBAAmB,EAAE;YACvB,mFAAmF;YACnF,iEAAiE;YACjE,mCAAmC;YACnC,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;SACtC;QAED,MAAM,WAAW,GAWb;YACF,2BAA2B,EAAE,QAAQ,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;YACpG,gBAAgB,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,CAAC,EAAE;YAC/C,2BAA2B,EAAE,SAAS,CAAC,EAAE,CAAC,KAAK;YAC/C,kBAAkB,EAAE,QAAQ,CAAC,EAAE,CAAC,QAAQ;YACxC,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,IAAI;YACb,2BAA2B,EAAE,KAAK;YAClC,mBAAmB;YACnB,uBAAuB;SACxB,CAAC;QAEF,OAAO,CAAC,EACN,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GAAG,EAAE,EACvB,IAAI,EACJ,OAAO,GACR,EAAE,EAAE;QACH,kFAAkF;QAClF,OAAO,CAAC,SAAS,CAAC,CAAC,eAAe,CAChC,OAAO,kCACF,WAAW,KAAE,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,KAC3D,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB;YACE,QAAQ,EAAE,kBAAkB,CAAC,MAAM;YACnC,OAAO,EAAE,kBAAkB,CAAC,KAAK;SAClC,CACF,CAAC;KACL;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAlED,gDAkEC","sourcesContent":["// XX: internal in ngc's `main()`, a tsickle emit callback is passed to the tsc compiler\n// ... blatanlty copy-paste the emit callback here. it's not a public api.\n// ... @link https://github.com/angular/angular/blob/24bf3e2a251634811096b939e61d63297934579e/packages/compiler-cli/src/main.ts#L36-L38\n\n/*\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// @link https://github.com/angular/angular/blob/24bf3e2a251634811096b939e61d63297934579e/packages/compiler-cli/src/transformers/util.ts#L14\nconst GENERATED_FILES = /(.*?)\\.(ngfactory|shim\\.ngstyle|ngstyle|ngsummary)\\.(js|d\\.ts|ts)$/;\n\nimport * as tsickle from 'tsickle';\nimport * as api from '@angular/compiler-cli/src/transformers/api';\n\n// @link https://github.com/angular/angular/blob/83d207d/packages/compiler-cli/src/main.ts#L42-L84\nexport function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback | undefined {\n const transformDecorators = !options.enableIvy && options.annotationsAs !== 'decorators';\n const transformTypesToClosure = options.annotateForClosureCompiler;\n if (!transformDecorators && !transformTypesToClosure) {\n return undefined;\n }\n\n if (options.annotateForClosureCompiler || options.annotationsAs === 'static fields') {\n if (transformDecorators) {\n // This is needed as a workaround for https://github.com/angular/tsickle/issues/635\n // Otherwise tsickle might emit references to non imported values\n // as TypeScript elided the import.\n options.emitDecoratorMetadata = true;\n }\n\n const tsickleHost: Pick<\n tsickle.TsickleHost,\n | 'shouldSkipTsickleProcessing'\n | 'pathToModuleName'\n | 'shouldIgnoreWarningsForPath'\n | 'fileNameToModuleId'\n | 'googmodule'\n | 'untyped'\n | 'convertIndexImportShorthand'\n | 'transformDecorators'\n | 'transformTypesToClosure'\n > = {\n shouldSkipTsickleProcessing: fileName => /\\.d\\.ts$/.test(fileName) || GENERATED_FILES.test(fileName),\n pathToModuleName: (_context, _importPath) => '',\n shouldIgnoreWarningsForPath: _filePath => false,\n fileNameToModuleId: fileName => fileName,\n googmodule: false,\n untyped: true,\n convertIndexImportShorthand: false,\n transformDecorators,\n transformTypesToClosure,\n };\n\n return ({\n program,\n targetSourceFile,\n writeFile,\n cancellationToken,\n emitOnlyDtsFiles,\n customTransformers = {},\n host,\n options,\n }) =>\n // tslint:disable-next-line:no-require-imports only depend on tsickle if requested\n require('tsickle').emitWithTsickle(\n program,\n { ...tsickleHost, options, host, moduleResolutionHost: host },\n host,\n options,\n targetSourceFile,\n writeFile,\n cancellationToken,\n emitOnlyDtsFiles,\n {\n beforeTs: customTransformers.before,\n afterTs: customTransformers.after,\n },\n );\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"create-emit-callback.js","sourceRoot":"","sources":["../../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F;QAClF,OAAO,CAAC,SAAS,CAAC,CAAC,eAAe,CAChC,OAAO,kCACF,WAAW,KAAE,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,KAC3D,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB;YACE,QAAQ,EAAE,kBAAkB,CAAC,MAAM;YACnC,OAAO,EAAE,kBAAkB,CAAC,KAAK;SAClC,CACF,CAAC;KACL;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAlED,gDAkEC","sourcesContent":["// XX: internal in ngc's `main()`, a tsickle emit callback is passed to the tsc compiler\n// ... blatantly copy-paste the emit callback here. it's not a public api.\n// ... @link https://github.com/angular/angular/blob/24bf3e2a251634811096b939e61d63297934579e/packages/compiler-cli/src/main.ts#L36-L38\n\n/*\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// @link https://github.com/angular/angular/blob/24bf3e2a251634811096b939e61d63297934579e/packages/compiler-cli/src/transformers/util.ts#L14\nconst GENERATED_FILES = /(.*?)\\.(ngfactory|shim\\.ngstyle|ngstyle|ngsummary)\\.(js|d\\.ts|ts)$/;\n\nimport * as tsickle from 'tsickle';\nimport * as api from '@angular/compiler-cli/src/transformers/api';\n\n// @link https://github.com/angular/angular/blob/83d207d/packages/compiler-cli/src/main.ts#L42-L84\nexport function createEmitCallback(options: api.CompilerOptions): api.TsEmitCallback | undefined {\n const transformDecorators = !options.enableIvy && options.annotationsAs !== 'decorators';\n const transformTypesToClosure = options.annotateForClosureCompiler;\n if (!transformDecorators && !transformTypesToClosure) {\n return undefined;\n }\n\n if (options.annotateForClosureCompiler || options.annotationsAs === 'static fields') {\n if (transformDecorators) {\n // This is needed as a workaround for https://github.com/angular/tsickle/issues/635\n // Otherwise tsickle might emit references to non imported values\n // as TypeScript elided the import.\n options.emitDecoratorMetadata = true;\n }\n\n const tsickleHost: Pick<\n tsickle.TsickleHost,\n | 'shouldSkipTsickleProcessing'\n | 'pathToModuleName'\n | 'shouldIgnoreWarningsForPath'\n | 'fileNameToModuleId'\n | 'googmodule'\n | 'untyped'\n | 'convertIndexImportShorthand'\n | 'transformDecorators'\n | 'transformTypesToClosure'\n > = {\n shouldSkipTsickleProcessing: fileName => /\\.d\\.ts$/.test(fileName) || GENERATED_FILES.test(fileName),\n pathToModuleName: (_context, _importPath) => '',\n shouldIgnoreWarningsForPath: _filePath => false,\n fileNameToModuleId: fileName => fileName,\n googmodule: false,\n untyped: true,\n convertIndexImportShorthand: false,\n transformDecorators,\n transformTypesToClosure,\n };\n\n return ({\n program,\n targetSourceFile,\n writeFile,\n cancellationToken,\n emitOnlyDtsFiles,\n customTransformers = {},\n host,\n options,\n }) =>\n // tslint:disable-next-line:no-require-imports only depend on tsickle if requested\n require('tsickle').emitWithTsickle(\n program,\n { ...tsickleHost, options, host, moduleResolutionHost: host },\n host,\n options,\n targetSourceFile,\n writeFile,\n cancellationToken,\n emitOnlyDtsFiles,\n {\n beforeTs: customTransformers.before,\n afterTs: customTransformers.after,\n },\n );\n }\n\n return undefined;\n}\n"]}
package/lib/packagr.d.ts CHANGED
@@ -47,7 +47,7 @@ export declare class NgPackagr {
47
47
  * Overwrites the 'build' transform.
48
48
  *
49
49
  * @param transform
50
- * @return Self intance for fluent API
50
+ * @return Self instance for fluent API
51
51
  */
52
52
  withBuildTransform(transform: InjectionToken<Transform>): NgPackagr;
53
53
  /**
package/lib/packagr.js CHANGED
@@ -68,7 +68,7 @@ class NgPackagr {
68
68
  * Overwrites the 'build' transform.
69
69
  *
70
70
  * @param transform
71
- * @return Self intance for fluent API
71
+ * @return Self instance for fluent API
72
72
  */
73
73
  withBuildTransform(transform) {
74
74
  this.buildTransform = transform;
@@ -1 +1 @@
1
- {"version":3,"file":"packagr.js","sourceRoot":"","sources":["../../src/lib/packagr.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAE5E,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,IAAI,EAAE,CAAC,CAAC,CAAC;QAErD,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,iBAAiB;QACtB,MAAM,QAAQ,GAAG,iCAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrE,MAAM,sBAAsB,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEjE,OAAO,SAAY,CAAC,IAAI,wBAAU,EAAE,CAAC,CAAC,IAAI,CACxC,sBAAsB,EACtB,sBAAU,CAAC,GAAG,CAAC,EAAE;YACf,2CAA2C;YAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,OAAO,iBAAU,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC,CAAC,EACF,eAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CACrB,CAAC;IACJ,CAAC;CACF;AAzGD,8BAyGC;AAEY,QAAA,SAAS,GAAG,GAAc,EAAE,CACvC,IAAI,SAAS,CAAC;IACZ,sCAAsC;IACtC,GAAG,8BAAiB;IACpB,GAAG,sCAAqB;CACzB,CAAC,CAAC","sourcesContent":["import { InjectionToken, Provider, ReflectiveInjector } from 'injection-js';\nimport { ParsedConfiguration } from '@angular/compiler-cli';\nimport { of as observableOf, Observable, throwError } from 'rxjs';\nimport { map, catchError } from 'rxjs/operators';\nimport { BuildGraph } from './graph/build-graph';\nimport { Transform } from './graph/transform';\nimport * as log from './utils/log';\nimport { provideTsConfig } from './ng-package/entry-point/init-tsconfig.di';\nimport { ENTRY_POINT_PROVIDERS } from './ng-package/entry-point/entry-point.di';\nimport { PACKAGE_TRANSFORM, PACKAGE_PROVIDERS } from './ng-package/package.di';\nimport { provideProject } from './project.di';\nimport { provideOptions, NgPackagrOptions } from './ng-package/options.di';\n\n/**\n * The original ng-packagr implemented on top of a rxjs-ified and di-jectable transformation pipeline.\n *\n * See the `docs/transformations.md` for more prose description.\n *\n * @link https://github.com/ng-packagr/ng-packagr/pull/572\n */\nexport class NgPackagr {\n private buildTransform: InjectionToken<Transform> = PACKAGE_TRANSFORM.provide;\n\n constructor(private providers: Provider[]) {}\n\n /**\n * Adds options to ng-packagr\n *\n * @param options Ng Packagr Options\n * @return Self instance for fluent API\n */\n public withOptions(options: NgPackagrOptions): NgPackagr {\n this.providers.push(provideOptions(options));\n\n return this;\n }\n\n /**\n * Sets the path to the user's \"ng-package\" file (either `package.json`, `ng-package.json`, or `ng-package.js`)\n *\n * @param project File path\n * @return Self instance for fluent API\n */\n public forProject(project: string): NgPackagr {\n this.providers.push(provideProject(project));\n\n return this;\n }\n\n /**\n * Adds dependency injection providers.\n *\n * @param providers\n * @return Self instance for fluent API\n * @link https://github.com/mgechev/injection-js\n */\n public withProviders(providers: Provider[]): NgPackagr {\n this.providers = [...this.providers, ...providers];\n\n return this;\n }\n\n /**\n * Overwrites the default TypeScript configuration.\n *\n * @param defaultValues A tsconfig providing default values to the compilation.\n * @return Self instance for fluent API\n */\n public withTsConfig(defaultValues: ParsedConfiguration | string): NgPackagr {\n this.providers.push(provideTsConfig(defaultValues));\n\n return this;\n }\n\n /**\n * Overwrites the 'build' transform.\n *\n * @param transform\n * @return Self intance for fluent API\n */\n public withBuildTransform(transform: InjectionToken<Transform>): NgPackagr {\n this.buildTransform = transform;\n\n return this;\n }\n\n /**\n * Builds the project by kick-starting the 'build' transform over an (initially) empty `BuildGraph``\n *\n * @return A promisified result of the transformation pipeline.\n */\n public build(): Promise<void> {\n return this.buildAsObservable().toPromise();\n }\n\n /**\n * Builds and watch for changes by kick-starting the 'watch' transform over an (initially) empty `BuildGraph``\n *\n * @return An observable result of the transformation pipeline.\n */\n public watch(): Observable<void> {\n this.providers.push(provideOptions({ watch: true }));\n\n return this.buildAsObservable();\n }\n\n /**\n * Builds the project by kick-starting the 'build' transform over an (initially) empty `BuildGraph``\n *\n * @return An observable result of the transformation pipeline.\n */\n public buildAsObservable(): Observable<void> {\n const injector = ReflectiveInjector.resolveAndCreate(this.providers);\n const buildTransformOperator = injector.get(this.buildTransform);\n\n return observableOf(new BuildGraph()).pipe(\n buildTransformOperator,\n catchError(err => {\n // Report error and re-throw to subscribers\n log.error(err);\n return throwError(err);\n }),\n map(() => undefined),\n );\n }\n}\n\nexport const ngPackagr = (): NgPackagr =>\n new NgPackagr([\n // Add default providers to this list.\n ...PACKAGE_PROVIDERS,\n ...ENTRY_POINT_PROVIDERS,\n ]);\n"]}
1
+ {"version":3,"file":"packagr.js","sourceRoot":"","sources":["../../src/lib/packagr.ts"],"names":[],"mappings":";;;AAAA,+CAA4E;AAE5E,+BAAkE;AAClE,8CAAiD;AACjD,qDAAiD;AAEjD,mCAAmC;AACnC,gFAA4E;AAC5E,4EAAgF;AAChF,wDAA+E;AAC/E,6CAA8C;AAC9C,wDAA2E;AAE3E;;;;;;GAMG;AACH,MAAa,SAAS;IAGpB,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;QAFjC,mBAAc,GAA8B,8BAAiB,CAAC,OAAO,CAAC;IAElC,CAAC;IAE7C;;;;;OAKG;IACI,WAAW,CAAC,OAAyB;QAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,2BAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,OAAe;QAC/B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,2BAAc,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACI,aAAa,CAAC,SAAqB;QACxC,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,SAAS,CAAC,CAAC;QAEnD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,aAA2C;QAC7D,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,kCAAe,CAAC,aAAa,CAAC,CAAC,CAAC;QAEpD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,kBAAkB,CAAC,SAAoC;QAC5D,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAEhC,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACI,KAAK;QACV,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACI,KAAK;QACV,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,2BAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAErD,OAAO,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,iBAAiB;QACtB,MAAM,QAAQ,GAAG,iCAAkB,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrE,MAAM,sBAAsB,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEjE,OAAO,SAAY,CAAC,IAAI,wBAAU,EAAE,CAAC,CAAC,IAAI,CACxC,sBAAsB,EACtB,sBAAU,CAAC,GAAG,CAAC,EAAE;YACf,2CAA2C;YAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,OAAO,iBAAU,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC,CAAC,EACF,eAAG,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CACrB,CAAC;IACJ,CAAC;CACF;AAzGD,8BAyGC;AAEY,QAAA,SAAS,GAAG,GAAc,EAAE,CACvC,IAAI,SAAS,CAAC;IACZ,sCAAsC;IACtC,GAAG,8BAAiB;IACpB,GAAG,sCAAqB;CACzB,CAAC,CAAC","sourcesContent":["import { InjectionToken, Provider, ReflectiveInjector } from 'injection-js';\nimport { ParsedConfiguration } from '@angular/compiler-cli';\nimport { of as observableOf, Observable, throwError } from 'rxjs';\nimport { map, catchError } from 'rxjs/operators';\nimport { BuildGraph } from './graph/build-graph';\nimport { Transform } from './graph/transform';\nimport * as log from './utils/log';\nimport { provideTsConfig } from './ng-package/entry-point/init-tsconfig.di';\nimport { ENTRY_POINT_PROVIDERS } from './ng-package/entry-point/entry-point.di';\nimport { PACKAGE_TRANSFORM, PACKAGE_PROVIDERS } from './ng-package/package.di';\nimport { provideProject } from './project.di';\nimport { provideOptions, NgPackagrOptions } from './ng-package/options.di';\n\n/**\n * The original ng-packagr implemented on top of a rxjs-ified and di-jectable transformation pipeline.\n *\n * See the `docs/transformations.md` for more prose description.\n *\n * @link https://github.com/ng-packagr/ng-packagr/pull/572\n */\nexport class NgPackagr {\n private buildTransform: InjectionToken<Transform> = PACKAGE_TRANSFORM.provide;\n\n constructor(private providers: Provider[]) {}\n\n /**\n * Adds options to ng-packagr\n *\n * @param options Ng Packagr Options\n * @return Self instance for fluent API\n */\n public withOptions(options: NgPackagrOptions): NgPackagr {\n this.providers.push(provideOptions(options));\n\n return this;\n }\n\n /**\n * Sets the path to the user's \"ng-package\" file (either `package.json`, `ng-package.json`, or `ng-package.js`)\n *\n * @param project File path\n * @return Self instance for fluent API\n */\n public forProject(project: string): NgPackagr {\n this.providers.push(provideProject(project));\n\n return this;\n }\n\n /**\n * Adds dependency injection providers.\n *\n * @param providers\n * @return Self instance for fluent API\n * @link https://github.com/mgechev/injection-js\n */\n public withProviders(providers: Provider[]): NgPackagr {\n this.providers = [...this.providers, ...providers];\n\n return this;\n }\n\n /**\n * Overwrites the default TypeScript configuration.\n *\n * @param defaultValues A tsconfig providing default values to the compilation.\n * @return Self instance for fluent API\n */\n public withTsConfig(defaultValues: ParsedConfiguration | string): NgPackagr {\n this.providers.push(provideTsConfig(defaultValues));\n\n return this;\n }\n\n /**\n * Overwrites the 'build' transform.\n *\n * @param transform\n * @return Self instance for fluent API\n */\n public withBuildTransform(transform: InjectionToken<Transform>): NgPackagr {\n this.buildTransform = transform;\n\n return this;\n }\n\n /**\n * Builds the project by kick-starting the 'build' transform over an (initially) empty `BuildGraph``\n *\n * @return A promisified result of the transformation pipeline.\n */\n public build(): Promise<void> {\n return this.buildAsObservable().toPromise();\n }\n\n /**\n * Builds and watch for changes by kick-starting the 'watch' transform over an (initially) empty `BuildGraph``\n *\n * @return An observable result of the transformation pipeline.\n */\n public watch(): Observable<void> {\n this.providers.push(provideOptions({ watch: true }));\n\n return this.buildAsObservable();\n }\n\n /**\n * Builds the project by kick-starting the 'build' transform over an (initially) empty `BuildGraph``\n *\n * @return An observable result of the transformation pipeline.\n */\n public buildAsObservable(): Observable<void> {\n const injector = ReflectiveInjector.resolveAndCreate(this.providers);\n const buildTransformOperator = injector.get(this.buildTransform);\n\n return observableOf(new BuildGraph()).pipe(\n buildTransformOperator,\n catchError(err => {\n // Report error and re-throw to subscribers\n log.error(err);\n return throwError(err);\n }),\n map(() => undefined),\n );\n }\n}\n\nexport const ngPackagr = (): NgPackagr =>\n new NgPackagr([\n // Add default providers to this list.\n ...PACKAGE_PROVIDERS,\n ...ENTRY_POINT_PROVIDERS,\n ]);\n"]}
@@ -49,7 +49,7 @@ class StylesheetProcessor {
49
49
  to: filePath.replace(path.extname(filePath), '.css'),
50
50
  });
51
51
  // Log warnings from postcss
52
- result.warnings().forEach((msg) => log.warn(msg.toString()));
52
+ result.warnings().forEach(msg => log.warn(msg.toString()));
53
53
  return result.css;
54
54
  }
55
55
  renderPreProcessor(filePath, content) {
@@ -69,11 +69,11 @@ class StylesheetProcessor {
69
69
  .css.toString();
70
70
  case '.less':
71
71
  // this is the only way I found to make LESS sync
72
- let cmd = `node "${require.resolve('less/bin/lessc')}" "${filePath}" --js`;
72
+ const args = [require.resolve('less/bin/lessc'), filePath, '--js'];
73
73
  if (this.styleIncludePaths.length) {
74
- cmd += ` --include-path="${this.styleIncludePaths.join(':')}"`;
74
+ args.push(`--include-path=${this.styleIncludePaths.join(':')}`);
75
75
  }
76
- return child_process_1.execSync(cmd).toString();
76
+ return child_process_1.execFileSync('node', args).toString();
77
77
  case '.styl':
78
78
  case '.stylus':
79
79
  return (stylus(content)
@@ -109,7 +109,7 @@ class StylesheetProcessor {
109
109
  const cssNanoPlugins = preset.plugins
110
110
  // replicate the `initializePlugin` behavior from https://github.com/cssnano/cssnano/blob/a566cc5/packages/cssnano/src/index.js#L8
111
111
  .map(([creator, pluginConfig]) => creator(pluginConfig))
112
- .filter((plugin) => !asyncPlugins.includes(plugin.postcssPlugin));
112
+ .filter(plugin => !asyncPlugins.includes(plugin.postcssPlugin));
113
113
  postCssPlugins.push(...cssNanoPlugins);
114
114
  return postcss(postCssPlugins);
115
115
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAAoC;AACpC,iDAAyC;AAEzC,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,+DAA+D;AAC/D,iCAAiC;AAEjC,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACf,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB;AAED;;;;;;;;GAQG;AACH,IAAI,YAA6B,CAAC;AAClC,IAAI;IACF,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,6CAA6C;CACnF;AAAC,WAAM;IACN,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,MAAa,mBAAmB;IAG9B,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,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AC,YAAY,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAExE,MAAM,MAAM,GAAG,oBAAoB,CAAC;YAClC,IAAI,EAAE,KAAK;YACX,oDAAoD;YACpD,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,CAAC,cAAc,CAAC,CAAC;QACtC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO;YACnC,kIAAkI;aACjI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;aACvD,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAEpE,cAAc,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AApGD,kDAoGC","sourcesContent":["import * as path from 'path';\nimport * as log from '../utils/log';\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 * as cssnanoPresetDefault from 'cssnano-preset-default';\nimport * as stylus from 'stylus';\n\nexport enum CssUrl {\n inline = 'inline',\n none = 'none',\n}\n\n/*\n * Please be aware of the few differences in behaviour https://github.com/sass/dart-sass/blob/master/README.md#behavioral-differences-from-ruby-sass\n * By default `npm install` will install sass.\n * To use node-sass you need to use:\n * Npm:\n * `npm install node-sass --save-dev`\n * Yarn:\n * `yarn add node-sass --dev`\n */\nlet sassComplier: any | undefined;\ntry {\n sassComplier = require('node-sass'); // Check if node-sass is explicitly included.\n} catch {\n sassComplier = require('sass');\n}\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 sassComplier\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 \"${require.resolve('less/bin/lessc')}\" \"${filePath}\" --js`;\n if (this.styleIncludePaths.length) {\n 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 overrideBrowserslist = 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(autoprefixer({ overrideBrowserslist, grid: true }));\n\n const preset = cssnanoPresetDefault({\n svgo: false,\n // Disable calc optimizations due to several issues.\n calc: false,\n });\n\n const asyncPlugins = ['postcss-svgo'];\n const cssNanoPlugins = preset.plugins\n // replicate the `initializePlugin` behavior from https://github.com/cssnano/cssnano/blob/a566cc5/packages/cssnano/src/index.js#L8\n .map(([creator, pluginConfig]) => creator(pluginConfig))\n .filter((plugin) => !asyncPlugins.includes(plugin.postcssPlugin));\n\n postCssPlugins.push(...cssNanoPlugins);\n\n return postcss(postCssPlugins);\n }\n}\n"]}
1
+ {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAAoC;AACpC,iDAA6C;AAE7C,YAAY;AACZ,6CAA6C;AAC7C,6CAA6C;AAC7C,kEAAkE;AAClE,mCAAmC;AACnC,0CAA0C;AAC1C,+DAA+D;AAC/D,iCAAiC;AAEjC,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACf,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB;AAED;;;;;;;;GAQG;AACH,IAAI,YAA6B,CAAC;AAClC,IAAI;IACF,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,6CAA6C;CACnF;AAAC,WAAM;IACN,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,MAAa,mBAAmB;IAG9B,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,CAAC,CAAC;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CAAC,YAAY,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAExE,MAAM,MAAM,GAAG,oBAAoB,CAAC;YAClC,IAAI,EAAE,KAAK;YACX,oDAAoD;YACpD,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,MAAM,YAAY,GAAG,CAAC,cAAc,CAAC,CAAC;QACtC,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO;YACnC,kIAAkI;aACjI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;aACvD,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;QAElE,cAAc,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;QAEvC,OAAO,OAAO,CAAC,cAAc,CAAC,CAAC;IACjC,CAAC;CACF;AApGD,kDAoGC","sourcesContent":["import * as path from 'path';\nimport * as log from '../utils/log';\nimport { execFileSync } 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 * as cssnanoPresetDefault from 'cssnano-preset-default';\nimport * as stylus from 'stylus';\n\nexport enum CssUrl {\n inline = 'inline',\n none = 'none',\n}\n\n/*\n * Please be aware of the few differences in behaviour https://github.com/sass/dart-sass/blob/master/README.md#behavioral-differences-from-ruby-sass\n * By default `npm install` will install sass.\n * To use node-sass you need to use:\n * Npm:\n * `npm install node-sass --save-dev`\n * Yarn:\n * `yarn add node-sass --dev`\n */\nlet sassComplier: any | undefined;\ntry {\n sassComplier = require('node-sass'); // Check if node-sass is explicitly included.\n} catch {\n sassComplier = require('sass');\n}\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 sassComplier\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 const args = [require.resolve('less/bin/lessc'), filePath, '--js'];\n if (this.styleIncludePaths.length) {\n args.push(`--include-path=${this.styleIncludePaths.join(':')}`);\n }\n\n return execFileSync('node', args).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 overrideBrowserslist = 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(autoprefixer({ overrideBrowserslist, grid: true }));\n\n const preset = cssnanoPresetDefault({\n svgo: false,\n // Disable calc optimizations due to several issues.\n calc: false,\n });\n\n const asyncPlugins = ['postcss-svgo'];\n const cssNanoPlugins = preset.plugins\n // replicate the `initializePlugin` behavior from https://github.com/cssnano/cssnano/blob/a566cc5/packages/cssnano/src/index.js#L8\n .map(([creator, pluginConfig]) => creator(pluginConfig))\n .filter(plugin => !asyncPlugins.includes(plugin.postcssPlugin));\n\n postCssPlugins.push(...cssNanoPlugins);\n\n return postcss(postCssPlugins);\n }\n}\n"]}
@@ -79,6 +79,7 @@ exports.initializeTsConfig = (defaultTsConfig, entryPoints) => {
79
79
  flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,
80
80
  basePath,
81
81
  rootDir: basePath,
82
+ sourceRoot: basePath,
82
83
  };
83
84
  tsConfig.rootNames = [entryPoint.entryFilePath];
84
85
  tsConfig.options = Object.assign(Object.assign({}, tsConfig.options), overrideOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,6BAA6B;AAC7B,iCAAiC;AAEjC,oCAAoC;AAEpC;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAiB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;KACjE;IAED,8BAA8B;IAC9B,MAAM,YAAY,GAAuB;QACvC,gBAAgB,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM;QAChD,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,sBAAsB,EAAE,IAAI;QAE5B,aAAa;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QAErB,MAAM,EAAE,EAAE;Q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C,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAEnF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;YACrC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;SAC/C;aAAM;YACL,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;SACzD;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzBD,oEAyBC","sourcesContent":["import * as ng from '@angular/compiler-cli';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport * as log from '../utils/log';\n\n/**\n * Reads the default TypeScript configuration.\n */\nexport function readDefaultTsConfig(fileName?: string): ng.ParsedConfiguration {\n if (!fileName) {\n fileName = path.resolve(__dirname, 'conf', 'tsconfig.ngc.json');\n }\n\n // these options are mandatory\n const extraOptions: ng.CompilerOptions = {\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n target: ts.ScriptTarget.ES2015,\n experimentalDecorators: true,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler to options\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const config = ng.readConfiguration(fileName, extraOptions);\n const options = config.options;\n\n // todo: alanagius4 - the below shouldn't be needed but it seems that setting it only in create-emit-callback.ts\n // is not working correctly\n const transformDecorators = !options.enableIvy && options.annotationsAs !== 'decorators';\n if ((options.annotateForClosureCompiler || options.annotationsAs === 'static fields') && transformDecorators) {\n // This is needed as a workaround for https://github.com/angular/tsickle/issues/635\n // Otherwise tsickle might emit references to non imported values\n // as TypeScript elided the import.\n options.emitDecoratorMetadata = true;\n }\n\n return config;\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nexport function createDefaultTsConfig(values?: ng.ParsedConfiguration | string): ng.ParsedConfiguration {\n if (!values) {\n return readDefaultTsConfig();\n } else if (typeof values === 'string') {\n return readDefaultTsConfig(values);\n } else {\n return values;\n }\n}\n\n/**\n * Initializes TypeScript Compiler options and Angular Compiler options by overriding the\n * default config with entry point-specific values.\n */\nexport const initializeTsConfig = (defaultTsConfig: ng.ParsedConfiguration, entryPoints: EntryPointNode[]) => {\n if (defaultTsConfig.errors.length > 0) {\n throw ng.formatDiagnostics(defaultTsConfig.errors);\n }\n\n entryPoints.forEach(currentEntryPoint => {\n const { entryPoint } = currentEntryPoint.data;\n log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);\n const basePath = path.dirname(entryPoint.entryFilePath);\n\n // Resolve defaults from DI token and create a deep copy of the defaults\n let tsConfig: ng.ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfig));\n\n const overrideOptions: ng.CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n };\n\n tsConfig.rootNames = [entryPoint.entryFilePath];\n tsConfig.options = { ...tsConfig.options, ...overrideOptions };\n currentEntryPoint.data.tsConfig = tsConfig;\n });\n};\n\n/**\n * Set the paths for entrypoint dependencies.\n *\n * This doesn't mutate the object.\n *\n * @param parsedTsConfig - A parsed tsconfig\n * @param entryPoints - A list of entryPoints\n * @param pointToSource Point the path mapping to either the source code or emitted declarations.\n * Typically for analysis one should point to the source files while for a compilation once should use the emitted declarations\n */\nexport function setDependenciesTsConfigPaths(\n parsedTsConfig: ng.ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): ng.ParsedConfiguration {\n const tsConfig = JSON.parse(JSON.stringify(parsedTsConfig));\n\n // Add paths mappings for dependencies\n if (!tsConfig.options.paths) {\n tsConfig.options.paths = {};\n }\n\n for (let dep of entryPoints) {\n const { entryPoint } = dep.data;\n const { moduleId, destinationFiles, entryFilePath } = entryPoint;\n const mappedPath = [pointToSource ? entryFilePath : destinationFiles.declarations];\n\n if (!tsConfig.options.paths[moduleId]) {\n tsConfig.options.paths[moduleId] = mappedPath;\n } else {\n tsConfig.options.paths[moduleId].unshift(...mappedPath);\n }\n }\n\n return tsConfig;\n}\n"]}
1
+ {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,6BAA6B;AAC7B,iCAAiC;AAEjC,oCAAoC;AAEpC;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAiB;IACnD,IAAI,CAAC,QAAQ,EAAE;QACb,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;KACjE;IAED,8BAA8B;IAC9B,MAAM,YAAY,GAAuB;QACvC,gBAAgB,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM;QAChD,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,sBAAsB,EAAE,IAAI;QAE5B,aAAa;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QAErB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,IAAI;QAEjB,yBAAyB;QACzB,sBAAsB,EAAE,IAAI;QAE5B,sDAAsD;QACtD,YAAY,EAAE,eAAe;QAC7B,iBAAiB,EAAE,eAAe;KACnC,CAAC;IAEF,MAAM,MAAM,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,gHAAgH;IAChH,2BAA2B;IAC3B,MAAM,mBAAmB,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO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;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzBD,oEAyBC","sourcesContent":["import * as ng from '@angular/compiler-cli';\nimport * as path from 'path';\nimport * as ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport * as log from '../utils/log';\n\n/**\n * Reads the default TypeScript configuration.\n */\nexport function readDefaultTsConfig(fileName?: string): ng.ParsedConfiguration {\n if (!fileName) {\n fileName = path.resolve(__dirname, 'conf', 'tsconfig.ngc.json');\n }\n\n // these options are mandatory\n const extraOptions: ng.CompilerOptions = {\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n target: ts.ScriptTarget.ES2015,\n experimentalDecorators: true,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler to options\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const config = ng.readConfiguration(fileName, extraOptions);\n const options = config.options;\n\n // todo: alanagius4 - the below shouldn't be needed but it seems that setting it only in create-emit-callback.ts\n // is not working correctly\n const transformDecorators = !options.enableIvy && options.annotationsAs !== 'decorators';\n if ((options.annotateForClosureCompiler || options.annotationsAs === 'static fields') && transformDecorators) {\n // This is needed as a workaround for https://github.com/angular/tsickle/issues/635\n // Otherwise tsickle might emit references to non imported values\n // as TypeScript elided the import.\n options.emitDecoratorMetadata = true;\n }\n\n return config;\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nexport function createDefaultTsConfig(values?: ng.ParsedConfiguration | string): ng.ParsedConfiguration {\n if (!values) {\n return readDefaultTsConfig();\n } else if (typeof values === 'string') {\n return readDefaultTsConfig(values);\n } else {\n return values;\n }\n}\n\n/**\n * Initializes TypeScript Compiler options and Angular Compiler options by overriding the\n * default config with entry point-specific values.\n */\nexport const initializeTsConfig = (defaultTsConfig: ng.ParsedConfiguration, entryPoints: EntryPointNode[]) => {\n if (defaultTsConfig.errors.length > 0) {\n throw ng.formatDiagnostics(defaultTsConfig.errors);\n }\n\n entryPoints.forEach(currentEntryPoint => {\n const { entryPoint } = currentEntryPoint.data;\n log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);\n const basePath = path.dirname(entryPoint.entryFilePath);\n\n // Resolve defaults from DI token and create a deep copy of the defaults\n let tsConfig: ng.ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfig));\n\n const overrideOptions: ng.CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: basePath,\n };\n\n tsConfig.rootNames = [entryPoint.entryFilePath];\n tsConfig.options = { ...tsConfig.options, ...overrideOptions };\n currentEntryPoint.data.tsConfig = tsConfig;\n });\n};\n\n/**\n * Set the paths for entrypoint dependencies.\n *\n * This doesn't mutate the object.\n *\n * @param parsedTsConfig - A parsed tsconfig\n * @param entryPoints - A list of entryPoints\n * @param pointToSource Point the path mapping to either the source code or emitted declarations.\n * Typically for analysis one should point to the source files while for a compilation once should use the emitted declarations\n */\nexport function setDependenciesTsConfigPaths(\n parsedTsConfig: ng.ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): ng.ParsedConfiguration {\n const tsConfig = JSON.parse(JSON.stringify(parsedTsConfig));\n\n // Add paths mappings for dependencies\n if (!tsConfig.options.paths) {\n tsConfig.options.paths = {};\n }\n\n for (let dep of entryPoints) {\n const { entryPoint } = dep.data;\n const { moduleId, destinationFiles, entryFilePath } = entryPoint;\n const mappedPath = [pointToSource ? entryFilePath : destinationFiles.declarations];\n\n if (!tsConfig.options.paths[moduleId]) {\n tsConfig.options.paths[moduleId] = mappedPath;\n } else {\n tsConfig.options.paths[moduleId].unshift(...mappedPath);\n }\n }\n\n return tsConfig;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import * as ansiColors from 'ansi-colors';
2
+ declare const colors: typeof ansiColors;
3
+ export { colors };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.colors = void 0;
4
+ const ansiColors = require("ansi-colors");
5
+ const tty_1 = require("tty");
6
+ // Typings do not contain the function call (added in Node.js v9.9.0)
7
+ const supportsColor = process.stdout instanceof tty_1.WriteStream &&
8
+ process.stdout.getColorDepth() > 1;
9
+ // Create a separate instance to prevent unintended global changes to the color configuration
10
+ // Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44
11
+ const colors = ansiColors.create();
12
+ exports.colors = colors;
13
+ colors.enabled = supportsColor;
14
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","sourceRoot":"","sources":["../../../src/lib/utils/color.ts"],"names":[],"mappings":";;;AAAA,0CAA0C;AAC1C,6BAAkC;AAIlC,qEAAqE;AACrE,MAAM,aAAa,GACjB,OAAO,CAAC,MAAM,YAAY,iBAAW;IACnC,OAAO,CAAC,MAAkD,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AAEnF,6FAA6F;AAC7F,mGAAmG;AACnG,MAAM,MAAM,GAAI,UAAwD,CAAC,MAAM,EAAE,CAAC;AAGzE,wBAAM;AAFf,MAAM,CAAC,OAAO,GAAG,aAAa,CAAC","sourcesContent":["import * as ansiColors from 'ansi-colors';\nimport { WriteStream } from 'tty';\n\ntype AnsiColors = typeof ansiColors;\n\n// Typings do not contain the function call (added in Node.js v9.9.0)\nconst supportsColor =\n process.stdout instanceof WriteStream &&\n ((process.stdout as unknown) as { getColorDepth(): number }).getColorDepth() > 1;\n\n// Create a separate instance to prevent unintended global changes to the color configuration\n// Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44\nconst colors = (ansiColors as AnsiColors & { create: () => AnsiColors }).create();\ncolors.enabled = supportsColor;\n\nexport { colors };\n"]}
package/lib/utils/log.js CHANGED
@@ -1,33 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.debug = exports.msg = exports.info = exports.success = exports.warn = exports.error = void 0;
4
- const chalk = require("chalk");
4
+ const color_1 = require("./color");
5
5
  exports.error = (err) => {
6
6
  if (err instanceof Error) {
7
- console.error(chalk.red('ERROR: ' + err.message));
7
+ console.error(color_1.colors.red('ERROR: ' + err.message));
8
8
  if (process.env.DEBUG) {
9
- console.error(chalk.red(err.stack) + '\n');
9
+ console.error(color_1.colors.red(err.stack) + '\n');
10
10
  }
11
11
  }
12
12
  else {
13
- console.error(chalk.red(err));
13
+ console.error(color_1.colors.red(err));
14
14
  }
15
15
  };
16
16
  exports.warn = (msg) => {
17
- console.warn(chalk.yellow('WARNING: ' + msg));
17
+ console.warn(color_1.colors.yellow('WARNING: ' + msg));
18
18
  };
19
19
  exports.success = (msg) => {
20
- console.log(chalk.green(msg));
20
+ console.log(color_1.colors.green(msg));
21
21
  };
22
22
  exports.info = (msg) => {
23
- console.log(chalk.blue(msg));
23
+ console.log(color_1.colors.blue(msg));
24
24
  };
25
25
  exports.msg = (msg) => {
26
- console.log(chalk.white(msg));
26
+ console.log(color_1.colors.white(msg));
27
27
  };
28
28
  exports.debug = (msg) => {
29
29
  if (process.env.DEBUG) {
30
- console.log(chalk.inverse.cyan(`[debug] ${msg}`));
30
+ console.log(color_1.colors.inverse.cyan(`[debug] ${msg}`));
31
31
  }
32
32
  };
33
33
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/utils/log.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAElB,QAAA,KAAK,GAAG,CAAC,GAAmB,EAAE,EAAE;IAC3C,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAElD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;YACrB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;SAC5C;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KAC/B;AACH,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEW,QAAA,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE;IACjC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAEW,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;IACnC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;KACnD;AACH,CAAC,CAAC","sourcesContent":["import * as chalk from 'chalk';\n\nexport const error = (err: string | Error) => {\n if (err instanceof Error) {\n console.error(chalk.red('ERROR: ' + err.message));\n\n if (process.env.DEBUG) {\n console.error(chalk.red(err.stack) + '\\n');\n }\n } else {\n console.error(chalk.red(err));\n }\n};\n\nexport const warn = (msg: string) => {\n console.warn(chalk.yellow('WARNING: ' + msg));\n};\n\nexport const success = (msg: string) => {\n console.log(chalk.green(msg));\n};\n\nexport const info = (msg: string) => {\n console.log(chalk.blue(msg));\n};\n\nexport const msg = (msg: string) => {\n console.log(chalk.white(msg));\n};\n\nexport const debug = (msg: string) => {\n if (process.env.DEBUG) {\n console.log(chalk.inverse.cyan(`[debug] ${msg}`));\n }\n};\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../src/lib/utils/log.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAEpB,QAAA,KAAK,GAAG,CAAC,GAAmB,EAAE,EAAE;IAC3C,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAEnD,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;YACrB,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;SAC7C;KACF;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,cAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;KAChC;AACH,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,IAAI,CAAC,cAAM,CAAC,MAAM,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAEW,QAAA,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE;IAClC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAChC,CAAC,CAAC;AAEW,QAAA,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE;IACjC,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAEW,QAAA,KAAK,GAAG,CAAC,GAAW,EAAE,EAAE;IACnC,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,cAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,CAAC,CAAC;KACpD;AACH,CAAC,CAAC","sourcesContent":["import { colors } from './color';\n\nexport const error = (err: string | Error) => {\n if (err instanceof Error) {\n console.error(colors.red('ERROR: ' + err.message));\n\n if (process.env.DEBUG) {\n console.error(colors.red(err.stack) + '\\n');\n }\n } else {\n console.error(colors.red(err));\n }\n};\n\nexport const warn = (msg: string) => {\n console.warn(colors.yellow('WARNING: ' + msg));\n};\n\nexport const success = (msg: string) => {\n console.log(colors.green(msg));\n};\n\nexport const info = (msg: string) => {\n console.log(colors.blue(msg));\n};\n\nexport const msg = (msg: string) => {\n console.log(colors.white(msg));\n};\n\nexport const debug = (msg: string) => {\n if (process.env.DEBUG) {\n console.log(colors.inverse.cyan(`[debug] ${msg}`));\n }\n};\n"]}
package/lib/utils/path.js CHANGED
@@ -2,13 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureUnixPath = void 0;
4
4
  const nodePath = require("path");
5
+ const PATH_REGEXP = new RegExp('\\' + nodePath.win32.sep, 'g');
6
+ const ensureUnixPathCache = new Map();
5
7
  exports.ensureUnixPath = (path) => {
6
8
  if (!path) {
7
9
  return null;
8
10
  }
11
+ const cachePath = ensureUnixPathCache.get(path);
12
+ if (cachePath) {
13
+ return cachePath;
14
+ }
9
15
  // we use a regex instead of the character literal due to a bug in some versions of node.js
10
16
  // the path separator needs to be preceded by an escape character
11
- const regex = new RegExp('\\' + nodePath.win32.sep, 'g');
12
- return path.replace(regex, nodePath.posix.sep);
17
+ const normalizedPath = path.replace(PATH_REGEXP, nodePath.posix.sep);
18
+ ensureUnixPathCache.set(path, normalizedPath);
19
+ return normalizedPath;
13
20
  };
14
21
  //# sourceMappingURL=path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/lib/utils/path.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEpB,QAAA,cAAc,GAAG,CAAC,IAAa,EAAiB,EAAE;IAC7D,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,2FAA2F;IAC3F,iEAAiE;IACjE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACzD,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACjD,CAAC,CAAC","sourcesContent":["import * as nodePath from 'path';\n\nexport const ensureUnixPath = (path?: string): string | null => {\n if (!path) {\n return null;\n }\n\n // we use a regex instead of the character literal due to a bug in some versions of node.js\n // the path separator needs to be preceded by an escape character\n const regex = new RegExp('\\\\' + nodePath.win32.sep, 'g');\n return path.replace(regex, nodePath.posix.sep);\n};\n"]}
1
+ {"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/lib/utils/path.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAEjC,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC/D,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEzC,QAAA,cAAc,GAAG,CAAC,IAAa,EAAiB,EAAE;IAC7D,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,IAAI,CAAC;KACb;IAED,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChD,IAAI,SAAS,EAAE;QACb,OAAO,SAAS,CAAC;KAClB;IAED,2FAA2F;IAC3F,iEAAiE;IACjE,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,mBAAmB,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC9C,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC","sourcesContent":["import * as nodePath from 'path';\n\nconst PATH_REGEXP = new RegExp('\\\\' + nodePath.win32.sep, 'g');\nconst ensureUnixPathCache = new Map<string, string>();\n\nexport const ensureUnixPath = (path?: string): string | null => {\n if (!path) {\n return null;\n }\n\n const cachePath = ensureUnixPathCache.get(path);\n if (cachePath) {\n return cachePath;\n }\n\n // we use a regex instead of the character literal due to a bug in some versions of node.js\n // the path separator needs to be preceded by an escape character\n const normalizedPath = path.replace(PATH_REGEXP, nodePath.posix.sep);\n ensureUnixPathCache.set(path, normalizedPath);\n return normalizedPath;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "10.0.3",
3
+ "version": "10.1.2",
4
4
  "description": "Compile and package a TypeScript library to Angular Package Format",
5
5
  "keywords": [
6
6
  "angular",
@@ -27,15 +27,15 @@
27
27
  "main": "./public_api.js",
28
28
  "typings": "./public_api.d.ts",
29
29
  "dependencies": {
30
- "@rollup/plugin-commonjs": "^14.0.0",
30
+ "@rollup/plugin-commonjs": "^15.0.0",
31
31
  "@rollup/plugin-json": "^4.0.0",
32
- "@rollup/plugin-node-resolve": "^8.0.0",
32
+ "@rollup/plugin-node-resolve": "^9.0.0",
33
33
  "ajv": "^6.12.3",
34
+ "ansi-colors": "^4.1.1",
34
35
  "autoprefixer": "^9.6.5",
35
36
  "browserslist": "^4.7.0",
36
- "chalk": "^4.0.0",
37
37
  "chokidar": "^3.2.1",
38
- "commander": "^5.0.0",
38
+ "commander": "^6.0.0",
39
39
  "cssnano-preset-default": "^4.0.7",
40
40
  "fs-extra": "^9.0.0",
41
41
  "glob": "^7.1.2",
@@ -51,14 +51,13 @@
51
51
  "rxjs": "^6.5.0",
52
52
  "sass": "^1.23.0",
53
53
  "stylus": "^0.54.7",
54
- "terser": "^4.3.8",
55
- "update-notifier": "^4.0.0"
54
+ "terser": "^5.0.0"
56
55
  },
57
56
  "peerDependencies": {
58
- "@angular/compiler": "^10.0.0-rc.3",
59
- "@angular/compiler-cli": "^10.0.0-rc.3",
57
+ "@angular/compiler": "^10.0.0",
58
+ "@angular/compiler-cli": "^10.0.0",
60
59
  "tslib": "^2.0.0",
61
- "typescript": ">=3.9 < 3.10"
60
+ "typescript": ">=3.9 < 4.1"
62
61
  },
63
62
  "husky": {
64
63
  "hooks": {
package/public_api.js CHANGED
@@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
7
7
  o[k2] = m[k];
8
8
  }));
9
9
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  /**