ng-packagr 13.0.0-rc.0 → 13.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +2 -2
  2. package/cli/main.js +8 -6
  3. package/cli/main.js.map +1 -1
  4. package/lib/commands/version.command.js +1 -1
  5. package/lib/commands/version.command.js.map +1 -1
  6. package/lib/file-system/file-watcher.d.ts +5 -1
  7. package/lib/file-system/file-watcher.js +19 -8
  8. package/lib/file-system/file-watcher.js.map +1 -1
  9. package/lib/flatten/downlevel-plugin.d.ts +1 -1
  10. package/lib/flatten/downlevel-plugin.js +1 -15
  11. package/lib/flatten/downlevel-plugin.js.map +1 -1
  12. package/lib/flatten/rollup.d.ts +9 -1
  13. package/lib/flatten/rollup.js +29 -15
  14. package/lib/flatten/rollup.js.map +1 -1
  15. package/lib/graph/build-graph.d.ts +2 -0
  16. package/lib/graph/build-graph.js +4 -0
  17. package/lib/graph/build-graph.js.map +1 -1
  18. package/lib/ng-package/entry-point/write-bundles.transform.js +53 -3
  19. package/lib/ng-package/entry-point/write-bundles.transform.js.map +1 -1
  20. package/lib/ng-package/entry-point/write-package.transform.js +12 -8
  21. package/lib/ng-package/entry-point/write-package.transform.js.map +1 -1
  22. package/lib/ng-package/ngcc-cache.d.ts +2 -0
  23. package/lib/ng-package/ngcc-cache.js +11 -0
  24. package/lib/ng-package/ngcc-cache.js.map +1 -1
  25. package/lib/ng-package/nodes.d.ts +5 -0
  26. package/lib/ng-package/nodes.js +1 -0
  27. package/lib/ng-package/nodes.js.map +1 -1
  28. package/lib/ng-package/package.transform.js +3 -1
  29. package/lib/ng-package/package.transform.js.map +1 -1
  30. package/lib/styles/stylesheet-processor.js +32 -3
  31. package/lib/styles/stylesheet-processor.js.map +1 -1
  32. package/lib/ts/cache-compiler-host.js +5 -0
  33. package/lib/ts/cache-compiler-host.js.map +1 -1
  34. package/lib/ts/tsconfig.js +1 -1
  35. package/lib/ts/tsconfig.js.map +1 -1
  36. package/lib/utils/cache.d.ts +1 -1
  37. package/lib/utils/cache.js +11 -2
  38. package/lib/utils/cache.js.map +1 -1
  39. package/package.json +2 -3
package/README.md CHANGED
@@ -74,7 +74,7 @@ Create one `package.json` per npm package, run _ng-packagr_ for each!
74
74
 
75
75
  ## Features
76
76
 
77
- * :gift: Implements [Angular Package Format](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview)
77
+ * :gift: Implements [Angular Package Format](https://angular.io/guide/angular-package-format)
78
78
  * :checkered_flag: Bundles your library in FESM2020
79
79
  * :school_satchel: npm package can be consumed by [Angular CLI](https://github.com/angular/angular-cli), [Webpack](https://github.com/webpack/webpack), or [SystemJS](https://github.com/systemjs/systemjs)
80
80
  * :dancer: Creates type definitions (`.d.ts`)
@@ -100,7 +100,7 @@ Create one `package.json` per npm package, run _ng-packagr_ for each!
100
100
 
101
101
  ## Knowledge
102
102
 
103
- [Angular Package Format v12.0](https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview), design document at Google Docs
103
+ [Angular Package Format documentation](https://angular.io/guide/angular-package-format)
104
104
 
105
105
  Packaging Angular Libraries - Jason Aden at Angular Mountain View Meetup ([Jan 2018, 45min talk](https://www.youtube.com/watch?v=QfvwQEJVOig&t=3612s))
106
106
 
package/cli/main.js CHANGED
@@ -36,12 +36,14 @@ commander_1.program
36
36
  .option('-p, --project [path]', "Path to the 'ng-package.json' or 'package.json' file.", parseProjectPath, DEFAULT_PROJECT_PATH)
37
37
  .option('-c, --config [config]', 'Path to a tsconfig file.', (value) => value ? path.resolve(value) : undefined);
38
38
  commander_1.program.on('option:version', () => {
39
- void (0, public_api_1.version)().then(() => process.exit(0));
39
+ void version().then(() => process.exit(0));
40
40
  });
41
41
  commander_1.program.parse(process.argv);
42
- const { config, project, watch } = commander_1.program.opts();
43
- (0, public_api_1.execute)(public_api_1.build, { config, project, watch: !!watch }).catch(err => {
44
- (0, log_1.error)(err.message);
45
- process.exit(1);
46
- });
42
+ const { config, project, watch, version } = commander_1.program.opts();
43
+ if (!version) {
44
+ (0, public_api_1.execute)(public_api_1.build, { config, project, watch: !!watch }).catch(err => {
45
+ (0, log_1.error)(err.message);
46
+ process.exit(1);
47
+ });
48
+ }
47
49
  //# sourceMappingURL=main.js.map
package/cli/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,2CAA6B;AAC7B,0CAAyC;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,mBAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,wBAAwB,CAAC,KAAK,CAAC;KAC/B,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,mBAAO,CAAC,EAAE,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAChC,KAAK,IAAA,oBAAO,GAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC,CAAC;AAEH,mBAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,mBAAO,CAAC,IAAI,EAAE,CAAC;AAClD,IAAA,oBAAO,EAAC,kBAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IAC9D,IAAA,WAAK,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { program } from 'commander';\nimport * as path from 'path';\nimport { error } from '../lib/utils/log';\nimport { build, execute, 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\nprogram.on('option:version', () => {\n void version().then(() => process.exit(0));\n});\n\nprogram.parse(process.argv);\n\nconst { config, project, watch } = program.opts();\nexecute(build, { config, project, watch: !!watch }).catch(err => {\n error(err.message);\n process.exit(1);\n});\n"]}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,2CAA6B;AAC7B,0CAAyC;AACzC,8CAA+C;AAE/C,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAA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esContent":["#!/usr/bin/env node\n\nimport { program } from 'commander';\nimport * as path from 'path';\nimport { error } from '../lib/utils/log';\nimport { build, execute } 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\nprogram.on('option:version', () => {\n void version().then(() => process.exit(0));\n});\n\nprogram.parse(process.argv);\n\nconst { config, project, watch, version } = program.opts();\n\nif (!version) {\n execute(build, { config, project, watch: !!watch }).catch(err => {\n error(err.message);\n process.exit(1);\n });\n}\n"]}
@@ -12,7 +12,7 @@ const ng_compiler_cli_1 = require("../utils/ng-compiler-cli");
12
12
  */
13
13
  const version = async () => {
14
14
  (0, log_1.msg)(`ng-packagr: ` + require('../../package.json').version);
15
- (0, log_1.msg)(`@angular/compiler: ` + (await (0, ng_compiler_cli_1.ngCompilerCli)()).VERSION);
15
+ (0, log_1.msg)(`@angular/compiler: ` + (await (0, ng_compiler_cli_1.ngCompilerCli)()).VERSION.full);
16
16
  (0, log_1.msg)(`rollup: ` + rollup_1.VERSION);
17
17
  (0, log_1.msg)(`typescript: ` + typescript_1.version);
18
18
  };
@@ -1 +1 @@
1
- {"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../../src/lib/commands/version.command.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AACnD,2CAAmD;AACnD,sCAAmC;AACnC,8DAAyD;AAGzD;;;;GAIG;AACI,MAAM,OAAO,GAAgC,KAAK,IAAI,EAAE;IAC7D,IAAA,SAAG,EAAC,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;IACvE,IAAA,SAAG,EAAC,yBAAyB,GAAG,CAAC,MAAM,IAAA,+BAAa,GAAE,CAAC,CAAC,OAAO,CAAC,CAAC;IACjE,IAAA,SAAG,EAAC,yBAAyB,GAAG,gBAAc,CAAC,CAAC;IAChD,IAAA,SAAG,EAAC,yBAAyB,GAAG,oBAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB","sourcesContent":["import { VERSION as ROLLUP_VERSION } from 'rollup';\nimport { version as TS_VERSION } from 'typescript';\nimport { msg } from '../utils/log';\nimport { ngCompilerCli } from '../utils/ng-compiler-cli';\nimport { Command } from './command';\n\n/**\n * Prints version information.\n *\n * @stable\n */\nexport const version: Command<any, Promise<void>> = async () => {\n msg(`ng-packagr: ` + require('../../package.json').version);\n msg(`@angular/compiler: ` + (await ngCompilerCli()).VERSION);\n msg(`rollup: ` + ROLLUP_VERSION);\n msg(`typescript: ` + TS_VERSION);\n};\n"]}
1
+ {"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../../src/lib/commands/version.command.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AACnD,2CAAmD;AACnD,sCAAmC;AACnC,8DAAyD;AAGzD;;;;GAIG;AACI,MAAM,OAAO,GAAgC,KAAK,IAAI,EAAE;IAC7D,IAAA,SAAG,EAAC,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;IACvE,IAAA,SAAG,EAAC,yBAAyB,GAAG,CAAC,MAAM,IAAA,+BAAa,GAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,IAAA,SAAG,EAAC,yBAAyB,GAAG,gBAAc,CAAC,CAAC;IAChD,IAAA,SAAG,EAAC,yBAAyB,GAAG,oBAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB","sourcesContent":["import { VERSION as ROLLUP_VERSION } from 'rollup';\nimport { version as TS_VERSION } from 'typescript';\nimport { msg } from '../utils/log';\nimport { ngCompilerCli } from '../utils/ng-compiler-cli';\nimport { Command } from './command';\n\n/**\n * Prints version information.\n *\n * @stable\n */\nexport const version: Command<any, Promise<void>> = async () => {\n msg(`ng-packagr: ` + require('../../package.json').version);\n msg(`@angular/compiler: ` + (await ngCompilerCli()).VERSION.full);\n msg(`rollup: ` + ROLLUP_VERSION);\n msg(`typescript: ` + TS_VERSION);\n};\n"]}
@@ -1,3 +1,4 @@
1
+ import * as chokidar from 'chokidar';
1
2
  import { Observable } from 'rxjs';
2
3
  declare type AllFileWatchEvents = 'change' | 'unlink' | 'add' | 'unlinkDir' | 'addDir';
3
4
  export declare type FileWatchEvent = Exclude<AllFileWatchEvents, 'unlinkDir' | 'addDir'>;
@@ -5,5 +6,8 @@ export interface FileChangedEvent {
5
6
  filePath: string;
6
7
  event: FileWatchEvent;
7
8
  }
8
- export declare function createFileWatch(projectPath: string, ignoredPaths?: (RegExp | string)[]): Observable<FileChangedEvent>;
9
+ export declare function createFileWatch(basePaths: string | string[], ignoredPaths?: (RegExp | string)[]): {
10
+ watcher: chokidar.FSWatcher;
11
+ onFileChange: Observable<FileChangedEvent>;
12
+ };
9
13
  export {};
@@ -21,19 +21,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.createFileWatch = void 0;
23
23
  const chokidar = __importStar(require("chokidar"));
24
+ const os_1 = require("os");
24
25
  const path = __importStar(require("path"));
25
26
  const rxjs_1 = require("rxjs");
26
27
  const log = __importStar(require("../utils/log"));
27
28
  const path_1 = require("../utils/path");
28
- function createFileWatch(projectPath, ignoredPaths = []) {
29
- log.debug(`Watching for changes: projectPath: ${projectPath}, ignoredPaths: ${ignoredPaths}`);
30
- const watch = chokidar.watch(projectPath, {
29
+ function createFileWatch(basePaths, ignoredPaths = []) {
30
+ log.debug(`Watching for changes: basePath: ${basePaths}, ignoredPaths: ${ignoredPaths}`);
31
+ const watch = chokidar.watch([], {
31
32
  ignoreInitial: true,
32
- ignored: [...ignoredPaths, /((^[/\\])\..)|(\.mjs$)|(\.map$)|(\.metadata\.json|node_modules)/],
33
+ ignored: [...ignoredPaths, /\.map$/],
33
34
  persistent: true,
34
35
  });
36
+ const isLinux = (0, os_1.platform)() === 'linux';
35
37
  const handleFileChange = (event, filePath, observer) => {
36
38
  log.debug(`Watch: Path changed. Event: ${event}, Path: ${filePath}`);
39
+ if (isLinux) {
40
+ // Workaround for Linux where chokidar will not handle future events
41
+ // for files that were unlinked and immediately recreated.
42
+ watch.unwatch(filePath);
43
+ watch.add(filePath);
44
+ }
37
45
  if (event === 'unlinkDir' || event === 'addDir') {
38
46
  // we don't need to trigger on directory removed or renamed as chokidar will fire the changes for each file
39
47
  return;
@@ -43,10 +51,13 @@ function createFileWatch(projectPath, ignoredPaths = []) {
43
51
  event,
44
52
  });
45
53
  };
46
- return rxjs_1.Observable.create((observer) => {
47
- watch.on('all', (event, filePath) => handleFileChange(event, filePath, observer));
48
- return () => watch.close();
49
- });
54
+ return {
55
+ watcher: watch,
56
+ onFileChange: new rxjs_1.Observable(observer => {
57
+ watch.on('all', (event, filePath) => handleFileChange(event, filePath, observer));
58
+ return () => watch.close();
59
+ }),
60
+ };
50
61
  }
51
62
  exports.createFileWatch = createFileWatch;
52
63
  //# sourceMappingURL=file-watcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../../src/lib/file-system/file-watcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AACrC,2CAA6B;AAC7B,+BAA4C;AAC5C,kDAAoC;AACpC,wCAA+C;AAU/C,SAAgB,eAAe,CAC7B,WAAmB,EACnB,eAAoC,EAAE;IAEtC,GAAG,CAAC,KAAK,CAAC,sCAAsC,WAAW,mBAAmB,YAAY,EAAE,CAAC,CAAC;IAE9F,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,EAAE;QACxC,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,CAAC,GAAG,YAAY,EAAE,iEAAiE,CAAC;QAC7F,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,CAAC,KAAyB,EAAE,QAAgB,EAAE,QAAoC,EAAE,EAAE;QAC7G,GAAG,CAAC,KAAK,CAAC,+BAA+B,KAAK,WAAW,QAAQ,EAAE,CAAC,CAAC;QAErE,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC/C,2GAA2G;YAC3G,OAAO;SACR;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,IAAA,qBAAc,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChD,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,iBAAU,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAyB,EAAE,QAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE9G,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AA/BD,0CA+BC","sourcesContent":["import * as chokidar from 'chokidar';\nimport * as path from 'path';\nimport { Observable, Observer } from 'rxjs';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\ntype AllFileWatchEvents = 'change' | 'unlink' | 'add' | 'unlinkDir' | 'addDir';\nexport type FileWatchEvent = Exclude<AllFileWatchEvents, 'unlinkDir' | 'addDir'>;\n\nexport interface FileChangedEvent {\n filePath: string;\n event: FileWatchEvent;\n}\n\nexport function createFileWatch(\n projectPath: string,\n ignoredPaths: (RegExp | string)[] = [],\n): Observable<FileChangedEvent> {\n log.debug(`Watching for changes: projectPath: ${projectPath}, ignoredPaths: ${ignoredPaths}`);\n\n const watch = chokidar.watch(projectPath, {\n ignoreInitial: true,\n ignored: [...ignoredPaths, /((^[/\\\\])\\..)|(\\.mjs$)|(\\.map$)|(\\.metadata\\.json|node_modules)/],\n persistent: true,\n });\n\n const handleFileChange = (event: AllFileWatchEvents, filePath: string, observer: Observer<FileChangedEvent>) => {\n log.debug(`Watch: Path changed. Event: ${event}, Path: ${filePath}`);\n\n if (event === 'unlinkDir' || event === 'addDir') {\n // we don't need to trigger on directory removed or renamed as chokidar will fire the changes for each file\n return;\n }\n\n observer.next({\n filePath: ensureUnixPath(path.resolve(filePath)),\n event,\n });\n };\n\n return Observable.create((observer) => {\n watch.on('all', (event: AllFileWatchEvents, filePath: string) => handleFileChange(event, filePath, observer));\n\n return () => watch.close();\n });\n}\n"]}
1
+ {"version":3,"file":"file-watcher.js","sourceRoot":"","sources":["../../../src/lib/file-system/file-watcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAqC;AACrC,2BAA8B;AAC9B,2CAA6B;AAC7B,+BAA4C;AAC5C,kDAAoC;AACpC,wCAA+C;AAU/C,SAAgB,eAAe,CAC7B,SAA4B,EAC5B,eAAoC,EAAE;IAKtC,GAAG,CAAC,KAAK,CAAC,mCAAmC,SAAS,mBAAmB,YAAY,EAAE,CAAC,CAAC;IAEzF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE;QAC/B,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE,CAAC,GAAG,YAAY,EAAE,QAAQ,CAAC;QACpC,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,IAAA,aAAQ,GAAE,KAAK,OAAO,CAAC;IACvC,MAAM,gBAAgB,GAAG,CAAC,KAAyB,EAAE,QAAgB,EAAE,QAAoC,EAAE,EAAE;QAC7G,GAAG,CAAC,KAAK,CAAC,+BAA+B,KAAK,WAAW,QAAQ,EAAE,CAAC,CAAC;QAErE,IAAI,OAAO,EAAE;YACX,oEAAoE;YACpE,0DAA0D;YAC1D,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;SACrB;QAED,IAAI,KAAK,KAAK,WAAW,IAAI,KAAK,KAAK,QAAQ,EAAE;YAC/C,2GAA2G;YAC3G,OAAO;SACR;QAED,QAAQ,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,IAAA,qBAAc,EAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChD,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,KAAK;QACd,YAAY,EAAE,IAAI,iBAAU,CAAC,QAAQ,CAAC,EAAE;YACtC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAyB,EAAE,QAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YAE9G,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AA7CD,0CA6CC","sourcesContent":["import * as chokidar from 'chokidar';\nimport { platform } from 'os';\nimport * as path from 'path';\nimport { Observable, Observer } from 'rxjs';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\ntype AllFileWatchEvents = 'change' | 'unlink' | 'add' | 'unlinkDir' | 'addDir';\nexport type FileWatchEvent = Exclude<AllFileWatchEvents, 'unlinkDir' | 'addDir'>;\n\nexport interface FileChangedEvent {\n filePath: string;\n event: FileWatchEvent;\n}\n\nexport function createFileWatch(\n basePaths: string | string[],\n ignoredPaths: (RegExp | string)[] = [],\n): {\n watcher: chokidar.FSWatcher;\n onFileChange: Observable<FileChangedEvent>;\n} {\n log.debug(`Watching for changes: basePath: ${basePaths}, ignoredPaths: ${ignoredPaths}`);\n\n const watch = chokidar.watch([], {\n ignoreInitial: true,\n ignored: [...ignoredPaths, /\\.map$/],\n persistent: true,\n });\n\n const isLinux = platform() === 'linux';\n const handleFileChange = (event: AllFileWatchEvents, filePath: string, observer: Observer<FileChangedEvent>) => {\n log.debug(`Watch: Path changed. Event: ${event}, Path: ${filePath}`);\n\n if (isLinux) {\n // Workaround for Linux where chokidar will not handle future events\n // for files that were unlinked and immediately recreated.\n watch.unwatch(filePath);\n watch.add(filePath);\n }\n\n if (event === 'unlinkDir' || event === 'addDir') {\n // we don't need to trigger on directory removed or renamed as chokidar will fire the changes for each file\n return;\n }\n\n observer.next({\n filePath: ensureUnixPath(path.resolve(filePath)),\n event,\n });\n };\n\n return {\n watcher: watch,\n onFileChange: new Observable(observer => {\n watch.on('all', (event: AllFileWatchEvents, filePath: string) => handleFileChange(event, filePath, observer));\n\n return () => watch.close();\n }),\n };\n}\n"]}
@@ -2,4 +2,4 @@ import { TransformResult } from 'rollup';
2
2
  /**
3
3
  * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.
4
4
  */
5
- export declare function downlevelCodeWithTsc(code: string, filePath: string, cacheDirectory?: false | string): Promise<TransformResult>;
5
+ export declare function downlevelCodeWithTsc(code: string, filePath: string): Promise<TransformResult>;
@@ -22,7 +22,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.downlevelCodeWithTsc = void 0;
23
23
  const path = __importStar(require("path"));
24
24
  const typescript_1 = require("typescript");
25
- const cache_1 = require("../utils/cache");
26
25
  const log = __importStar(require("../utils/log"));
27
26
  /**
28
27
  * Base `tsc` `CompilerOptions` shared among various downleveling methods.
@@ -39,15 +38,8 @@ const COMPILER_OPTIONS = {
39
38
  /**
40
39
  * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.
41
40
  */
42
- async function downlevelCodeWithTsc(code, filePath, cacheDirectory) {
41
+ async function downlevelCodeWithTsc(code, filePath) {
43
42
  log.debug(`tsc ${filePath}`);
44
- const key = (0, cache_1.generateKey)(code);
45
- if (cacheDirectory) {
46
- const result = await (0, cache_1.readCacheEntry)(cacheDirectory, key);
47
- if (result) {
48
- return result;
49
- }
50
- }
51
43
  const compilerOptions = {
52
44
  ...COMPILER_OPTIONS,
53
45
  mapRoot: path.dirname(filePath),
@@ -55,12 +47,6 @@ async function downlevelCodeWithTsc(code, filePath, cacheDirectory) {
55
47
  const { outputText, sourceMapText } = (0, typescript_1.transpileModule)(code, {
56
48
  compilerOptions,
57
49
  });
58
- if (cacheDirectory) {
59
- await (0, cache_1.saveCacheEntry)(cacheDirectory, key, JSON.stringify({
60
- code: outputText,
61
- map: sourceMapText,
62
- }));
63
- }
64
50
  return {
65
51
  code: outputText,
66
52
  map: JSON.parse(sourceMapText),
@@ -1 +1 @@
1
- {"version":3,"file":"downlevel-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/downlevel-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,2CAA8G;AAE9G,0CAA6E;AAC7E,kDAAoC;AAEpC;;GAEG;AACH,MAAM,gBAAgB,GAAoB;IACxC,MAAM,EAAE,yBAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,uBAAU,CAAC,MAAM;IACzB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,iCAAoB,CAAC,OAAO;CAC/C,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,oBAAoB,CACxC,IAAY,EACZ,QAAgB,EAChB,cAA+B;IAE/B,GAAG,CAAC,KAAK,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;IAE7B,MAAM,GAAG,GAAG,IAAA,mBAAW,EAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,cAAc,EAAE;QAClB,MAAM,MAAM,GAAG,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,CAAC,CAAC;QACzD,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAC;SACf;KACF;IAED,MAAM,eAAe,GAAoB;QACvC,GAAG,gBAAgB;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;KAChC,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE;QAC1D,eAAe;KAChB,CAAC,CAAC;IAEH,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAClB,cAAc,EACd,GAAG,EACH,IAAI,CAAC,SAAS,CAAC;YACb,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,aAAa;SACnB,CAAC,CACH,CAAC;KACH;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;KAC/B,CAAC;AACJ,CAAC;AAvCD,oDAuCC","sourcesContent":["import * as path from 'path';\nimport { TransformResult } from 'rollup';\nimport { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, transpileModule } from 'typescript';\n\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\n\n/**\n * Base `tsc` `CompilerOptions` shared among various downleveling methods.\n */\nconst COMPILER_OPTIONS: CompilerOptions = {\n target: ScriptTarget.ES2015,\n module: ModuleKind.ESNext,\n allowJs: true,\n sourceMap: true,\n importHelpers: true,\n downlevelIteration: true,\n moduleResolution: ModuleResolutionKind.Classic,\n};\n\n/**\n * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.\n */\nexport async function downlevelCodeWithTsc(\n code: string,\n filePath: string,\n cacheDirectory?: false | string,\n): Promise<TransformResult> {\n log.debug(`tsc ${filePath}`);\n\n const key = generateKey(code);\n if (cacheDirectory) {\n const result = await readCacheEntry(cacheDirectory, key);\n if (result) {\n return result;\n }\n }\n\n const compilerOptions: CompilerOptions = {\n ...COMPILER_OPTIONS,\n mapRoot: path.dirname(filePath),\n };\n\n const { outputText, sourceMapText } = transpileModule(code, {\n compilerOptions,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(\n cacheDirectory,\n key,\n JSON.stringify({\n code: outputText,\n map: sourceMapText,\n }),\n );\n }\n\n return {\n code: outputText,\n map: JSON.parse(sourceMapText),\n };\n}\n"]}
1
+ {"version":3,"file":"downlevel-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/downlevel-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,2CAA8G;AAE9G,kDAAoC;AAEpC;;GAEG;AACH,MAAM,gBAAgB,GAAoB;IACxC,MAAM,EAAE,yBAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,uBAAU,CAAC,MAAM;IACzB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,iCAAoB,CAAC,OAAO;CAC/C,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,oBAAoB,CAAC,IAAY,EAAE,QAAgB;IACvE,GAAG,CAAC,KAAK,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;IAC7B,MAAM,eAAe,GAAoB;QACvC,GAAG,gBAAgB;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;KAChC,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE;QAC1D,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;KAC/B,CAAC;AACJ,CAAC;AAfD,oDAeC","sourcesContent":["import * as path from 'path';\nimport { TransformResult } from 'rollup';\nimport { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, transpileModule } from 'typescript';\n\nimport * as log from '../utils/log';\n\n/**\n * Base `tsc` `CompilerOptions` shared among various downleveling methods.\n */\nconst COMPILER_OPTIONS: CompilerOptions = {\n target: ScriptTarget.ES2015,\n module: ModuleKind.ESNext,\n allowJs: true,\n sourceMap: true,\n importHelpers: true,\n downlevelIteration: true,\n moduleResolution: ModuleResolutionKind.Classic,\n};\n\n/**\n * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.\n */\nexport async function downlevelCodeWithTsc(code: string, filePath: string): Promise<TransformResult> {\n log.debug(`tsc ${filePath}`);\n const compilerOptions: CompilerOptions = {\n ...COMPILER_OPTIONS,\n mapRoot: path.dirname(filePath),\n };\n\n const { outputText, sourceMapText } = transpileModule(code, {\n compilerOptions,\n });\n\n return {\n code: outputText,\n map: JSON.parse(sourceMapText),\n };\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import * as rollup from 'rollup';
2
2
  import { TransformHook } from 'rollup';
3
+ import { OutputFileCache } from '../ng-package/nodes';
3
4
  /**
4
5
  * Options used in `ng-packagr` for writing flat bundle files.
5
6
  *
@@ -12,6 +13,13 @@ export interface RollupOptions {
12
13
  sourceRoot: string;
13
14
  transform?: TransformHook;
14
15
  cache?: rollup.RollupCache;
16
+ cacheDirectory?: string | false;
17
+ fileCache: OutputFileCache;
18
+ cacheKey: string;
15
19
  }
16
20
  /** Runs rollup over the given entry file, writes a bundle file. */
17
- export declare function rollupBundleFile(opts: RollupOptions): Promise<rollup.RollupCache>;
21
+ export declare function rollupBundleFile(opts: RollupOptions): Promise<{
22
+ cache: rollup.RollupCache;
23
+ code: string;
24
+ map: rollup.SourceMap;
25
+ }>;
@@ -23,39 +23,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  exports.rollupBundleFile = void 0;
26
- const plugin_commonjs_1 = __importDefault(require("@rollup/plugin-commonjs"));
27
26
  const plugin_json_1 = __importDefault(require("@rollup/plugin-json"));
28
27
  const plugin_node_resolve_1 = __importDefault(require("@rollup/plugin-node-resolve"));
29
28
  const path = __importStar(require("path"));
30
29
  const rollup = __importStar(require("rollup"));
31
30
  const rollup_plugin_sourcemaps_1 = __importDefault(require("rollup-plugin-sourcemaps"));
31
+ const cache_1 = require("../utils/cache");
32
32
  const log = __importStar(require("../utils/log"));
33
+ const path_1 = require("../utils/path");
33
34
  /** Runs rollup over the given entry file, writes a bundle file. */
34
35
  async function rollupBundleFile(opts) {
36
+ var _a;
35
37
  log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);
38
+ const cacheDirectory = opts.cacheDirectory;
36
39
  // Create the bundle
37
40
  const bundle = await rollup.rollup({
38
41
  context: 'this',
39
42
  external: moduleId => isExternalDependency(moduleId),
40
43
  inlineDynamicImports: false,
41
- cache: opts.cache,
44
+ cache: (_a = opts.cache) !== null && _a !== void 0 ? _a : (cacheDirectory ? await (0, cache_1.readCacheEntry)(cacheDirectory, opts.cacheKey) : undefined),
42
45
  input: opts.entry,
43
46
  plugins: [
44
- (0, plugin_json_1.default)(),
45
47
  (0, plugin_node_resolve_1.default)(),
46
- (0, plugin_commonjs_1.default)(),
47
- (0, rollup_plugin_sourcemaps_1.default)(),
48
+ (0, rollup_plugin_sourcemaps_1.default)({
49
+ readFile: (path, callback) => {
50
+ const fileData = opts.fileCache.get((0, path_1.ensureUnixPath)(path));
51
+ callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData === null || fileData === void 0 ? void 0 : fileData.content);
52
+ },
53
+ }),
54
+ (0, plugin_json_1.default)(),
48
55
  opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,
49
56
  ],
50
57
  onwarn: warning => {
51
- if (typeof warning === 'string') {
52
- log.warn(warning);
53
- }
54
- else {
55
- if (warning.code === 'THIS_IS_UNDEFINED') {
56
- return;
57
- }
58
- log.warn(warning.message);
58
+ switch (warning.code) {
59
+ case 'UNUSED_EXTERNAL_IMPORT':
60
+ case 'THIS_IS_UNDEFINED':
61
+ break;
62
+ default:
63
+ log.warn(warning.message);
64
+ break;
59
65
  }
60
66
  },
61
67
  preserveSymlinks: true,
@@ -64,14 +70,22 @@ async function rollupBundleFile(opts) {
64
70
  treeshake: false,
65
71
  });
66
72
  // Output the bundle to disk
67
- await bundle.write({
73
+ const output = await bundle.write({
68
74
  name: opts.moduleName,
69
75
  format: 'es',
70
76
  file: opts.dest,
71
77
  banner: '',
72
78
  sourcemap: true,
73
79
  });
74
- return bundle.cache;
80
+ if (cacheDirectory) {
81
+ await (0, cache_1.saveCacheEntry)(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));
82
+ }
83
+ const { code, map } = output.output[0];
84
+ return {
85
+ code,
86
+ map,
87
+ cache: bundle.cache,
88
+ };
75
89
  }
76
90
  exports.rollupBundleFile = rollupBundleFile;
77
91
  function isExternalDependency(moduleId) {
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/flatten/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAA+C;AAC/C,sEAA6C;AAC7C,sFAAsD;AACtD,2CAA6B;AAC7B,+CAAiC;AAEjC,wFAAkD;AAClD,kDAAoC;AAgBpC,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CAAC,IAAmB;IACxD,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvE,oBAAoB;IACpB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;QACjC,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC;QACpD,oBAAoB,EAAE,KAAK;QAC3B,KAAK,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AAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import commonJs from '@rollup/plugin-commonjs';\nimport rollupJson from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport * as path from 'path';\nimport * as rollup from 'rollup';\nimport { TransformHook } from 'rollup';\nimport sourcemaps from 'rollup-plugin-sourcemaps';\nimport * as log from '../utils/log';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface RollupOptions {\n moduleName: string;\n entry: string;\n dest: string;\n sourceRoot: string;\n transform?: TransformHook;\n cache?: rollup.RollupCache;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(opts: RollupOptions): Promise<rollup.RollupCache> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache,\n input: opts.entry,\n plugins: [\n rollupJson(),\n nodeResolve(),\n commonJs(),\n sourcemaps(),\n opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,\n ],\n onwarn: warning => {\n if (typeof warning === 'string') {\n log.warn(warning);\n } else {\n if (warning.code === 'THIS_IS_UNDEFINED') {\n return;\n }\n\n log.warn(warning.message);\n }\n },\n preserveSymlinks: true,\n // Disable treeshaking when generating bundles\n // see: https://github.com/angular/angular/pull/32069\n treeshake: false,\n });\n\n // Output the bundle to disk\n await bundle.write({\n name: opts.moduleName,\n format: 'es',\n file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n return bundle.cache;\n}\n\nfunction 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 (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bund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AAyF;IACzF,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACrF,yGAAyG;QACzG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import rollupJson from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport * as path from 'path';\nimport * as rollup from 'rollup';\nimport { TransformHook } from 'rollup';\nimport sourcemaps from 'rollup-plugin-sourcemaps';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface RollupOptions {\n moduleName: string;\n entry: string;\n dest: string;\n sourceRoot: string;\n transform?: TransformHook;\n cache?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; code: string; map: rollup.SourceMap }> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n const cacheDirectory = opts.cacheDirectory;\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [\n nodeResolve(),\n sourcemaps({\n readFile: (path: string, callback: (error: Error | null, data: Buffer | string) => void) => {\n const fileData = opts.fileCache.get(ensureUnixPath(path));\n callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData?.content);\n },\n }),\n rollupJson(),\n opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,\n ],\n onwarn: warning => {\n switch (warning.code) {\n case 'UNUSED_EXTERNAL_IMPORT':\n case 'THIS_IS_UNDEFINED':\n break;\n\n default:\n log.warn(warning.message);\n break;\n }\n },\n preserveSymlinks: true,\n // Disable treeshaking when generating bundles\n // see: https://github.com/angular/angular/pull/32069\n treeshake: false,\n });\n\n // Output the bundle to disk\n const output = await bundle.write({\n name: opts.moduleName,\n format: 'es',\n file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n const { code, map } = output.output[0];\n\n return {\n code,\n map,\n cache: bundle.cache,\n };\n}\n\nfunction 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 (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\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 return true;\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { FSWatcher } from 'chokidar';
1
2
  import { Node } from './node';
2
3
  export declare type SimplePredicate<T = Node> = {
3
4
  (value: T, index: number): boolean;
@@ -18,6 +19,7 @@ export interface Traversable<T> {
18
19
  */
19
20
  export declare class BuildGraph implements Traversable<Node> {
20
21
  private store;
22
+ watcher?: FSWatcher;
21
23
  put(value: Node | Node[]): this;
22
24
  private insert;
23
25
  get(url: string): Node;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BuildGraph = void 0;
4
+ const nodes_1 = require("../ng-package/nodes");
4
5
  /**
5
6
  * A tree of source files. Eventually, it's a graph. Ideally, it's an acyclic directed graph.
6
7
  * Technically, it's implemented as a map-like collection with references between map entries.
@@ -24,6 +25,9 @@ class BuildGraph {
24
25
  const oldNode = this.store.get(node.url);
25
26
  oldNode['_dependees'].delete(oldNode);
26
27
  }
28
+ if (this.watcher && node.url.startsWith(nodes_1.URL_PROTOCOL_FILE)) {
29
+ this.watcher.add(node.url.substr(nodes_1.URL_PROTOCOL_FILE.length));
30
+ }
27
31
  this.store.set(node.url, node);
28
32
  }
29
33
  get(url) {
@@ -1 +1 @@
1
- {"version":3,"file":"build-graph.js","sourceRoot":"","sources":["../../../src/lib/graph/build-graph.ts"],"names":[],"mappings":";;;AAoBA;;;GAGG;AACH,MAAa,UAAU;IAAvB;QACU,UAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;IAmD1C,CAAC;IAjDQ,GAAG,CAAC,KAAoB;QAC7B,IAAI,KAAK,YAAY,KAAK,EAAE;YAC1B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1C;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACpB;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,MAAM,CAAC,IAAU;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC5B,+BAA+B;YAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SACvC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,GAAW;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,GAAW;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAEnC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAEM,IAAI,CAAC,EAAmB;QAC7B,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAwB,EAA6B;QAChE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAQ,CAAC;IAC1C,CAAC;IAEM,IAAI,CAAwB,EAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAkB,CAAC;IAClD,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF;AApDD,gCAoDC","sourcesContent":["import { Node } from './node';\n\nexport type SimplePredicate<T = Node> = {\n (value: T, index: number): boolean;\n and?: (criteria: SimplePredicate<T>) => SimplePredicate<T>;\n};\n\nexport type ComplexPredicate<T = Node, R extends T = T> =\n | SimplePredicate<T>\n | {\n (value: T, index: number): value is R;\n and?: (criteria: ComplexPredicate<T, R>) => ComplexPredicate<T, R>;\n };\n\nexport interface Traversable<T> {\n filter<R extends T = T>(by: ComplexPredicate<T, R>): R[];\n find<R extends T = T>(by: ComplexPredicate<T, R>): R | undefined;\n some(by: SimplePredicate<T>): boolean;\n}\n\n/**\n * A tree of source files. Eventually, it's a graph. Ideally, it's an acyclic directed graph.\n * Technically, it's implemented as a map-like collection with references between map entries.\n */\nexport class BuildGraph implements Traversable<Node> {\n private store = new Map<string, Node>();\n\n public put(value: Node | Node[]) {\n if (value instanceof Array) {\n value.forEach(node => this.insert(node));\n } else {\n this.insert(value);\n }\n\n return this;\n }\n\n private insert(node: Node) {\n if (this.store.has(node.url)) {\n // Clean up dependee references\n const oldNode = this.store.get(node.url);\n oldNode['_dependees'].delete(oldNode);\n }\n\n this.store.set(node.url, node);\n }\n\n public get(url: string): Node {\n return this.store.get(url);\n }\n\n public has(url: string): boolean {\n return this.store.has(url);\n }\n\n public entries(): Node[] {\n const values = this.store.values();\n\n return Array.from(values);\n }\n\n public some(by: SimplePredicate): boolean {\n return this.entries().some(by);\n }\n\n public filter<T extends Node = Node>(by: ComplexPredicate<Node, T>): T[] {\n return this.entries().filter(by) as T[];\n }\n\n public find<T extends Node = Node>(by: ComplexPredicate<Node, T>): T | undefined {\n return this.entries().find(by) as T | undefined;\n }\n\n get size(): number {\n return this.store.size;\n }\n}\n"]}
1
+ {"version":3,"file":"build-graph.js","sourceRoot":"","sources":["../../../src/lib/graph/build-graph.ts"],"names":[],"mappings":";;;AACA,+CAAwD;AAqBxD;;;GAGG;AACH,MAAa,UAAU;IAAvB;QACU,UAAK,GAAG,IAAI,GAAG,EAAgB,CAAC;IAwD1C,CAAC;IArDQ,GAAG,CAAC,KAAoB;QAC7B,IAAI,KAAK,YAAY,KAAK,EAAE;YAC1B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;SAC1C;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACpB;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,MAAM,CAAC,IAAU;QACvB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC5B,+BAA+B;YAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;SACvC;QAED,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,yBAAiB,CAAC,EAAE;YAC1D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,yBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;SAC7D;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEM,GAAG,CAAC,GAAW;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,GAAG,CAAC,GAAW;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAEM,OAAO;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAEnC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IAEM,IAAI,CAAC,EAAmB;QAC7B,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAEM,MAAM,CAAwB,EAA6B;QAChE,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAQ,CAAC;IAC1C,CAAC;IAEM,IAAI,CAAwB,EAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAkB,CAAC;IAClD,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF;AAzDD,gCAyDC","sourcesContent":["import { FSWatcher } from 'chokidar';\nimport { URL_PROTOCOL_FILE } from '../ng-package/nodes';\nimport { Node } from './node';\n\nexport type SimplePredicate<T = Node> = {\n (value: T, index: number): boolean;\n and?: (criteria: SimplePredicate<T>) => SimplePredicate<T>;\n};\n\nexport type ComplexPredicate<T = Node, R extends T = T> =\n | SimplePredicate<T>\n | {\n (value: T, index: number): value is R;\n and?: (criteria: ComplexPredicate<T, R>) => ComplexPredicate<T, R>;\n };\n\nexport interface Traversable<T> {\n filter<R extends T = T>(by: ComplexPredicate<T, R>): R[];\n find<R extends T = T>(by: ComplexPredicate<T, R>): R | undefined;\n some(by: SimplePredicate<T>): boolean;\n}\n\n/**\n * A tree of source files. Eventually, it's a graph. Ideally, it's an acyclic directed graph.\n * Technically, it's implemented as a map-like collection with references between map entries.\n */\nexport class BuildGraph implements Traversable<Node> {\n private store = new Map<string, Node>();\n watcher?: FSWatcher;\n\n public put(value: Node | Node[]) {\n if (value instanceof Array) {\n value.forEach(node => this.insert(node));\n } else {\n this.insert(value);\n }\n\n return this;\n }\n\n private insert(node: Node) {\n if (this.store.has(node.url)) {\n // Clean up dependee references\n const oldNode = this.store.get(node.url);\n oldNode['_dependees'].delete(oldNode);\n }\n\n if (this.watcher && node.url.startsWith(URL_PROTOCOL_FILE)) {\n this.watcher.add(node.url.substr(URL_PROTOCOL_FILE.length));\n }\n\n this.store.set(node.url, node);\n }\n\n public get(url: string): Node {\n return this.store.get(url);\n }\n\n public has(url: string): boolean {\n return this.store.has(url);\n }\n\n public entries(): Node[] {\n const values = this.store.values();\n\n return Array.from(values);\n }\n\n public some(by: SimplePredicate): boolean {\n return this.entries().some(by);\n }\n\n public filter<T extends Node = Node>(by: ComplexPredicate<Node, T>): T[] {\n return this.entries().filter(by) as T[];\n }\n\n public find<T extends Node = Node>(by: ComplexPredicate<Node, T>): T | undefined {\n return this.entries().find(by) as T | undefined;\n }\n\n get size(): number {\n return this.store.size;\n }\n}\n"]}
@@ -5,9 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.writeBundlesTransform = void 0;
7
7
  const ora_1 = __importDefault(require("ora"));
8
+ const path_1 = require("path");
8
9
  const downlevel_plugin_1 = require("../../flatten/downlevel-plugin");
9
10
  const rollup_1 = require("../../flatten/rollup");
10
11
  const transform_1 = require("../../graph/transform");
12
+ const cache_1 = require("../../utils/cache");
13
+ const fs_1 = require("../../utils/fs");
11
14
  const nodes_1 = require("../nodes");
12
15
  const writeBundlesTransform = (options) => (0, transform_1.transformFromPromise)(async (graph) => {
13
16
  const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
@@ -18,15 +21,52 @@ const writeBundlesTransform = (options) => (0, transform_1.transformFromPromise)
18
21
  hideCursor: false,
19
22
  discardStdin: false,
20
23
  });
24
+ const key = await (0, cache_1.generateKey)(ngEntryPoint.moduleId, esm2020, 'fesm-bundles', tsConfig.options.compilationMode);
25
+ const hash = await (0, cache_1.generateKey)(...[...cache.outputCache.values()].map(({ version }) => version));
26
+ const cacheDirectory = options.cacheEnabled && options.cacheDirectory;
27
+ if (cacheDirectory) {
28
+ const cacheResult = await (0, cache_1.readCacheEntry)(options.cacheDirectory, key);
29
+ if ((cacheResult === null || cacheResult === void 0 ? void 0 : cacheResult.hash) === hash) {
30
+ try {
31
+ spinner.start('Writing FESM bundles');
32
+ await Promise.all([
33
+ (0, fs_1.mkdir)((0, path_1.dirname)(fesm2020), { recursive: true }),
34
+ (0, fs_1.mkdir)((0, path_1.dirname)(fesm2015), { recursive: true }),
35
+ ]);
36
+ await Promise.all([
37
+ (0, fs_1.writeFile)(fesm2020, cacheResult.fesm2020.code),
38
+ (0, fs_1.writeFile)(`${fesm2020}.map`, JSON.stringify(cacheResult.fesm2020.map)),
39
+ (0, fs_1.writeFile)(fesm2015, cacheResult.fesm2015.code),
40
+ (0, fs_1.writeFile)(`${fesm2015}.map`, JSON.stringify(cacheResult.fesm2015.map)),
41
+ ]);
42
+ spinner.succeed('Writing FESM bundles');
43
+ }
44
+ catch (error) {
45
+ spinner.fail();
46
+ throw error;
47
+ }
48
+ return;
49
+ }
50
+ }
51
+ const fesmCache = {
52
+ hash,
53
+ };
21
54
  try {
22
55
  spinner.start('Generating FESM2020');
23
- const rollupFESMCache = await (0, rollup_1.rollupBundleFile)({
56
+ const { cache: rollupFESMCache, code, map, } = await (0, rollup_1.rollupBundleFile)({
24
57
  sourceRoot: tsConfig.options.sourceRoot,
25
58
  entry: esm2020,
26
59
  moduleName: ngEntryPoint.moduleId,
27
60
  dest: fesm2020,
28
61
  cache: cache.rollupFESM2020Cache,
62
+ cacheDirectory,
63
+ fileCache: cache.outputCache,
64
+ cacheKey: await (0, cache_1.generateKey)(esm2020, ngEntryPoint.moduleId, fesm2020, tsConfig.options.compilationMode),
29
65
  });
66
+ fesmCache.fesm2020 = {
67
+ code,
68
+ map,
69
+ };
30
70
  spinner.succeed();
31
71
  if (options.watch) {
32
72
  cache.rollupFESM2020Cache = rollupFESMCache;
@@ -38,14 +78,21 @@ const writeBundlesTransform = (options) => (0, transform_1.transformFromPromise)
38
78
  }
39
79
  try {
40
80
  spinner.start('Generating FESM2015');
41
- const rollupFESMCache = await (0, rollup_1.rollupBundleFile)({
81
+ const { cache: rollupFESMCache, code, map, } = await (0, rollup_1.rollupBundleFile)({
42
82
  sourceRoot: tsConfig.options.sourceRoot,
43
83
  entry: esm2020,
44
84
  moduleName: ngEntryPoint.moduleId,
45
85
  dest: fesm2015,
46
- transform: (code, id) => (0, downlevel_plugin_1.downlevelCodeWithTsc)(code, id, options.cacheEnabled && options.cacheDirectory),
86
+ transform: downlevel_plugin_1.downlevelCodeWithTsc,
47
87
  cache: cache.rollupFESM2015Cache,
88
+ cacheDirectory,
89
+ fileCache: cache.outputCache,
90
+ cacheKey: await (0, cache_1.generateKey)(esm2020, ngEntryPoint.moduleId, fesm2015, tsConfig.options.compilationMode),
48
91
  });
92
+ fesmCache.fesm2015 = {
93
+ code,
94
+ map,
95
+ };
49
96
  spinner.succeed();
50
97
  if (options.watch) {
51
98
  cache.rollupFESM2015Cache = rollupFESMCache;
@@ -55,6 +102,9 @@ const writeBundlesTransform = (options) => (0, transform_1.transformFromPromise)
55
102
  spinner.fail();
56
103
  throw error;
57
104
  }
105
+ if (cacheDirectory) {
106
+ await (0, cache_1.saveCacheEntry)(cacheDirectory, key, JSON.stringify(fesmCache));
107
+ }
58
108
  });
59
109
  exports.writeBundlesTransform = writeBundlesTransform;
60
110
  //# sourceMappingURL=write-bundles.transform.js.map
@@ -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,8CAAsB;AACtB,qEAAsE;AACtE,iDAAwD;AACxD,qDAA6D;AAC7D,oCAAkE;AAG3D,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACjC,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAC/B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC;IAEzD,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC;QAClB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,IAAI;QACF,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,MAAM,eAAe,GAAG,MAAM,IAAA,yBAAgB,EAAC;YAC7C,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;YACvC,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,YAAY,CAAC,QAAQ;YACjC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK,CAAC,mBAAmB;SACjC,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI;QACF,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,MAAM,eAAe,GAAG,MAAM,IAAA,yBAAgB,EAAC;YAC7C,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;YACvC,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,YAAY,CAAC,QAAQ;YACjC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,CAAC,IAAA,uCAAoB,EAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC;YACvG,KAAK,EAAE,KAAK,CAAC,mBAAmB;SACjC,CAAC,CAAC;QACH,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;AACH,CAAC,CAAC,CAAC;AAlDQ,QAAA,qBAAqB,yBAkD7B","sourcesContent":["import ora from 'ora';\nimport { downlevelCodeWithTsc } from '../../flatten/downlevel-plugin';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2020, fesm2015, esm2020 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n try {\n spinner.start('Generating FESM2020');\n const rollupFESMCache = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2020,\n cache: cache.rollupFESM2020Cache,\n });\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2020Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n try {\n spinner.start('Generating FESM2015');\n const rollupFESMCache = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2015,\n transform: (code, id) => downlevelCodeWithTsc(code, id, options.cacheEnabled && options.cacheDirectory),\n cache: cache.rollupFESM2015Cache,\n });\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2015Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\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,8CAAsB;AACtB,+BAA+B;AAE/B,qEAAsE;AACtE,iDAAwD;AACxD,qDAA6D;AAC7D,6CAAgF;AAChF,uCAAkD;AAClD,oCAAkE;AAe3D,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACjC,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAC/B,MAAM,EAAE,QAA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;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI;QACF,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACrC,MAAM,EACJ,KAAK,EAAE,eAAe,EACtB,IAAI,EACJ,GAAG,GACJ,GAAG,MAAM,IAAA,yBAAgB,EAAC;YACzB,UAAU,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;YACvC,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,YAAY,CAAC,QAAQ;YACjC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,uCAAoB;YAC/B,KAAK,EAAE,KAAK,CAAC,mBAAmB;YAChC,cAAc;YACd,SAAS,EAAE,KAAK,CAAC,WAAW;YAC5B,QAAQ,EAAE,MAAM,IAAA,mBAAW,EAAC,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC;SACxG,CAAC,CAAC;QAEH,SAAS,CAAC,QAAQ,GAAG;YACnB,IAAI;YACJ,GAAG;SACJ,CAAC;QAEF,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;KACtE;AACH,CAAC,CAAC,CAAC;AAnHQ,QAAA,qBAAqB,yBAmH7B","sourcesContent":["import ora from 'ora';\nimport { dirname } from 'path';\nimport { SourceMap } from 'rollup';\nimport { downlevelCodeWithTsc } from '../../flatten/downlevel-plugin';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../../utils/cache';\nimport { mkdir, writeFile } from '../../utils/fs';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\ninterface BundlesCache {\n hash: string;\n fesm2020: {\n code: string;\n map: SourceMap;\n };\n fesm2015: {\n code: string;\n map: SourceMap;\n };\n}\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2020, fesm2015, esm2020 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const key = await generateKey(ngEntryPoint.moduleId, esm2020, 'fesm-bundles', tsConfig.options.compilationMode);\n const hash = await generateKey(...[...cache.outputCache.values()].map(({ version }) => version));\n const cacheDirectory = options.cacheEnabled && options.cacheDirectory;\n if (cacheDirectory) {\n const cacheResult: BundlesCache = await readCacheEntry(options.cacheDirectory, key);\n\n if (cacheResult?.hash === hash) {\n try {\n spinner.start('Writing FESM bundles');\n await Promise.all([\n mkdir(dirname(fesm2020), { recursive: true }),\n mkdir(dirname(fesm2015), { recursive: true }),\n ]);\n\n await Promise.all([\n writeFile(fesm2020, cacheResult.fesm2020.code),\n writeFile(`${fesm2020}.map`, JSON.stringify(cacheResult.fesm2020.map)),\n writeFile(fesm2015, cacheResult.fesm2015.code),\n writeFile(`${fesm2015}.map`, JSON.stringify(cacheResult.fesm2015.map)),\n ]);\n\n spinner.succeed('Writing FESM bundles');\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n return;\n }\n }\n\n const fesmCache: Partial<BundlesCache> = {\n hash,\n };\n\n try {\n spinner.start('Generating FESM2020');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2020,\n cache: cache.rollupFESM2020Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2020, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2020 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2020Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n try {\n spinner.start('Generating FESM2015');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2015,\n transform: downlevelCodeWithTsc,\n cache: cache.rollupFESM2015Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2015, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2015 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2015Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, key, JSON.stringify(fesmCache));\n }\n });\n"]}
@@ -51,24 +51,28 @@ const writePackageTransform = (options) => (0, transform_1.transformFromPromise)
51
51
  '**/node_modules/**',
52
52
  `${ngPackage.dest}/**`,
53
53
  ];
54
- if (ngPackage.assets.length && !ngEntryPoint.isSecondaryEntryPoint) {
54
+ if (!ngEntryPoint.isSecondaryEntryPoint) {
55
55
  const assetFiles = [];
56
56
  // COPY ASSET FILES TO DESTINATION
57
57
  spinner.start('Copying assets');
58
58
  try {
59
- for (let asset of ngPackage.assets) {
60
- asset = path.join(ngPackage.src, asset);
61
- if (await (0, fs_1.exists)(asset)) {
62
- const stats = await (0, fs_1.stat)(asset);
59
+ for (const asset of [...ngPackage.assets, 'LICENSE', '**/README.md']) {
60
+ let assetFullPath = path.join(ngPackage.src, asset);
61
+ try {
62
+ const stats = await (0, fs_1.stat)(assetFullPath);
63
63
  if (stats.isFile()) {
64
- assetFiles.push(asset);
64
+ assetFiles.push(assetFullPath);
65
65
  continue;
66
66
  }
67
67
  if (stats.isDirectory()) {
68
- asset = path.join(asset, '**/*');
68
+ assetFullPath = path.join(assetFullPath, '**/*');
69
69
  }
70
70
  }
71
- const files = await (0, glob_1.globFiles)(asset, {
71
+ catch { }
72
+ if (asset === 'LICENSE') {
73
+ continue;
74
+ }
75
+ const files = await (0, glob_1.globFiles)(assetFullPath, {
72
76
  ignore: ignorePaths,
73
77
  cache: ngPackageNode.cache.globCache,
74
78
  dot: true,