ng-packagr 18.0.0 → 18.1.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 (40) hide show
  1. package/lib/commands/command.js +1 -2
  2. package/lib/commands/command.js.map +1 -1
  3. package/lib/file-system/file-watcher.js +1 -2
  4. package/lib/file-system/file-watcher.js.map +1 -1
  5. package/lib/flatten/file-loader-plugin.js +1 -2
  6. package/lib/flatten/file-loader-plugin.js.map +1 -1
  7. package/lib/flatten/rollup.js +1 -2
  8. package/lib/flatten/rollup.js.map +1 -1
  9. package/lib/graph/select.js +6 -7
  10. package/lib/graph/select.js.map +1 -1
  11. package/lib/graph/transform.di.js +1 -2
  12. package/lib/graph/transform.di.js.map +1 -1
  13. package/lib/ng-package/discover-packages.js +1 -2
  14. package/lib/ng-package/discover-packages.js.map +1 -1
  15. package/lib/ng-package/nodes.js +10 -10
  16. package/lib/ng-package/nodes.js.map +1 -1
  17. package/lib/ng-package/schema.js +2 -3
  18. package/lib/ng-package/schema.js.map +1 -1
  19. package/lib/ngc/compile-source-files.js +1 -2
  20. package/lib/ngc/compile-source-files.js.map +1 -1
  21. package/lib/styles/css-resource-plugin.js +1 -2
  22. package/lib/styles/css-resource-plugin.js.map +1 -1
  23. package/lib/styles/postcss-configuration.js +3 -4
  24. package/lib/styles/postcss-configuration.js.map +1 -1
  25. package/lib/ts/cache-compiler-host.js +2 -3
  26. package/lib/ts/cache-compiler-host.js.map +1 -1
  27. package/lib/ts/tsconfig.js +3 -3
  28. package/lib/ts/tsconfig.js.map +1 -1
  29. package/lib/utils/array.js +2 -3
  30. package/lib/utils/array.js.map +1 -1
  31. package/lib/utils/cache.js +3 -4
  32. package/lib/utils/cache.js.map +1 -1
  33. package/lib/utils/fs.d.ts +0 -2
  34. package/lib/utils/fs.js +3 -3
  35. package/lib/utils/fs.js.map +1 -1
  36. package/lib/utils/glob.js +1 -2
  37. package/lib/utils/glob.js.map +1 -1
  38. package/lib/utils/load-esm.js +2 -3
  39. package/lib/utils/load-esm.js.map +1 -1
  40. package/package.json +4 -4
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = void 0;
3
+ exports.execute = execute;
4
4
  /**
5
5
  * Executes a Command and returns its promisified result.
6
6
  *
@@ -15,5 +15,4 @@ function execute(command, args) {
15
15
  return Promise.resolve(result);
16
16
  }
17
17
  }
18
- exports.execute = execute;
19
18
  //# sourceMappingURL=command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/lib/commands/command.ts"],"names":[],"mappings":";;;AASA;;;;GAIG;AACH,SAAgB,OAAO,CAAO,OAAsB,EAAE,IAAQ;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAChD,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAPD,0BAOC","sourcesContent":["/**\n * Common call signature for a command.\n *\n * @stable\n */\nexport interface Command<Arguments, Result> {\n (args?: Arguments): Result | Promise<Result>;\n}\n\n/**\n * Executes a Command and returns its promisified result.\n *\n * @stable\n */\nexport function execute<A, R>(command: Command<A, R>, args?: A): Promise<R> {\n const result = args ? command(args) : command();\n if (result instanceof Promise) {\n return result;\n } else {\n return Promise.resolve(result);\n }\n}\n"]}
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/lib/commands/command.ts"],"names":[],"mappings":";;AAcA,0BAOC;AAZD;;;;GAIG;AACH,SAAgB,OAAO,CAAO,OAAsB,EAAE,IAAQ;IAC5D,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAChD,IAAI,MAAM,YAAY,OAAO,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Common call signature for a command.\n *\n * @stable\n */\nexport interface Command<Arguments, Result> {\n (args?: Arguments): Result | Promise<Result>;\n}\n\n/**\n * Executes a Command and returns its promisified result.\n *\n * @stable\n */\nexport function execute<A, R>(command: Command<A, R>, args?: A): Promise<R> {\n const result = args ? command(args) : command();\n if (result instanceof Promise) {\n return result;\n } else {\n return Promise.resolve(result);\n }\n}\n"]}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.createFileWatch = void 0;
26
+ exports.createFileWatch = createFileWatch;
27
27
  const chokidar = __importStar(require("chokidar"));
28
28
  const os_1 = require("os");
29
29
  const path = __importStar(require("path"));
@@ -66,5 +66,4 @@ function createFileWatch(basePaths, ignoredPaths = [], poll) {
66
66
  }),
67
67
  };
68
68
  }
69
- exports.createFileWatch = createFileWatch;
70
69
  //# 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,2BAA8B;AAC9B,2CAA6B;AAC7B,+BAA4C;AAC5C,kDAAoC;AACpC,wCAA+C;AAU/C,SAAgB,eAAe,CAC7B,SAA4B,EAC5B,eAAoC,EAAE,EACtC,IAAa;IAKb,GAAG,CAAC,KAAK,CAAC,mCAAmC,SAAS,mBAAmB,YAAY,EAAE,CAAC,CAAC;IAEzF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE;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OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC,CAAC;KACH,CAAC;AACJ,CAAC;AAjDD,0CAiDC","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 poll?: number,\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$/, /.tsbuildinfo$/],\n persistent: true,\n usePolling: typeof poll === 'number' ? true : false,\n interval: typeof poll === 'number' ? poll : undefined,\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 // eslint-disable-next-line @typescript-eslint/no-misused-promises\n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AA2G;YAC3G,OAAO;QACT,CAAC;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,kEAAkE;YAClE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC,CAAC;KACH,CAAC;AACJ,CAAC","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 poll?: number,\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$/, /.tsbuildinfo$/],\n persistent: true,\n usePolling: typeof poll === 'number' ? true : false,\n interval: typeof poll === 'number' ? poll : undefined,\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 // eslint-disable-next-line @typescript-eslint/no-misused-promises\n return () => watch.close();\n }),\n };\n}\n"]}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.fileLoaderPlugin = void 0;
26
+ exports.fileLoaderPlugin = fileLoaderPlugin;
27
27
  const log = __importStar(require("../utils/log"));
28
28
  const path_1 = require("../utils/path");
29
29
  /**
@@ -45,5 +45,4 @@ function fileLoaderPlugin(fileCache) {
45
45
  },
46
46
  };
47
47
  }
48
- exports.fileLoaderPlugin = fileLoaderPlugin;
49
48
  //# sourceMappingURL=file-loader-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-loader-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/file-loader-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,kDAAoC;AACpC,wCAA+C;AAE/C;;GAEG;AACH,SAAgB,gBAAgB,CAAC,SAA0B;IACzD,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,UAAU,EAAE;YAChB,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YAE/B,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,IAAA,qBAAc,EAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;YACzD,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,OAAO;gBAClB,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAjBD,4CAiBC","sourcesContent":["import type { Plugin } from 'rollup';\nimport { OutputFileCache } from '../ng-package/nodes';\n\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Loads a file and it's map.\n */\nexport function fileLoaderPlugin(fileCache: OutputFileCache): Plugin {\n return {\n name: 'file-loader',\n load: function (id) {\n log.debug(`file-loader ${id}`);\n\n const data = fileCache.get(ensureUnixPath(id));\n if (!data) {\n throw new Error(`Could not load '${id}' from memory.`);\n }\n\n return {\n code: data.content,\n map: data.map,\n };\n },\n };\n}\n"]}
1
+ {"version":3,"file":"file-loader-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/file-loader-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,4CAiBC;AAvBD,kDAAoC;AACpC,wCAA+C;AAE/C;;GAEG;AACH,SAAgB,gBAAgB,CAAC,SAA0B;IACzD,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,UAAU,EAAE;YAChB,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;YAE/B,MAAM,IAAI,GAAG,SAAS,CAAC,GAAG,CAAC,IAAA,qBAAc,EAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;YACzD,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,IAAI,CAAC,OAAO;gBAClB,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { Plugin } from 'rollup';\nimport { OutputFileCache } from '../ng-package/nodes';\n\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Loads a file and it's map.\n */\nexport function fileLoaderPlugin(fileCache: OutputFileCache): Plugin {\n return {\n name: 'file-loader',\n load: function (id) {\n log.debug(`file-loader ${id}`);\n\n const data = fileCache.get(ensureUnixPath(id));\n if (!data) {\n throw new Error(`Could not load '${id}' from memory.`);\n }\n\n return {\n code: data.content,\n map: data.map,\n };\n },\n };\n}\n"]}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.rollupBundleFile = void 0;
29
+ exports.rollupBundleFile = rollupBundleFile;
30
30
  const plugin_json_1 = __importDefault(require("@rollup/plugin-json"));
31
31
  const plugin_node_resolve_1 = __importDefault(require("@rollup/plugin-node-resolve"));
32
32
  const path = __importStar(require("path"));
@@ -84,7 +84,6 @@ async function rollupBundleFile(opts) {
84
84
  cache: bundle.cache,
85
85
  };
86
86
  }
87
- exports.rollupBundleFile = rollupBundleFile;
88
87
  async function ensureRollup() {
89
88
  if (rollup) {
90
89
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/flatten/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA6C;AAC7C,sFAAsD;AACtD,2CAA6B;AAG7B,0CAAgE;AAChE,kDAAoC;AACpC,6DAAwD;AAmBxD,IAAI,MAA2C,CAAC;AAEhD,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,MAAM,YAAY,EAAE,CAAC;IAErB,GAAG,CAAC,KAAK,CAAC,YAAY,MAA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G,oBAAoB;QACrD,cAAc,EAAE,IAAI,CAAC,SAAS,GAAG,MAAM;QACvC,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,IAAI,cAAc,EAAE,CAAC;QACnB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,gFAAgF;IAChF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IAErB,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM;QACpB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAzDD,4CAyDC;AAED,KAAK,UAAU,YAAY;IACzB,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,wDAAa,QAAQ,GAAC,CAAC;QAChC,GAAG,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,wDAAa,mBAAmB,GAAC,CAAC;QAC3C,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,oEAAoE;IACpE,yFAAyF;IACzF,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtF,yGAAyG;QACzG,OAAO,KAAK,CAAC;IACf,CAAC;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 type { OutputAsset, OutputChunk, RollupCache } from 'rollup';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { fileLoaderPlugin } from './file-loader-plugin';\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 entryName: string;\n dir: string;\n sourceRoot: string;\n cache?: RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\nlet rollup: typeof import('rollup') | undefined;\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: RollupCache; files: (OutputChunk | OutputAsset)[] }> {\n await ensureRollup();\n\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dir}`);\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 cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [nodeResolve(), rollupJson(), fileLoaderPlugin(opts.fileCache)],\n onwarn: warning => {\n switch (warning.code) {\n case 'CIRCULAR_DEPENDENCY':\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 dir: opts.dir,\n inlineDynamicImports: false,\n chunkFileNames: opts.entryName + '-[name]-[hash].mjs',\n entryFileNames: opts.entryName + '.mjs',\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n // Close the bundle to let plugins clean up their external processes or services\n await bundle.close();\n\n return {\n files: output.output,\n cache: bundle.cache,\n };\n}\n\nasync function ensureRollup(): Promise<void> {\n if (rollup) {\n return;\n }\n\n try {\n rollup = await import('rollup');\n log.debug(`rollup using native version.`);\n } catch {\n rollup = await import('@rollup/wasm-node');\n log.debug(`rollup using wasm version.`);\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
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/flatten/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,4CAyDC;AAtFD,sEAA6C;AAC7C,sFAAsD;AACtD,2CAA6B;AAG7B,0CAAgE;AAChE,kDAAoC;AACpC,6DAAwD;AAmBxD,IAAI,MAA2C,CAAC;AAEhD,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,MAAM,YAAY,EAAE,CAAC;IAErB,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAEtE,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAE3C,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,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,IAA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MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,GAAG,wDAAa,QAAQ,GAAC,CAAC;QAChC,GAAG,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,wDAAa,mBAAmB,GAAC,CAAC;QAC3C,GAAG,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,oEAAoE;IACpE,yFAAyF;IACzF,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtF,yGAAyG;QACzG,OAAO,KAAK,CAAC;IACf,CAAC;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 type { OutputAsset, OutputChunk, RollupCache } from 'rollup';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { fileLoaderPlugin } from './file-loader-plugin';\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 entryName: string;\n dir: string;\n sourceRoot: string;\n cache?: RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\nlet rollup: typeof import('rollup') | undefined;\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: RollupCache; files: (OutputChunk | OutputAsset)[] }> {\n await ensureRollup();\n\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dir}`);\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 cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [nodeResolve(), rollupJson(), fileLoaderPlugin(opts.fileCache)],\n onwarn: warning => {\n switch (warning.code) {\n case 'CIRCULAR_DEPENDENCY':\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 dir: opts.dir,\n inlineDynamicImports: false,\n chunkFileNames: opts.entryName + '-[name]-[hash].mjs',\n entryFileNames: opts.entryName + '.mjs',\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n // Close the bundle to let plugins clean up their external processes or services\n await bundle.close();\n\n return {\n files: output.output,\n cache: bundle.cache,\n };\n}\n\nasync function ensureRollup(): Promise<void> {\n if (rollup) {\n return;\n }\n\n try {\n rollup = await import('rollup');\n log.debug(`rollup using native version.`);\n } catch {\n rollup = await import('@rollup/wasm-node');\n log.debug(`rollup using wasm version.`);\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,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDone = exports.isDirty = exports.isPending = exports.isInProgress = exports.by = exports.and = void 0;
3
+ exports.and = and;
4
+ exports.by = by;
5
+ exports.isInProgress = isInProgress;
6
+ exports.isPending = isPending;
7
+ exports.isDirty = isDirty;
8
+ exports.isDone = isDone;
4
9
  const node_1 = require("./node");
5
10
  function and(...criteria) {
6
11
  return (node) => criteria.every(c => c(node));
7
12
  }
8
- exports.and = and;
9
13
  function by(criteria) {
10
14
  function fn(args) {
11
15
  return criteria(args);
@@ -15,21 +19,16 @@ function by(criteria) {
15
19
  };
16
20
  return fn;
17
21
  }
18
- exports.by = by;
19
22
  function isInProgress(node) {
20
23
  return node.state === node_1.STATE_IN_PROGRESS;
21
24
  }
22
- exports.isInProgress = isInProgress;
23
25
  function isPending(node) {
24
26
  return node.state === node_1.STATE_PENDING;
25
27
  }
26
- exports.isPending = isPending;
27
28
  function isDirty(node) {
28
29
  return node.state === node_1.STATE_DIRTY;
29
30
  }
30
- exports.isDirty = isDirty;
31
31
  function isDone(node) {
32
32
  return node.state === node_1.STATE_DONE;
33
33
  }
34
- exports.isDone = isDone;
35
34
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/lib/graph/select.ts"],"names":[],"mappings":";;;AAAA,iCAAyF;AAEzF,SAAgB,GAAG,CAAC,GAAG,QAAqC;IAC1D,OAAO,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,kBAEC;AAED,SAAgB,EAAE,CAChB,QAAiC;IAKjC,SAAS,EAAE,CAAC,IAAI;QACd,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,EAAE,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI;QACxB,OAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,EAAS,CAAC;AACnB,CAAC;AAdD,gBAcC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,KAAK,KAAK,wBAAiB,CAAC;AAC1C,CAAC;AAFD,oCAEC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,IAAI,CAAC,KAAK,KAAK,oBAAa,CAAC;AACtC,CAAC;AAFD,8BAEC;AAED,SAAgB,OAAO,CAAC,IAAU;IAChC,OAAO,IAAI,CAAC,KAAK,KAAK,kBAAW,CAAC;AACpC,CAAC;AAFD,0BAEC;AAED,SAAgB,MAAM,CAAC,IAAU;IAC/B,OAAO,IAAI,CAAC,KAAK,KAAK,iBAAU,CAAC;AACnC,CAAC;AAFD,wBAEC","sourcesContent":["import { Node, STATE_DIRTY, STATE_DONE, STATE_IN_PROGRESS, STATE_PENDING } from './node';\n\nexport function and(...criteria: ((node: Node) => boolean)[]) {\n return (node: Node) => criteria.every(c => c(node));\n}\n\nexport function by(\n criteria: (node: Node) => boolean,\n): {\n (node: Node): boolean;\n and: (criteria: (node: Node) => boolean) => (node: Node) => boolean;\n} {\n function fn(args) {\n return criteria(args);\n }\n fn['and'] = function (args) {\n return and(criteria, args);\n };\n\n return fn as any;\n}\n\nexport function isInProgress(node: Node): boolean {\n return node.state === STATE_IN_PROGRESS;\n}\n\nexport function isPending(node: Node): boolean {\n return node.state === STATE_PENDING;\n}\n\nexport function isDirty(node: Node): boolean {\n return node.state === STATE_DIRTY;\n}\n\nexport function isDone(node: Node): boolean {\n return node.state === STATE_DONE;\n}\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/lib/graph/select.ts"],"names":[],"mappings":";;AAEA,kBAEC;AAED,gBAcC;AAED,oCAEC;AAED,8BAEC;AAED,0BAEC;AAED,wBAEC;AApCD,iCAAyF;AAEzF,SAAgB,GAAG,CAAC,GAAG,QAAqC;IAC1D,OAAO,CAAC,IAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAgB,EAAE,CAChB,QAAiC;IAKjC,SAAS,EAAE,CAAC,IAAI;QACd,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IACD,EAAE,CAAC,KAAK,CAAC,GAAG,UAAU,IAAI;QACxB,OAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO,EAAS,CAAC;AACnB,CAAC;AAED,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,KAAK,KAAK,wBAAiB,CAAC;AAC1C,CAAC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,IAAI,CAAC,KAAK,KAAK,oBAAa,CAAC;AACtC,CAAC;AAED,SAAgB,OAAO,CAAC,IAAU;IAChC,OAAO,IAAI,CAAC,KAAK,KAAK,kBAAW,CAAC;AACpC,CAAC;AAED,SAAgB,MAAM,CAAC,IAAU;IAC/B,OAAO,IAAI,CAAC,KAAK,KAAK,iBAAU,CAAC;AACnC,CAAC","sourcesContent":["import { Node, STATE_DIRTY, STATE_DONE, STATE_IN_PROGRESS, STATE_PENDING } from './node';\n\nexport function and(...criteria: ((node: Node) => boolean)[]) {\n return (node: Node) => criteria.every(c => c(node));\n}\n\nexport function by(\n criteria: (node: Node) => boolean,\n): {\n (node: Node): boolean;\n and: (criteria: (node: Node) => boolean) => (node: Node) => boolean;\n} {\n function fn(args) {\n return criteria(args);\n }\n fn['and'] = function (args) {\n return and(criteria, args);\n };\n\n return fn as any;\n}\n\nexport function isInProgress(node: Node): boolean {\n return node.state === STATE_IN_PROGRESS;\n}\n\nexport function isPending(node: Node): boolean {\n return node.state === STATE_PENDING;\n}\n\nexport function isDirty(node: Node): boolean {\n return node.state === STATE_DIRTY;\n}\n\nexport function isDone(node: Node): boolean {\n return node.state === STATE_DONE;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provideTransform = void 0;
3
+ exports.provideTransform = provideTransform;
4
4
  /**
5
5
  * Creates a provider for a `Transform`.
6
6
  *
@@ -29,5 +29,4 @@ function provideTransform(module) {
29
29
  deps: module.deps || [],
30
30
  };
31
31
  }
32
- exports.provideTransform = provideTransform;
33
32
  //# sourceMappingURL=transform.di.js.map
@@ -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,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;KACxB,CAAC;AACJ,CAAC;AALD,4CAKC","sourcesContent":["import { FactoryProvider, InjectionToken } 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":";;AA0CA,4CAKC;AA3BD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,EAAE;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import { FactoryProvider, InjectionToken } 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"]}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.discoverPackages = void 0;
26
+ exports.discoverPackages = discoverPackages;
27
27
  const jsonc_parser_1 = require("jsonc-parser");
28
28
  const path = __importStar(require("path"));
29
29
  const fs_1 = require("../utils/fs");
@@ -159,5 +159,4 @@ async function discoverPackages({ project }) {
159
159
  }
160
160
  return new package_1.NgPackage(basePath, primary, secondaries);
161
161
  }
162
- exports.discoverPackages = discoverPackages;
163
162
  //# sourceMappingURL=discover-packages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/ng-package/discover-packages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAkD;AAClD,2CAA6B;AAC7B,oCAAqD;AACrD,wCAA0C;AAC1C,kDAAoC;AACpC,wCAA+C;AAC/C,2DAAyD;AACzD,uCAAsC;AACtC,qCAAsF;AAWtF,KAAK,UAAU,cAAc,CAAC,QAAgB;IAC5C,IAAI,CAAC,CAAC,MAAM,IAAA,WAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,0BAAc,QAAQ,wCAAE;IAC1B,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,aAAQ,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE/C,OAAO,IAAA,oBAAS,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,kBAAkB,CAAC,oBAA4B,EAAE,WAAW,GAAG,KAAK;;IACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,MAAM,IAAA,SAAI,EAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,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EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,gBAAgB,EAAE,CAAC;YACrB,WAAW,CAAC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,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;IAC5F,CAAC;IAED,OAAO,IAAI,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC;AAtBD,4CAsBC","sourcesContent":["import { parse as parseJson } from 'jsonc-parser';\nimport * as path from 'path';\nimport { exists, readFile, stat } from '../utils/fs';\nimport { globFiles } from '../utils/glob';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\nimport { NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\nimport { validateNgPackageEntryPointSchema, validateNgPackageSchema } from './schema';\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\nasync function readConfigFile(filePath: string): Promise<any> {\n if (!(await exists(filePath))) {\n return undefined;\n }\n\n if (filePath.endsWith('.js')) {\n return import(filePath);\n }\n\n const data = await readFile(filePath, 'utf-8');\n\n return parseJson(data, undefined, { allowTrailingComma: true });\n}\n\n/**\n * Resolves a user's package by testing '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 fullPath = path.resolve(folderPathOrFilePath);\n const pathStats = await stat(fullPath);\n const basePath = pathStats.isDirectory() ? fullPath : path.dirname(fullPath);\n\n let ngPackageJson: unknown;\n 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 ngPackageJson = ngPackageJson['default'] ?? ngPackageJson;\n try {\n if (isSecondary) {\n validateNgPackageEntryPointSchema(ngPackageJson);\n } else {\n validateNgPackageSchema(ngPackageJson);\n }\n } catch (e) {\n log.error(`An error has occurred while validating config at ${folderPathOrFilePath}`);\n throw e;\n }\n\n let packageJson: {} = {};\n if (!isSecondary) {\n const pkgJsonPath = path.join(basePath, 'package.json');\n packageJson = await readConfigFile(pkgJsonPath);\n\n if (!packageJson) {\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\n return {\n basePath,\n packageJson,\n ngPackageJson,\n };\n }\n\n if (pathStats.isDirectory()) {\n // return even if it's undefined and use defaults when it's not a file\n return undefined;\n }\n\n if (pathStats.isFile()) {\n 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 `ng-package` files.\n * Similar to `find ${directoryPath} --name ng-package --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 = ['**/node_modules/**', '**/.git/**', `${excludeFolder}/**`, 'ng-package.json'];\n\n const filePaths = await globFiles(`**/ng-package.json`, {\n ignore,\n onlyFiles: true,\n cwd: directoryPath,\n });\n\n return filePaths.map(subpath => path.dirname(path.join(directoryPath, subpath)));\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"]}
1
+ {"version":3,"file":"discover-packages.js","sourceRoot":"","sources":["../../../src/lib/ng-package/discover-packages.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+IA,4CAsBC;AArK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C,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,IAAI,mBAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACvD,CAAC","sourcesContent":["import { parse as parseJson } from 'jsonc-parser';\nimport * as path from 'path';\nimport { exists, readFile, stat } from '../utils/fs';\nimport { globFiles } from '../utils/glob';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\nimport { NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\nimport { validateNgPackageEntryPointSchema, validateNgPackageSchema } from './schema';\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\nasync function readConfigFile(filePath: string): Promise<any> {\n if (!(await exists(filePath))) {\n return undefined;\n }\n\n if (filePath.endsWith('.js')) {\n return import(filePath);\n }\n\n const data = await readFile(filePath, 'utf-8');\n\n return parseJson(data, undefined, { allowTrailingComma: true });\n}\n\n/**\n * Resolves a user's package by testing '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 fullPath = path.resolve(folderPathOrFilePath);\n const pathStats = await stat(fullPath);\n const basePath = pathStats.isDirectory() ? fullPath : path.dirname(fullPath);\n\n let ngPackageJson: unknown;\n 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 ngPackageJson = ngPackageJson['default'] ?? ngPackageJson;\n try {\n if (isSecondary) {\n validateNgPackageEntryPointSchema(ngPackageJson);\n } else {\n validateNgPackageSchema(ngPackageJson);\n }\n } catch (e) {\n log.error(`An error has occurred while validating config at ${folderPathOrFilePath}`);\n throw e;\n }\n\n let packageJson: {} = {};\n if (!isSecondary) {\n const pkgJsonPath = path.join(basePath, 'package.json');\n packageJson = await readConfigFile(pkgJsonPath);\n\n if (!packageJson) {\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\n return {\n basePath,\n packageJson,\n ngPackageJson,\n };\n }\n\n if (pathStats.isDirectory()) {\n // return even if it's undefined and use defaults when it's not a file\n return undefined;\n }\n\n if (pathStats.isFile()) {\n 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 `ng-package` files.\n * Similar to `find ${directoryPath} --name ng-package --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 = ['**/node_modules/**', '**/.git/**', `${excludeFolder}/**`, 'ng-package.json'];\n\n const filePaths = await globFiles(`**/ng-package.json`, {\n ignore,\n onlyFiles: true,\n cwd: directoryPath,\n });\n\n return filePaths.map(subpath => path.dirname(path.join(directoryPath, subpath)));\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"]}
@@ -3,7 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PackageNode = exports.EntryPointNode = exports.ngUrl = exports.fileUrlPath = exports.fileUrl = exports.isFileUrl = exports.isEntryPointDirty = exports.isEntryPointInProgress = exports.byEntryPoint = exports.isPackage = exports.isEntryPoint = exports.URL_PROTOCOL_NG = exports.URL_PROTOCOL_FILE = exports.TYPE_NG_ENTRY_POINT = exports.TYPE_NG_PACKAGE = void 0;
6
+ exports.PackageNode = exports.EntryPointNode = exports.URL_PROTOCOL_NG = exports.URL_PROTOCOL_FILE = exports.TYPE_NG_ENTRY_POINT = exports.TYPE_NG_PACKAGE = void 0;
7
+ exports.isEntryPoint = isEntryPoint;
8
+ exports.isPackage = isPackage;
9
+ exports.byEntryPoint = byEntryPoint;
10
+ exports.isEntryPointInProgress = isEntryPointInProgress;
11
+ exports.isEntryPointDirty = isEntryPointDirty;
12
+ exports.isFileUrl = isFileUrl;
13
+ exports.fileUrl = fileUrl;
14
+ exports.fileUrlPath = fileUrlPath;
15
+ exports.ngUrl = ngUrl;
7
16
  const typescript_1 = __importDefault(require("typescript"));
8
17
  const file_cache_1 = require("../file-system/file-cache");
9
18
  const node_1 = require("../graph/node");
@@ -17,41 +26,32 @@ exports.URL_PROTOCOL_NG = 'ng://';
17
26
  function isEntryPoint(node) {
18
27
  return node.type === exports.TYPE_NG_ENTRY_POINT;
19
28
  }
20
- exports.isEntryPoint = isEntryPoint;
21
29
  function isPackage(node) {
22
30
  return node.type === exports.TYPE_NG_PACKAGE;
23
31
  }
24
- exports.isPackage = isPackage;
25
32
  function byEntryPoint() {
26
33
  return (0, select_1.by)(isEntryPoint);
27
34
  }
28
- exports.byEntryPoint = byEntryPoint;
29
35
  function isEntryPointInProgress() {
30
36
  return (0, select_1.by)(isEntryPoint).and(select_1.isInProgress);
31
37
  }
32
- exports.isEntryPointInProgress = isEntryPointInProgress;
33
38
  function isEntryPointDirty() {
34
39
  return (0, select_1.by)(isEntryPoint).and(select_1.isDirty);
35
40
  }
36
- exports.isEntryPointDirty = isEntryPointDirty;
37
41
  function isFileUrl(value) {
38
42
  return value.startsWith(exports.URL_PROTOCOL_FILE);
39
43
  }
40
- exports.isFileUrl = isFileUrl;
41
44
  function fileUrl(path) {
42
45
  return `${exports.URL_PROTOCOL_FILE}${path}`;
43
46
  }
44
- exports.fileUrl = fileUrl;
45
47
  function fileUrlPath(url) {
46
48
  if (url.startsWith(exports.URL_PROTOCOL_FILE)) {
47
49
  return url.substring(exports.URL_PROTOCOL_FILE.length);
48
50
  }
49
51
  }
50
- exports.fileUrlPath = fileUrlPath;
51
52
  function ngUrl(path) {
52
53
  return `${exports.URL_PROTOCOL_NG}${path}`;
53
54
  }
54
- exports.ngUrl = ngUrl;
55
55
  class EntryPointNode extends node_1.Node {
56
56
  constructor(url, sourcesFileCache, moduleResolutionCache) {
57
57
  super(url);
@@ -1 +1 @@
1
- {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/lib/ng-package/nodes.ts"],"names":[],"mappings":";;;;;;AAEA,4DAA4B;AAC5B,0DAAsD;AAEtD,wCAAqC;AACrC,4CAA4D;AAK/C,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,4BAA4B,CAAC;AAEhE,oDAAoD;AACvC,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,kCAAkC;AACrB,QAAA,eAAe,GAAG,OAAO,CAAC;AAEvC,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,IAAI,KAAK,2BAAmB,CAAC;AAC3C,CAAC;AAFD,oCAEC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,IAAI,CAAC,IAAI,KAAK,uBAAe,CAAC;AACvC,CAAC;AAFD,8BAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAA,WAAE,EAAC,YAAY,CAAC,CAAC;AAC1B,CAAC;AAFD,oCAEC;AAED,SAAgB,sBAAsB;IACpC,OAAO,IAAA,WAAE,EAAC,YAAY,CAAC,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;AAC5C,CAAC;AAFD,wDAEC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,IAAA,WAAE,EAAC,YAAY,CAAC,CAAC,GAAG,CAAC,gBAAO,CAAC,CAAC;AACvC,CAAC;AAFD,8CAEC;AAED,SAAgB,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,UAAU,CAAC,yBAAiB,CAAC,CAAC;AAC7C,CAAC;AAFD,8BAEC;AAED,SAAgB,OAAO,CAAC,IAAY;IAClC,OAAO,GAAG,yBAAiB,GAAG,IAAI,EAAE,CAAC;AACvC,CAAC;AAFD,0BAEC;AAED,SAAgB,WAAW,CAAC,GAAW;IACrC,IAAI,GAAG,CAAC,UAAU,CAAC,yBAAiB,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC,SAAS,CAAC,yBAAiB,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAJD,kCAIC;AAED,SAAgB,KAAK,CAAC,IAAY;IAChC,OAAO,GAAG,uBAAe,GAAG,IAAI,EAAE,CAAC;AACrC,CAAC;AAFD,sBAEC;AAID,MAAa,cAAe,SAAQ,WAAI;IAGtC,YACkB,GAAW,EAC3B,gBAA2B,EAC3B,qBAA+C;QAE/C,KAAK,CAAC,GAAG,CAAC,CAAC;QAJK,QAAG,GAAH,GAAG,CAAQ;QAHpB,SAAI,GAAG,2BAAmB,CAAC;QASlC,IAAI,CAAC,KAAK,GAAG;YACX,gBAAgB;YAChB,wBAAwB,EAAE,IAAI,sBAAS,EAAE;YACzC,qBAAqB;YACrB,WAAW,EAAE,IAAI,GAAG,EAAE;SACvB,CAAC;IACJ,CAAC;CAmBF;AAnCD,wCAmCC;AAED,MAAa,WAAY,SAAQ,WAAI;IAArC;;QACW,SAAI,GAAG,uBAAe,CAAC;QAGhC,UAAK,GAAG;YACN,gBAAgB,EAAE,IAAI,sBAAS,EAAE;YACjC,qBAAqB,EAAE,oBAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7E,CAAC;IACJ,CAAC;CAAA;AARD,kCAQC","sourcesContent":["import type { NgtscProgram, ParsedConfiguration, Program } from '@angular/compiler-cli';\nimport type { RollupCache } from 'rollup';\nimport ts from 'typescript';\nimport { FileCache } from '../file-system/file-cache';\nimport { ComplexPredicate } from '../graph/build-graph';\nimport { Node } from '../graph/node';\nimport { by, isDirty, isInProgress } from '../graph/select';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { DestinationFiles, NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\n\nexport const TYPE_NG_PACKAGE = 'application/ng-package';\nexport const TYPE_NG_ENTRY_POINT = 'application/ng-entry-point';\n\n/** A node that can be read through the `fs` api. */\nexport const URL_PROTOCOL_FILE = 'file://';\n\n/** A node specific to angular. */\nexport const URL_PROTOCOL_NG = 'ng://';\n\nexport function isEntryPoint(node: Node): node is EntryPointNode {\n return node.type === TYPE_NG_ENTRY_POINT;\n}\n\nexport function isPackage(node: Node): node is PackageNode {\n return node.type === TYPE_NG_PACKAGE;\n}\n\nexport function byEntryPoint(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint);\n}\n\nexport function isEntryPointInProgress(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint).and(isInProgress);\n}\n\nexport function isEntryPointDirty(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint).and(isDirty);\n}\n\nexport function isFileUrl(value: string): boolean {\n return value.startsWith(URL_PROTOCOL_FILE);\n}\n\nexport function fileUrl(path: string): string {\n return `${URL_PROTOCOL_FILE}${path}`;\n}\n\nexport function fileUrlPath(url: string): string {\n if (url.startsWith(URL_PROTOCOL_FILE)) {\n return url.substring(URL_PROTOCOL_FILE.length);\n }\n}\n\nexport function ngUrl(path: string): string {\n return `${URL_PROTOCOL_NG}${path}`;\n}\n\nexport type OutputFileCache = Map<string, { version?: string; content: string; map?: any }>;\n\nexport class EntryPointNode extends Node {\n readonly type = TYPE_NG_ENTRY_POINT;\n\n constructor(\n public readonly url: string,\n sourcesFileCache: FileCache,\n moduleResolutionCache: ts.ModuleResolutionCache,\n ) {\n super(url);\n\n this.cache = {\n sourcesFileCache,\n analysesSourcesFileCache: new FileCache(),\n moduleResolutionCache,\n outputCache: new Map(),\n };\n }\n\n cache: {\n outputCache: OutputFileCache;\n oldPrograms?: Record<ts.ScriptTarget | 'analysis', Program | ts.Program>;\n sourcesFileCache: FileCache;\n analysesSourcesFileCache: FileCache;\n moduleResolutionCache: ts.ModuleResolutionCache;\n rollupFESM2022Cache?: RollupCache;\n stylesheetProcessor?: StylesheetProcessor;\n oldNgtscProgram?: NgtscProgram;\n oldBuilder?: ts.EmitAndSemanticDiagnosticsBuilderProgram;\n };\n\n data: {\n destinationFiles: DestinationFiles;\n entryPoint: NgEntryPoint;\n tsConfig?: ParsedConfiguration;\n };\n}\n\nexport class PackageNode extends Node {\n readonly type = TYPE_NG_PACKAGE;\n data: NgPackage;\n\n cache = {\n sourcesFileCache: new FileCache(),\n moduleResolutionCache: ts.createModuleResolutionCache(process.cwd(), s => s),\n };\n}\n"]}
1
+ {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../../src/lib/ng-package/nodes.ts"],"names":[],"mappings":";;;;;;AAoBA,oCAEC;AAED,8BAEC;AAED,oCAEC;AAED,wDAEC;AAED,8CAEC;AAED,8BAEC;AAED,0BAEC;AAED,kCAIC;AAED,sBAEC;AAtDD,4DAA4B;AAC5B,0DAAsD;AAEtD,wCAAqC;AACrC,4CAA4D;AAK/C,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,4BAA4B,CAAC;AAEhE,oDAAoD;AACvC,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,kCAAkC;AACrB,QAAA,eAAe,GAAG,OAAO,CAAC;AAEvC,SAAgB,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,CAAC,IAAI,KAAK,2BAAmB,CAAC;AAC3C,CAAC;AAED,SAAgB,SAAS,CAAC,IAAU;IAClC,OAAO,IAAI,CAAC,IAAI,KAAK,uBAAe,CAAC;AACvC,CAAC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAA,WAAE,EAAC,YAAY,CAAC,CAAC;AAC1B,CAAC;AAED,SAAgB,sBAAsB;IACpC,OAAO,IAAA,WAAE,EAAC,YAAY,CAAC,CAAC,GAAG,CAAC,qBAAY,CAAC,CAAC;AAC5C,CAAC;AAED,SAAgB,iBAAiB;IA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Configuration, Program } from '@angular/compiler-cli';\nimport type { RollupCache } from 'rollup';\nimport ts from 'typescript';\nimport { FileCache } from '../file-system/file-cache';\nimport { ComplexPredicate } from '../graph/build-graph';\nimport { Node } from '../graph/node';\nimport { by, isDirty, isInProgress } from '../graph/select';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { DestinationFiles, NgEntryPoint } from './entry-point/entry-point';\nimport { NgPackage } from './package';\n\nexport const TYPE_NG_PACKAGE = 'application/ng-package';\nexport const TYPE_NG_ENTRY_POINT = 'application/ng-entry-point';\n\n/** A node that can be read through the `fs` api. */\nexport const URL_PROTOCOL_FILE = 'file://';\n\n/** A node specific to angular. */\nexport const URL_PROTOCOL_NG = 'ng://';\n\nexport function isEntryPoint(node: Node): node is EntryPointNode {\n return node.type === TYPE_NG_ENTRY_POINT;\n}\n\nexport function isPackage(node: Node): node is PackageNode {\n return node.type === TYPE_NG_PACKAGE;\n}\n\nexport function byEntryPoint(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint);\n}\n\nexport function isEntryPointInProgress(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint).and(isInProgress);\n}\n\nexport function isEntryPointDirty(): ComplexPredicate<EntryPointNode> {\n return by(isEntryPoint).and(isDirty);\n}\n\nexport function isFileUrl(value: string): boolean {\n return value.startsWith(URL_PROTOCOL_FILE);\n}\n\nexport function fileUrl(path: string): string {\n return `${URL_PROTOCOL_FILE}${path}`;\n}\n\nexport function fileUrlPath(url: string): string {\n if (url.startsWith(URL_PROTOCOL_FILE)) {\n return url.substring(URL_PROTOCOL_FILE.length);\n }\n}\n\nexport function ngUrl(path: string): string {\n return `${URL_PROTOCOL_NG}${path}`;\n}\n\nexport type OutputFileCache = Map<string, { version?: string; content: string; map?: any }>;\n\nexport class EntryPointNode extends Node {\n readonly type = TYPE_NG_ENTRY_POINT;\n\n constructor(\n public readonly url: string,\n sourcesFileCache: FileCache,\n moduleResolutionCache: ts.ModuleResolutionCache,\n ) {\n super(url);\n\n this.cache = {\n sourcesFileCache,\n analysesSourcesFileCache: new FileCache(),\n moduleResolutionCache,\n outputCache: new Map(),\n };\n }\n\n cache: {\n outputCache: OutputFileCache;\n oldPrograms?: Record<ts.ScriptTarget | 'analysis', Program | ts.Program>;\n sourcesFileCache: FileCache;\n analysesSourcesFileCache: FileCache;\n moduleResolutionCache: ts.ModuleResolutionCache;\n rollupFESM2022Cache?: RollupCache;\n stylesheetProcessor?: StylesheetProcessor;\n oldNgtscProgram?: NgtscProgram;\n oldBuilder?: ts.EmitAndSemanticDiagnosticsBuilderProgram;\n };\n\n data: {\n destinationFiles: DestinationFiles;\n entryPoint: NgEntryPoint;\n tsConfig?: ParsedConfiguration;\n };\n}\n\nexport class PackageNode extends Node {\n readonly type = TYPE_NG_PACKAGE;\n data: NgPackage;\n\n cache = {\n sourcesFileCache: new FileCache(),\n moduleResolutionCache: ts.createModuleResolutionCache(process.cwd(), s => s),\n };\n}\n"]}
@@ -26,7 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.validateNgPackageEntryPointSchema = exports.validateNgPackageSchema = void 0;
29
+ exports.validateNgPackageSchema = validateNgPackageSchema;
30
+ exports.validateNgPackageEntryPointSchema = validateNgPackageEntryPointSchema;
30
31
  const ajv_1 = __importDefault(require("ajv"));
31
32
  const log = __importStar(require("../utils/log"));
32
33
  /** Lazily initialized ajv validator instance. */
@@ -45,7 +46,6 @@ function validateNgPackageSchema(ngPackageJson) {
45
46
  throw new Error(`Configuration doesn't match the required schema.\n${formatSchemaValidationErrors(validate.errors)}`);
46
47
  }
47
48
  }
48
- exports.validateNgPackageSchema = validateNgPackageSchema;
49
49
  /**
50
50
  * Validates the `ngPackageJson` value against the JSON schema using ajv. An error is thrown if
51
51
  * schema errors are found.
@@ -59,7 +59,6 @@ function validateNgPackageEntryPointSchema(ngPackageJson) {
59
59
  throw new Error(`Configuration doesn't match the required schema.\n${formatSchemaValidationErrors(validate.errors)}`);
60
60
  }
61
61
  }
62
- exports.validateNgPackageEntryPointSchema = validateNgPackageEntryPointSchema;
63
62
  function formatSchemaValidationErrors(errors) {
64
63
  return errors
65
64
  .map(err => {
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/lib/ng-package/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAyD;AAGzD,kDAAoC;AAEpC,iDAAiD;AACjD,IAAI,2BAAyD,CAAC;AAC9D,IAAI,qCAAmE,CAAC;AAExE;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,aAAsB;IAC5D,MAAM,QAAQ,GAAG,CAAC,2BAA2B,aAA3B,2BAA2B,cAA3B,2BAA2B,IAA3B,2BAA2B,GAAK,kBAAkB,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC,EAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,qDAAqD,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACrG,CAAC;IACJ,CAAC;AACH,CAAC;AARD,0DAQC;AAED;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,aAAsB;IAEtB,MAAM,QAAQ,GAAG,CAAC,qCAAqC,aAArC,qCAAqC,cAArC,qCAAqC,IAArC,qCAAqC,GAAK,kBAAkB,CAC5E,OAAO,CAAC,iCAAiC,CAAC,CAC3C,EAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,qDAAqD,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACrG,CAAC;IACJ,CAAC;AACH,CAAC;AAZD,8EAYC;AAED,SAAS,4BAA4B,CAAC,MAAqB;IACzD,OAAO,MAAM;SACV,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,IAAI,OAAO,GAAG,aAAa,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC7E,IAAI,GAAG,CAAC,OAAO,KAAK,sBAAsB,EAAE,CAAC;YAC3C,OAAO,IAAI,KAAM,GAAG,CAAC,MAAc,CAAC,kBAAkB,GAAG,CAAC;QAC5D,CAAC;QAED,OAAO,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAe;IACzC,MAAM,IAAI,GAAG,IAAI,aAAG,CAAC;QACnB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,KAAK,EAAE,+GAA+G;KAC/H,CAAC,CAAC;IAEH,sCAAsC;IACtC,IAAI,CAAC,UAAU,CAAC;QACd,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE;YAClD,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,IAAI,CACN,WAAW,OAAO,CAAC,kBAAkB,kBAAkB,OAAO,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CACzG,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import Ajv, { ErrorObject, ValidateFunction } from 'ajv';\nimport { NgPackageEntryConfig } from '../../ng-entrypoint.schema';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport * as log from '../utils/log';\n\n/** Lazily initialized ajv validator instance. */\nlet ajvNgPackageSchemaValidator: ValidateFunction | undefined;\nlet ajvNgPackageEntryPointSchemaValidator: ValidateFunction | undefined;\n\n/**\n * Validates the `ngPackageJson` value against the JSON schema using ajv. An error is thrown if\n * schema errors are found.\n *\n * @param ngPackageJson The value to validate.\n */\nexport function validateNgPackageSchema(ngPackageJson: unknown): asserts ngPackageJson is NgPackageConfig {\n const validate = (ajvNgPackageSchemaValidator ??= getSchemaValidator(require('../../ng-package.schema.json')));\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\n/**\n * Validates the `ngPackageJson` value against the JSON schema using ajv. An error is thrown if\n * schema errors are found.\n *\n * @param ngPackageJson The value to validate.\n */\nexport function validateNgPackageEntryPointSchema(\n ngPackageJson: unknown,\n): asserts ngPackageJson is NgPackageEntryConfig {\n const validate = (ajvNgPackageEntryPointSchemaValidator ??= getSchemaValidator(\n require('../../ng-entrypoint.schema.json'),\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\nfunction formatSchemaValidationErrors(errors: ErrorObject[]): string {\n return errors\n .map(err => {\n let message = `Data path ${JSON.stringify(err.instancePath)} ${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 * Returns an initialized ajv validator for the ng-package JSON schema.\n */\nfunction getSchemaValidator(schema: unknown): ValidateFunction {\n const _ajv = new Ajv({\n useDefaults: true,\n strict: false, // strict mode is enabled by default in JSON schema type definitions, which disallows the use of `useDefaults`.\n });\n\n // Add handler for x-deprecated fields\n _ajv.addKeyword({\n keyword: 'x-deprecated',\n validate: (schema, _data, _parentSchema, dataCxt) => {\n if (schema) {\n log.warn(\n `Option \"${dataCxt.parentDataProperty}\" is deprecated${typeof schema == 'string' ? ': ' + schema : '.'}`,\n );\n }\n\n return true;\n },\n errors: false,\n });\n\n return _ajv.compile(schema);\n}\n"]}
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/lib/ng-package/schema.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,0DAQC;AAQD,8EAYC;AA3CD,8CAAyD;AAGzD,kDAAoC;AAEpC,iDAAiD;AACjD,IAAI,2BAAyD,CAAC;AAC9D,IAAI,qCAAmE,CAAC;AAExE;;;;;GAKG;AACH,SAAgB,uBAAuB,CAAC,aAAsB;IAC5D,MAAM,QAAQ,GAAG,CAAC,2BAA2B,aAA3B,2BAA2B,cAA3B,2BAA2B,IAA3B,2BAA2B,GAAK,kBAAkB,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC,EAAC,CAAC;IAC/G,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,qDAAqD,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACrG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,iCAAiC,CAC/C,aAAsB;IAEtB,MAAM,QAAQ,GAAG,CAAC,qCAAqC,aAArC,qCAAqC,cAArC,qCAAqC,IAArC,qCAAqC,GAAK,kBAAkB,CAC5E,OAAO,CAAC,iCAAiC,CAAC,CAC3C,EAAC,CAAC;IACH,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,qDAAqD,4BAA4B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CACrG,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,4BAA4B,CAAC,MAAqB;IACzD,OAAO,MAAM;SACV,GAAG,CAAC,GAAG,CAAC,EAAE;QACT,IAAI,OAAO,GAAG,aAAa,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QAC7E,IAAI,GAAG,CAAC,OAAO,KAAK,sBAAsB,EAAE,CAAC;YAC3C,OAAO,IAAI,KAAM,GAAG,CAAC,MAAc,CAAC,kBAAkB,GAAG,CAAC;QAC5D,CAAC;QAED,OAAO,OAAO,GAAG,GAAG,CAAC;IACvB,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,MAAe;IACzC,MAAM,IAAI,GAAG,IAAI,aAAG,CAAC;QACnB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,KAAK,EAAE,+GAA+G;KAC/H,CAAC,CAAC;IAEH,sCAAsC;IACtC,IAAI,CAAC,UAAU,CAAC;QACd,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,EAAE;YAClD,IAAI,MAAM,EAAE,CAAC;gBACX,GAAG,CAAC,IAAI,CACN,WAAW,OAAO,CAAC,kBAAkB,kBAAkB,OAAO,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CACzG,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import Ajv, { ErrorObject, ValidateFunction } from 'ajv';\nimport { NgPackageEntryConfig } from '../../ng-entrypoint.schema';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport * as log from '../utils/log';\n\n/** Lazily initialized ajv validator instance. */\nlet ajvNgPackageSchemaValidator: ValidateFunction | undefined;\nlet ajvNgPackageEntryPointSchemaValidator: ValidateFunction | undefined;\n\n/**\n * Validates the `ngPackageJson` value against the JSON schema using ajv. An error is thrown if\n * schema errors are found.\n *\n * @param ngPackageJson The value to validate.\n */\nexport function validateNgPackageSchema(ngPackageJson: unknown): asserts ngPackageJson is NgPackageConfig {\n const validate = (ajvNgPackageSchemaValidator ??= getSchemaValidator(require('../../ng-package.schema.json')));\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\n/**\n * Validates the `ngPackageJson` value against the JSON schema using ajv. An error is thrown if\n * schema errors are found.\n *\n * @param ngPackageJson The value to validate.\n */\nexport function validateNgPackageEntryPointSchema(\n ngPackageJson: unknown,\n): asserts ngPackageJson is NgPackageEntryConfig {\n const validate = (ajvNgPackageEntryPointSchemaValidator ??= getSchemaValidator(\n require('../../ng-entrypoint.schema.json'),\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\nfunction formatSchemaValidationErrors(errors: ErrorObject[]): string {\n return errors\n .map(err => {\n let message = `Data path ${JSON.stringify(err.instancePath)} ${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 * Returns an initialized ajv validator for the ng-package JSON schema.\n */\nfunction getSchemaValidator(schema: unknown): ValidateFunction {\n const _ajv = new Ajv({\n useDefaults: true,\n strict: false, // strict mode is enabled by default in JSON schema type definitions, which disallows the use of `useDefaults`.\n });\n\n // Add handler for x-deprecated fields\n _ajv.addKeyword({\n keyword: 'x-deprecated',\n validate: (schema, _data, _parentSchema, dataCxt) => {\n if (schema) {\n log.warn(\n `Option \"${dataCxt.parentDataProperty}\" is deprecated${typeof schema == 'string' ? ': ' + schema : '.'}`,\n );\n }\n\n return true;\n },\n errors: false,\n });\n\n return _ajv.compile(schema);\n}\n"]}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.compileSourceFiles = void 0;
29
+ exports.compileSourceFiles = compileSourceFiles;
30
30
  const node_path_1 = require("node:path");
31
31
  const typescript_1 = __importDefault(require("typescript"));
32
32
  const nodes_1 = require("../ng-package/nodes");
@@ -182,5 +182,4 @@ async function compileSourceFiles(graph, tsConfig, moduleResolutionCache, option
182
182
  angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);
183
183
  }
184
184
  }
185
- exports.compileSourceFiles = compileSourceFiles;
186
185
  //# sourceMappingURL=compile-source-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../src/lib/ngc/compile-source-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAiC;AACjC,4DAA4B;AAE5B,+CAAqG;AAGrG,mEAA4F;AAC5F,gDAAkD;AAClD,kDAAoC;AAE7B,KAAK,UAAU,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,OAAyB,EACzB,YAAuC,EACvC,mBAAyC;;IAEzC,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,wBAAa,GAAE,CAAC;IAClE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,eAAe,GAAoB,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAClF,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,aA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AAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC;IAEhE,IAAI,0CAA0C,IAAI,OAAO,EAAE,CAAC;QAC1D,OACE,OAAO,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;YACxF,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC,EACF,CAAC;YACD,QAAQ;QACV,CAAC;IACH,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,sBAAsB,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACxE,eAAe,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AA7MD,gDA6MC","sourcesContent":["import { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport { join } from 'node:path';\nimport ts from 'typescript';\nimport { BuildGraph } from '../graph/build-graph';\nimport { EntryPointNode, PackageNode, isEntryPointInProgress, isPackage } from '../ng-package/nodes';\nimport { NgPackagrOptions } from '../ng-package/options.di';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { augmentProgramWithVersioning, cacheCompilerHost } from '../ts/cache-compiler-host';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport * as log from '../utils/log';\n\nexport async function compileSourceFiles(\n graph: BuildGraph,\n tsConfig: ParsedConfiguration,\n moduleResolutionCache: ts.ModuleResolutionCache,\n options: NgPackagrOptions,\n extraOptions?: Partial<CompilerOptions>,\n stylesheetProcessor?: StylesheetProcessor,\n) {\n const { NgtscProgram, formatDiagnostics } = await ngCompilerCli();\n const { cacheDirectory, watch, cacheEnabled } = options;\n const tsConfigOptions: CompilerOptions = { ...tsConfig.options, ...extraOptions };\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;\n\n const cacheDir = cacheEnabled && cacheDirectory;\n if (cacheDir) {\n tsConfigOptions.incremental ??= true;\n tsConfigOptions.tsBuildInfoFile ??= join(\n cacheDir,\n `tsbuildinfo/${entryPoint.data.entryPoint.flatModuleFile}.tsbuildinfo`,\n );\n }\n\n const tsCompilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n stylesheetProcessor,\n inlineStyleLanguage,\n );\n\n const cache = entryPoint.cache;\n const sourceFileCache = cache.sourcesFileCache;\n let usingBuildInfo = false;\n\n let oldBuilder = cache.oldBuilder;\n if (!oldBuilder && cacheDir) {\n oldBuilder = ts.readBuilderProgram(tsConfigOptions, tsCompilerHost);\n usingBuildInfo = true;\n }\n\n // Create the Angular specific program that contains the Angular compiler\n const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);\n\n const angularCompiler = angularProgram.compiler;\n const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;\n\n // SourceFile versions are required for builder programs.\n // The wrapped host inside NgtscProgram adds additional files that will not have versions.\n const typeScriptProgram = angularProgram.getTsProgram();\n augmentProgramWithVersioning(typeScriptProgram);\n\n let builder: ts.BuilderProgram | ts.EmitAndSemanticDiagnosticsBuilderProgram;\n if (watch || cacheDir) {\n builder = cache.oldBuilder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n typeScriptProgram,\n tsCompilerHost,\n oldBuilder,\n );\n cache.oldNgtscProgram = angularProgram;\n } else {\n builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);\n }\n\n // Update semantic diagnostics cache\n const affectedFiles = new Set<ts.SourceFile>();\n\n // Analyze affected files when in watch mode for incremental type checking\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, sourceFile => {\n // If the affected file is a TTC shim, add the shim's original source file.\n // This ensures that changes that affect TTC are typechecked even when the changes\n // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.\n // For example, changing @Input property types of a directive used in another component's\n // template.\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n\n return true;\n }\n\n return false;\n });\n\n if (!result) {\n break;\n }\n\n affectedFiles.add(result.affected as ts.SourceFile);\n }\n\n // Add all files with associated template type checking files.\n // Stored TS build info does not have knowledge of the AOT compiler or the typechecking state of the templates.\n // To ensure that errors are reported correctly, all AOT component diagnostics need to be analyzed even if build\n // info is present.\n if (usingBuildInfo) {\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n }\n }\n }\n }\n\n // Collect program level diagnostics\n const allDiagnostics: ts.Diagnostic[] = [\n ...angularCompiler.getOptionDiagnostics(),\n ...builder.getOptionsDiagnostics(),\n ...builder.getGlobalDiagnostics(),\n ];\n\n // Required to support asynchronous resource loading\n // Must be done before creating transformers or getting template diagnostics\n await angularCompiler.analyzeAsync();\n\n // Collect source file specific diagnostics\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile)) {\n continue;\n }\n\n allDiagnostics.push(\n ...builder.getDeclarationDiagnostics(sourceFile),\n ...builder.getSyntacticDiagnostics(sourceFile),\n ...builder.getSemanticDiagnostics(sourceFile),\n );\n\n // Declaration files cannot have template diagnostics\n if (sourceFile.isDeclarationFile) {\n continue;\n }\n\n // Only request Angular template diagnostics for affected files to avoid\n // overhead of template diagnostics for unchanged files.\n if (affectedFiles.has(sourceFile)) {\n const angularDiagnostics = angularCompiler.getDiagnosticsForFile(\n sourceFile,\n affectedFiles.size === 1 ? /** OptimizeFor.SingleFile **/ 0 : /** OptimizeFor.WholeProgram */ 1,\n );\n\n allDiagnostics.push(...angularDiagnostics);\n sourceFileCache.updateAngularDiagnostics(sourceFile, angularDiagnostics);\n }\n }\n\n const otherDiagnostics = [];\n const errorDiagnostics = [];\n for (const diagnostic of allDiagnostics) {\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n errorDiagnostics.push(diagnostic);\n } else {\n otherDiagnostics.push(diagnostic);\n }\n }\n\n if (otherDiagnostics.length) {\n log.msg(formatDiagnostics(errorDiagnostics));\n }\n\n if (errorDiagnostics.length) {\n throw new Error(formatDiagnostics(errorDiagnostics));\n }\n\n const transformers = angularCompiler.prepareEmit().transformers;\n\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (\n builder.emitNextAffectedFile((fileName, data, writeByteOrderMark, onError, sourceFiles) => {\n if (fileName.endsWith('.tsbuildinfo')) {\n tsCompilerHost.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n })\n ) {\n // empty\n }\n }\n\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForEmit.has(sourceFile)) {\n continue;\n }\n\n if (angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile)) {\n continue;\n }\n\n builder.emit(sourceFile, undefined, undefined, undefined, transformers);\n angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);\n }\n}\n"]}
1
+ {"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../src/lib/ngc/compile-source-files.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,gDA6MC;AAvND,yCAAiC;AACjC,4DAA4B;AAE5B,+CAAqG;AAGrG,mEAA4F;AAC5F,gDAAkD;AAClD,kDAAoC;AAE7B,KAAK,UAAU,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,OAAyB,EACzB,YAAuC,EACvC,mBAAyC;;IAEzC,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,wBAAa,GAAE,CAAC;IAClE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,eAAe,GAAoB,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IAClF,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,aAAa,GAAgB,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;IACzD,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC;IAEnE,MAAM,QAAQ,GAAG,YAAY,IAAI,cAAc,CAAC;IAChD,IAAI,QAAQ,EAAE,CAAC;QACb,MAAA,eAAe,CAAC,WAAW,oCAA3B,eAAe,C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OAAO,EAAE,WAAW,EAAE,EAAE;YACxF,IAAI,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtC,cAAc,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;YACrF,CAAC;QACH,CAAC,CAAC,EACF,CAAC;YACD,QAAQ;QACV,CAAC;IACH,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;QAClD,IAAI,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,SAAS;QACX,CAAC;QAED,IAAI,eAAe,CAAC,sBAAsB,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,CAAC;YACtE,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;QACxE,eAAe,CAAC,sBAAsB,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC","sourcesContent":["import { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport { join } from 'node:path';\nimport ts from 'typescript';\nimport { BuildGraph } from '../graph/build-graph';\nimport { EntryPointNode, PackageNode, isEntryPointInProgress, isPackage } from '../ng-package/nodes';\nimport { NgPackagrOptions } from '../ng-package/options.di';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { augmentProgramWithVersioning, cacheCompilerHost } from '../ts/cache-compiler-host';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport * as log from '../utils/log';\n\nexport async function compileSourceFiles(\n graph: BuildGraph,\n tsConfig: ParsedConfiguration,\n moduleResolutionCache: ts.ModuleResolutionCache,\n options: NgPackagrOptions,\n extraOptions?: Partial<CompilerOptions>,\n stylesheetProcessor?: StylesheetProcessor,\n) {\n const { NgtscProgram, formatDiagnostics } = await ngCompilerCli();\n const { cacheDirectory, watch, cacheEnabled } = options;\n const tsConfigOptions: CompilerOptions = { ...tsConfig.options, ...extraOptions };\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;\n\n const cacheDir = cacheEnabled && cacheDirectory;\n if (cacheDir) {\n tsConfigOptions.incremental ??= true;\n tsConfigOptions.tsBuildInfoFile ??= join(\n cacheDir,\n `tsbuildinfo/${entryPoint.data.entryPoint.flatModuleFile}.tsbuildinfo`,\n );\n }\n\n const tsCompilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n stylesheetProcessor,\n inlineStyleLanguage,\n );\n\n const cache = entryPoint.cache;\n const sourceFileCache = cache.sourcesFileCache;\n let usingBuildInfo = false;\n\n let oldBuilder = cache.oldBuilder;\n if (!oldBuilder && cacheDir) {\n oldBuilder = ts.readBuilderProgram(tsConfigOptions, tsCompilerHost);\n usingBuildInfo = true;\n }\n\n // Create the Angular specific program that contains the Angular compiler\n const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);\n\n const angularCompiler = angularProgram.compiler;\n const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;\n\n // SourceFile versions are required for builder programs.\n // The wrapped host inside NgtscProgram adds additional files that will not have versions.\n const typeScriptProgram = angularProgram.getTsProgram();\n augmentProgramWithVersioning(typeScriptProgram);\n\n let builder: ts.BuilderProgram | ts.EmitAndSemanticDiagnosticsBuilderProgram;\n if (watch || cacheDir) {\n builder = cache.oldBuilder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(\n typeScriptProgram,\n tsCompilerHost,\n oldBuilder,\n );\n cache.oldNgtscProgram = angularProgram;\n } else {\n builder = ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost);\n }\n\n // Update semantic diagnostics cache\n const affectedFiles = new Set<ts.SourceFile>();\n\n // Analyze affected files when in watch mode for incremental type checking\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n // eslint-disable-next-line no-constant-condition\n while (true) {\n const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, sourceFile => {\n // If the affected file is a TTC shim, add the shim's original source file.\n // This ensures that changes that affect TTC are typechecked even when the changes\n // are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.\n // For example, changing @Input property types of a directive used in another component's\n // template.\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n\n return true;\n }\n\n return false;\n });\n\n if (!result) {\n break;\n }\n\n affectedFiles.add(result.affected as ts.SourceFile);\n }\n\n // Add all files with associated template type checking files.\n // Stored TS build info does not have knowledge of the AOT compiler or the typechecking state of the templates.\n // To ensure that errors are reported correctly, all AOT component diagnostics need to be analyzed even if build\n // info is present.\n if (usingBuildInfo) {\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile) && sourceFile.fileName.endsWith('.ngtypecheck.ts')) {\n // This file name conversion relies on internal compiler logic and should be converted\n // to an official method when available. 15 is length of `.ngtypecheck.ts`\n const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';\n const originalSourceFile = builder.getSourceFile(originalFilename);\n if (originalSourceFile) {\n affectedFiles.add(originalSourceFile);\n }\n }\n }\n }\n }\n\n // Collect program level diagnostics\n const allDiagnostics: ts.Diagnostic[] = [\n ...angularCompiler.getOptionDiagnostics(),\n ...builder.getOptionsDiagnostics(),\n ...builder.getGlobalDiagnostics(),\n ];\n\n // Required to support asynchronous resource loading\n // Must be done before creating transformers or getting template diagnostics\n await angularCompiler.analyzeAsync();\n\n // Collect source file specific diagnostics\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForDiagnostics.has(sourceFile)) {\n continue;\n }\n\n allDiagnostics.push(\n ...builder.getDeclarationDiagnostics(sourceFile),\n ...builder.getSyntacticDiagnostics(sourceFile),\n ...builder.getSemanticDiagnostics(sourceFile),\n );\n\n // Declaration files cannot have template diagnostics\n if (sourceFile.isDeclarationFile) {\n continue;\n }\n\n // Only request Angular template diagnostics for affected files to avoid\n // overhead of template diagnostics for unchanged files.\n if (affectedFiles.has(sourceFile)) {\n const angularDiagnostics = angularCompiler.getDiagnosticsForFile(\n sourceFile,\n affectedFiles.size === 1 ? /** OptimizeFor.SingleFile **/ 0 : /** OptimizeFor.WholeProgram */ 1,\n );\n\n allDiagnostics.push(...angularDiagnostics);\n sourceFileCache.updateAngularDiagnostics(sourceFile, angularDiagnostics);\n }\n }\n\n const otherDiagnostics = [];\n const errorDiagnostics = [];\n for (const diagnostic of allDiagnostics) {\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n errorDiagnostics.push(diagnostic);\n } else {\n otherDiagnostics.push(diagnostic);\n }\n }\n\n if (otherDiagnostics.length) {\n log.msg(formatDiagnostics(errorDiagnostics));\n }\n\n if (errorDiagnostics.length) {\n throw new Error(formatDiagnostics(errorDiagnostics));\n }\n\n const transformers = angularCompiler.prepareEmit().transformers;\n\n if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {\n while (\n builder.emitNextAffectedFile((fileName, data, writeByteOrderMark, onError, sourceFiles) => {\n if (fileName.endsWith('.tsbuildinfo')) {\n tsCompilerHost.writeFile(fileName, data, writeByteOrderMark, onError, sourceFiles);\n }\n })\n ) {\n // empty\n }\n }\n\n for (const sourceFile of builder.getSourceFiles()) {\n if (ignoreForEmit.has(sourceFile)) {\n continue;\n }\n\n if (angularCompiler.incrementalCompilation.safeToSkipEmit(sourceFile)) {\n continue;\n }\n\n builder.emit(sourceFile, undefined, undefined, undefined, transformers);\n angularCompiler.incrementalCompilation.recordSuccessfulEmit(sourceFile);\n }\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createCssResourcePlugin = void 0;
10
+ exports.createCssResourcePlugin = createCssResourcePlugin;
11
11
  const promises_1 = require("node:fs/promises");
12
12
  const node_path_1 = require("node:path");
13
13
  const stylesheet_processor_1 = require("./stylesheet-processor");
@@ -105,5 +105,4 @@ function createCssResourcePlugin(url) {
105
105
  },
106
106
  };
107
107
  }
108
- exports.createCssResourcePlugin = createCssResourcePlugin;
109
108
  //# sourceMappingURL=css-resource-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"css-resource-plugin.js","sourceRoot":"","sources":["../../../src/lib/styles/css-resource-plugin.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAGH,+CAA4C;AAC5C,yCAAoD;AACpD,iEAAgD;AAEhD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW;IACjD,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,KAAK,CAAC,KAAkB;YACtB,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC7C,kEAAkE;gBAClE,yEAAyE;gBACzE,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,KAAI,MAAA,IAAI,CAAC,UAAU,0CAAG,uBAAuB,CAAC,CAAA,EAAE,CAAC;oBAC5E,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,qFAAqF;gBACrF,qBAAqB;gBACrB,IAAI,GAAG,KAAK,6BAAM,CAAC,MAAM,IAAI,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC,IAA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2F;gBAC3F,uCAAuC;gBACvC,IAAI,MAAM,CAAC,SAAS,KAAK,MAAM,EAAE,CAAC;oBAChC,OAAO,MAAM,CAAC;gBAChB,CAAC;gBAED,uFAAuF;gBACvF,OAAO;oBACL,GAAG,MAAM;oBACT,yFAAyF;oBACzF,wFAAwF;oBACxF,IAAI,EAAE,IAAA,oBAAQ,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;oBACrE,SAAS,EAAE,sBAAsB;iBAClC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC5E,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE/E,OAAO;oBACL,QAAQ,EAAE,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC;oBACtC,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AArFD,0DAqFC","sourcesContent":["/**\n * @license\n * Copyright Google LLC 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\nimport type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { CssUrl } from './stylesheet-processor';\n\nconst CSS_RESOURCE_NAMESPACE = 'angular:css-resource';\n\n/**\n * Symbol marker used to indicate CSS resource resolution is being attempted.\n * This is used to prevent an infinite loop within the plugin's resolve hook.\n */\nconst CSS_RESOURCE_RESOLUTION = Symbol('CSS_RESOURCE_RESOLUTION');\n\n/**\n * Creates an esbuild {@link Plugin} that loads all CSS url token references using the\n * built-in esbuild `file` loader. A plugin is used to allow for all file extensions\n * and types to be supported without needing to manually specify all extensions\n * within the build configuration.\n *\n * @returns An esbuild {@link Plugin} instance.\n */\nexport function createCssResourcePlugin(url: CssUrl): Plugin {\n return {\n name: 'angular-css-resource',\n setup(build: PluginBuild): void {\n build.onResolve({ filter: /.*/ }, async args => {\n // Only attempt to resolve url tokens which only exist inside CSS.\n // Also, skip this plugin if already attempting to resolve the url-token.\n if (args.kind !== 'url-token' || args.pluginData?.[CSS_RESOURCE_RESOLUTION]) {\n return null;\n }\n\n // If root-relative, absolute or protocol relative url, mark as external to leave the\n // path/URL in place.\n if (url !== CssUrl.inline || /^((?:\\w+:)?\\/\\/|data:|chrome:|#|\\/)/.test(args.path)) {\n return {\n path: args.path,\n external: true,\n };\n }\n\n const { importer, kind, resolveDir, namespace, pluginData = {} } = args;\n pluginData[CSS_RESOURCE_RESOLUTION] = true;\n\n const result = await build.resolve(args.path, {\n importer,\n kind,\n namespace,\n pluginData,\n resolveDir,\n });\n\n if (result.errors.length) {\n const error = result.errors[0];\n if (args.path[0] === '~') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the tilde and use a relative path to reference it, which should remove this error.',\n },\n ];\n } else if (args.path[0] === '^') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the caret and use a relative path to reference it, which should remove this error.',\n },\n ];\n }\n\n const extension = importer && extname(importer);\n if (extension !== '.css') {\n error.notes.push({\n location: null,\n text: 'Preprocessor stylesheets may not show the exact file location of the error.',\n });\n }\n }\n\n // Return results that are not files since these are most likely specific to another plugin\n // and cannot be loaded by this plugin.\n if (result.namespace !== 'file') {\n return result;\n }\n\n // All file results are considered CSS resources and will be loaded via the file loader\n return {\n ...result,\n // Use a relative path to prevent fully resolved paths in the metafile (JSON stats file).\n // This is only necessary for custom namespaces. esbuild will handle the file namespace.\n path: relative(build.initialOptions.absWorkingDir ?? '', result.path),\n namespace: CSS_RESOURCE_NAMESPACE,\n };\n });\n\n build.onLoad({ filter: /./, namespace: CSS_RESOURCE_NAMESPACE }, async args => {\n const resourcePath = join(build.initialOptions.absWorkingDir ?? '', args.path);\n\n return {\n contents: await readFile(resourcePath),\n loader: 'dataurl',\n watchFiles: [resourcePath],\n };\n });\n },\n };\n}\n"]}
1
+ {"version":3,"file":"css-resource-plugin.js","sourceRoot":"","sources":["../../../src/lib/styles/css-resource-plugin.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAuBH,0DAqFC;AAzGD,+CAA4C;AAC5C,yCAAoD;AACpD,iEAAgD;AAEhD,MAAM,sBAAsB,GAAG,sBAAsB,CAAC;AAEtD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAElE;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,GAAW;IACjD,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,KAAK,CAAC,KAAkB;YACtB,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC7C,kEAAkE;gBAClE,yEAAyE;gBACzE,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,KAAI,MAAA,IAAI,CAAC,UAAU,0CAAG,uBAAuB,CAAC,CAAA,EAAE,CAAC;oBAC5E,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,qFAAqF;gBACrF,qBAAqB;gBACrB,IAAI,GAAG,KAAK,6BAAM,CAAC,MAAM,IAAI,qCAAqC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACnF,OAAO;wBACL,IAAI,EAAE,IAAI,CAAC,IAAI;wBACf,QAAQ,EAAE,IAAI;qBACf,CAAC;gBACJ,CAAC;gBAED,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,EAAE,EAAE,GA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,oBAAQ,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC;oBACrE,SAAS,EAAE,sBAAsB;iBAClC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,sBAAsB,EAAE,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;;gBAC5E,MAAM,YAAY,GAAG,IAAA,gBAAI,EAAC,MAAA,KAAK,CAAC,cAAc,CAAC,aAAa,mCAAI,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAE/E,OAAO;oBACL,QAAQ,EAAE,MAAM,IAAA,mBAAQ,EAAC,YAAY,CAAC;oBACtC,MAAM,EAAE,SAAS;oBACjB,UAAU,EAAE,CAAC,YAAY,CAAC;iBAC3B,CAAC;YACJ,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google LLC 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\nimport type { Plugin, PluginBuild } from 'esbuild';\nimport { readFile } from 'node:fs/promises';\nimport { extname, join, relative } from 'node:path';\nimport { CssUrl } from './stylesheet-processor';\n\nconst CSS_RESOURCE_NAMESPACE = 'angular:css-resource';\n\n/**\n * Symbol marker used to indicate CSS resource resolution is being attempted.\n * This is used to prevent an infinite loop within the plugin's resolve hook.\n */\nconst CSS_RESOURCE_RESOLUTION = Symbol('CSS_RESOURCE_RESOLUTION');\n\n/**\n * Creates an esbuild {@link Plugin} that loads all CSS url token references using the\n * built-in esbuild `file` loader. A plugin is used to allow for all file extensions\n * and types to be supported without needing to manually specify all extensions\n * within the build configuration.\n *\n * @returns An esbuild {@link Plugin} instance.\n */\nexport function createCssResourcePlugin(url: CssUrl): Plugin {\n return {\n name: 'angular-css-resource',\n setup(build: PluginBuild): void {\n build.onResolve({ filter: /.*/ }, async args => {\n // Only attempt to resolve url tokens which only exist inside CSS.\n // Also, skip this plugin if already attempting to resolve the url-token.\n if (args.kind !== 'url-token' || args.pluginData?.[CSS_RESOURCE_RESOLUTION]) {\n return null;\n }\n\n // If root-relative, absolute or protocol relative url, mark as external to leave the\n // path/URL in place.\n if (url !== CssUrl.inline || /^((?:\\w+:)?\\/\\/|data:|chrome:|#|\\/)/.test(args.path)) {\n return {\n path: args.path,\n external: true,\n };\n }\n\n const { importer, kind, resolveDir, namespace, pluginData = {} } = args;\n pluginData[CSS_RESOURCE_RESOLUTION] = true;\n\n const result = await build.resolve(args.path, {\n importer,\n kind,\n namespace,\n pluginData,\n resolveDir,\n });\n\n if (result.errors.length) {\n const error = result.errors[0];\n if (args.path[0] === '~') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the tilde and use a relative path to reference it, which should remove this error.',\n },\n ];\n } else if (args.path[0] === '^') {\n error.notes = [\n {\n location: null,\n text: 'You can remove the caret and use a relative path to reference it, which should remove this error.',\n },\n ];\n }\n\n const extension = importer && extname(importer);\n if (extension !== '.css') {\n error.notes.push({\n location: null,\n text: 'Preprocessor stylesheets may not show the exact file location of the error.',\n });\n }\n }\n\n // Return results that are not files since these are most likely specific to another plugin\n // and cannot be loaded by this plugin.\n if (result.namespace !== 'file') {\n return result;\n }\n\n // All file results are considered CSS resources and will be loaded via the file loader\n return {\n ...result,\n // Use a relative path to prevent fully resolved paths in the metafile (JSON stats file).\n // This is only necessary for custom namespaces. esbuild will handle the file namespace.\n path: relative(build.initialOptions.absWorkingDir ?? '', result.path),\n namespace: CSS_RESOURCE_NAMESPACE,\n };\n });\n\n build.onLoad({ filter: /./, namespace: CSS_RESOURCE_NAMESPACE }, async args => {\n const resourcePath = join(build.initialOptions.absWorkingDir ?? '', args.path);\n\n return {\n contents: await readFile(resourcePath),\n loader: 'dataurl',\n watchFiles: [resourcePath],\n };\n });\n },\n };\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadPostcssConfiguration = exports.findTailwindConfiguration = exports.generateSearchDirectories = void 0;
3
+ exports.generateSearchDirectories = generateSearchDirectories;
4
+ exports.findTailwindConfiguration = findTailwindConfiguration;
5
+ exports.loadPostcssConfiguration = loadPostcssConfiguration;
4
6
  const node_fs_1 = require("node:fs");
5
7
  const node_path_1 = require("node:path");
6
8
  const postcssConfigurationFiles = ['postcss.config.json', '.postcssrc.json'];
@@ -20,7 +22,6 @@ function generateSearchDirectories(roots) {
20
22
  };
21
23
  });
22
24
  }
23
- exports.generateSearchDirectories = generateSearchDirectories;
24
25
  function findFile(searchDirectories, potentialFiles) {
25
26
  for (const { root, files } of searchDirectories) {
26
27
  for (const potential of potentialFiles) {
@@ -34,7 +35,6 @@ function findFile(searchDirectories, potentialFiles) {
34
35
  function findTailwindConfiguration(searchDirectories) {
35
36
  return findFile(searchDirectories, tailwindConfigFiles);
36
37
  }
37
- exports.findTailwindConfiguration = findTailwindConfiguration;
38
38
  function readPostcssConfiguration(configurationFile) {
39
39
  const data = (0, node_fs_1.readFileSync)(configurationFile, 'utf-8');
40
40
  const config = JSON.parse(data);
@@ -80,5 +80,4 @@ function loadPostcssConfiguration(searchDirectories) {
80
80
  }
81
81
  return config;
82
82
  }
83
- exports.loadPostcssConfiguration = loadPostcssConfiguration;
84
83
  //# sourceMappingURL=postcss-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"postcss-configuration.js","sourceRoot":"","sources":["../../../src/lib/styles/postcss-configuration.ts"],"names":[],"mappings":";;;AAAA,qCAAoD;AACpD,yCAAiC;AAUjC,MAAM,yBAAyB,GAAa,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;AACvF,MAAM,mBAAmB,GAAa;IACpC,oBAAoB;IACpB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;CACrB,CAAC;AAOF,SAAgB,yBAAyB,CAAC,KAAe;IACvD,O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;YAC7E,SAAS;QACX,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA/CD,4DA+CC","sourcesContent":["import { readFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport interface PostcssConfiguration {\n plugins: [name: string, options?: object | string][];\n}\n\ninterface RawPostcssConfiguration {\n plugins?: Record<string, object | boolean | string> | (string | [string, object])[];\n}\n\nconst postcssConfigurationFiles: string[] = ['postcss.config.json', '.postcssrc.json'];\nconst tailwindConfigFiles: string[] = [\n 'tailwind.config.js',\n 'tailwind.config.cjs',\n 'tailwind.config.mjs',\n 'tailwind.config.ts',\n];\n\nexport interface SearchDirectory {\n root: string;\n files: Set<string>;\n}\n\nexport function generateSearchDirectories(roots: string[]): SearchDirectory[] {\n return roots.map(root => {\n return {\n root,\n files: new Set(\n readdirSync(root, { withFileTypes: true })\n .filter(entry => entry.isFile())\n .map(entry => entry.name),\n ),\n };\n });\n}\n\nfunction findFile(searchDirectories: SearchDirectory[], potentialFiles: string[]): string | undefined {\n for (const { root, files } of searchDirectories) {\n for (const potential of potentialFiles) {\n if (files.has(potential)) {\n return join(root, potential);\n }\n }\n }\n\n return undefined;\n}\n\nexport function findTailwindConfiguration(searchDirectories: SearchDirectory[]): string | undefined {\n return findFile(searchDirectories, tailwindConfigFiles);\n}\n\nfunction readPostcssConfiguration(configurationFile: string): RawPostcssConfiguration {\n const data = readFileSync(configurationFile, 'utf-8');\n const config = JSON.parse(data) as RawPostcssConfiguration;\n\n return config;\n}\n\nexport function loadPostcssConfiguration(searchDirectories: SearchDirectory[]): PostcssConfiguration | undefined {\n const configPath = findFile(searchDirectories, postcssConfigurationFiles);\n if (!configPath) {\n return undefined;\n }\n\n const raw = readPostcssConfiguration(configPath);\n\n // If no plugins are defined, consider it equivalent to no configuration\n if (!raw.plugins || typeof raw.plugins !== 'object') {\n return undefined;\n }\n\n // Normalize plugin array form\n if (Array.isArray(raw.plugins)) {\n if (raw.plugins.length < 1) {\n return undefined;\n }\n\n const config: PostcssConfiguration = { plugins: [] };\n for (const element of raw.plugins) {\n if (typeof element === 'string') {\n config.plugins.push([element]);\n } else {\n config.plugins.push(element);\n }\n }\n\n return config;\n }\n\n // Normalize plugin object map form\n const entries = Object.entries(raw.plugins);\n if (entries.length < 1) {\n return undefined;\n }\n\n const config: PostcssConfiguration = { plugins: [] };\n for (const [name, options] of entries) {\n if (!options || (typeof options !== 'object' && typeof options !== 'string')) {\n continue;\n }\n\n config.plugins.push([name, options]);\n }\n\n return config;\n}\n"]}
1
+ {"version":3,"file":"postcss-configuration.js","sourceRoot":"","sources":["../../../src/lib/styles/postcss-configuration.ts"],"names":[],"mappings":";;AAwBA,8DAWC;AAcD,8DAEC;AASD,4DA+CC;AA3GD,qCAAoD;AACpD,yCAAiC;AAUjC,MAAM,yBAAyB,GAAa,CAAC,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;AACvF,MAAM,mBAAmB,GAAa;IACpC,oBAAoB;IACpB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;CACrB,CAAC;AAOF,SAAgB,yBAAyB,CAAC,KAAe;IACvD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACtB,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,IAAI,GAAG,CACZ,IAAA,qBAAW,EAAC,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;iBACvC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;iBAC/B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAC5B;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,iBAAoC,EAAE,cAAwB;IAC9E,KAAK,MAAM,EAAE,IAAI,EAAE,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C;QACrD,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YAClC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;gBAChC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,mCAAmC;IACnC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAyB,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACrD,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,OAAO,EAAE,CAAC;QACtC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC7E,SAAS;QACX,CAAC;QAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { readFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport interface PostcssConfiguration {\n plugins: [name: string, options?: object | string][];\n}\n\ninterface RawPostcssConfiguration {\n plugins?: Record<string, object | boolean | string> | (string | [string, object])[];\n}\n\nconst postcssConfigurationFiles: string[] = ['postcss.config.json', '.postcssrc.json'];\nconst tailwindConfigFiles: string[] = [\n 'tailwind.config.js',\n 'tailwind.config.cjs',\n 'tailwind.config.mjs',\n 'tailwind.config.ts',\n];\n\nexport interface SearchDirectory {\n root: string;\n files: Set<string>;\n}\n\nexport function generateSearchDirectories(roots: string[]): SearchDirectory[] {\n return roots.map(root => {\n return {\n root,\n files: new Set(\n readdirSync(root, { withFileTypes: true })\n .filter(entry => entry.isFile())\n .map(entry => entry.name),\n ),\n };\n });\n}\n\nfunction findFile(searchDirectories: SearchDirectory[], potentialFiles: string[]): string | undefined {\n for (const { root, files } of searchDirectories) {\n for (const potential of potentialFiles) {\n if (files.has(potential)) {\n return join(root, potential);\n }\n }\n }\n\n return undefined;\n}\n\nexport function findTailwindConfiguration(searchDirectories: SearchDirectory[]): string | undefined {\n return findFile(searchDirectories, tailwindConfigFiles);\n}\n\nfunction readPostcssConfiguration(configurationFile: string): RawPostcssConfiguration {\n const data = readFileSync(configurationFile, 'utf-8');\n const config = JSON.parse(data) as RawPostcssConfiguration;\n\n return config;\n}\n\nexport function loadPostcssConfiguration(searchDirectories: SearchDirectory[]): PostcssConfiguration | undefined {\n const configPath = findFile(searchDirectories, postcssConfigurationFiles);\n if (!configPath) {\n return undefined;\n }\n\n const raw = readPostcssConfiguration(configPath);\n\n // If no plugins are defined, consider it equivalent to no configuration\n if (!raw.plugins || typeof raw.plugins !== 'object') {\n return undefined;\n }\n\n // Normalize plugin array form\n if (Array.isArray(raw.plugins)) {\n if (raw.plugins.length < 1) {\n return undefined;\n }\n\n const config: PostcssConfiguration = { plugins: [] };\n for (const element of raw.plugins) {\n if (typeof element === 'string') {\n config.plugins.push([element]);\n } else {\n config.plugins.push(element);\n }\n }\n\n return config;\n }\n\n // Normalize plugin object map form\n const entries = Object.entries(raw.plugins);\n if (entries.length < 1) {\n return undefined;\n }\n\n const config: PostcssConfiguration = { plugins: [] };\n for (const [name, options] of entries) {\n if (!options || (typeof options !== 'object' && typeof options !== 'string')) {\n continue;\n }\n\n config.plugins.push([name, options]);\n }\n\n return config;\n}\n"]}
@@ -26,7 +26,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
29
+ exports.cacheCompilerHost = cacheCompilerHost;
30
+ exports.augmentProgramWithVersioning = augmentProgramWithVersioning;
30
31
  const convert_source_map_1 = __importDefault(require("convert-source-map"));
31
32
  const crypto_1 = require("crypto");
32
33
  const node_assert_1 = __importDefault(require("node:assert"));
@@ -207,7 +208,6 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
207
208
  },
208
209
  };
209
210
  }
210
- exports.cacheCompilerHost = cacheCompilerHost;
211
211
  function augmentProgramWithVersioning(program) {
212
212
  const baseGetSourceFiles = program.getSourceFiles;
213
213
  program.getSourceFiles = function (...parameters) {
@@ -220,5 +220,4 @@ function augmentProgramWithVersioning(program) {
220
220
  return files;
221
221
  };
222
222
  }
223
- exports.augmentProgramWithVersioning = augmentProgramWithVersioning;
224
223
  //# sourceMappingURL=cache-compiler-host.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../src/lib/ts/cache-compiler-host.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAAkD;AAClD,mCAAoC;AACpC,8DAAiC;AACjC,2CAA6B;AAC7B,4DAA4B;AAI5B,wCAAqC;AACrC,+CAA8D;AAE9D,wCAA+C;AAE/C,SAAgB,iBAAiB,CAC/B,KAAiB,EACjB,UAA0B,EAC1B,eAAgC,EAChC,qBAA+C,EAC/C,mBAAyC,EACzC,mBAA4D,EAC5D,mBAA8B,UAAU,CAAC,KAAK,CAAC,gBAAgB;IAE/D,MAAM,YAAY,GAAG,oBAAE,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;IAEvE,oFAAoF;IACpF,sEAAsE;IACtE,mFAAmF;IACnF,IAAI,oBAAE,CAAC,gBAAgB,EAAE,CAAC;QACxB,YAAY,CAAC,gBAAgB,GAAG,o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AU;QAC9C,MAAM,KAAK,GAAsD,kBAAkB,CAAC,GAAG,UAAU,CAAC,CAAC;QAEnG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAbD,oEAaC","sourcesContent":["import type { CompilerHost, CompilerOptions } from '@angular/compiler-cli';\nimport convertSourceMap from 'convert-source-map';\nimport { createHash } from 'crypto';\nimport assert from 'node:assert';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { FileCache } from '../file-system/file-cache';\nimport { BuildGraph } from '../graph/build-graph';\nimport { Node } from '../graph/node';\nimport { EntryPointNode, fileUrl } from '../ng-package/nodes';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { ensureUnixPath } from '../utils/path';\n\nexport function cacheCompilerHost(\n graph: BuildGraph,\n entryPoint: EntryPointNode,\n compilerOptions: CompilerOptions,\n moduleResolutionCache: ts.ModuleResolutionCache,\n stylesheetProcessor?: StylesheetProcessor,\n inlineStyleLanguage?: NgPackageConfig['inlineStyleLanguage'],\n sourcesFileCache: FileCache = entryPoint.cache.sourcesFileCache,\n): CompilerHost {\n const compilerHost = ts.createIncrementalCompilerHost(compilerOptions);\n\n // Set the parsing mode to the same as TS 5.3 default for tsc. This provides a parse\n // performance improvement by skipping non-type related JSDoc parsing.\n // NOTE: The check for this enum can be removed when TS 5.3 support is the minimum.\n if (ts.JSDocParsingMode) {\n compilerHost.jsDocParsingMode = ts.JSDocParsingMode.ParseForTypeErrors;\n }\n\n const getNode = (fileName: string) => {\n const nodeUri = fileUrl(ensureUnixPath(fileName));\n let node = graph.get(nodeUri);\n\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n\n return node;\n };\n\n const addDependee = (fileName: string) => {\n const node = getNode(fileName);\n entryPoint.dependsOn(node);\n };\n\n const { flatModuleFile, destinationPath, entryFile } = entryPoint.data.entryPoint;\n const flatModuleFileDtsFilename = `${flatModuleFile}.d.ts`;\n const flatModuleFileDtsPath = ensureUnixPath(path.join(destinationPath, flatModuleFileDtsFilename));\n const hasIndexEntryFile = path.basename(entryFile.toLowerCase()) === 'index.ts';\n\n return {\n ...compilerHost,\n\n // ts specific\n fileExists: (fileName: string) => {\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.exists === undefined) {\n cache.exists = compilerHost.fileExists.call(this, fileName);\n }\n\n return cache.exists;\n },\n\n getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (!cache.sourceFile) {\n cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);\n }\n\n return cache.sourceFile;\n },\n\n writeFile: (\n fileName: string,\n data: string,\n writeByteOrderMark: boolean,\n onError?: (message: string) => void,\n sourceFiles?: ReadonlyArray<ts.SourceFile>,\n ) => {\n if (fileName.includes('.ngtypecheck.')) {\n return;\n }\n\n if (!sourceFiles?.length && fileName.endsWith('.tsbuildinfo')) {\n // Save builder info contents to specified location\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n\n return;\n }\n\n assert(sourceFiles?.length === 1, 'Invalid TypeScript program emit for ' + fileName);\n const outputCache = entryPoint.cache.outputCache;\n\n if (fileName.endsWith('.d.ts')) {\n if (fileName === flatModuleFileDtsPath) {\n if (hasIndexEntryFile) {\n // In case the entry file is index.ts, we should not emit the `d.ts` which are a re-export of the `index.ts`.\n // Because it will cause a conflict.\n return;\n } else {\n // Rename file to index.d.ts so that TypeScript can resolve types without\n // them needing to be referenced in the package.json manifest.\n fileName = fileName.replace(flatModuleFileDtsFilename, 'index.d.ts');\n }\n }\n\n sourceFiles.forEach(source => {\n const cache = sourcesFileCache.getOrCreate(source.fileName);\n if (!cache.declarationFileName) {\n cache.declarationFileName = ensureUnixPath(fileName);\n }\n });\n\n if (outputCache.get(fileName)?.content === data) {\n // Only emit files that changed content.\n return;\n }\n\n outputCache.set(fileName, {\n content: data,\n });\n } else {\n fileName = fileName.replace(/\\.js(\\.map)?$/, '.mjs$1');\n if (outputCache.get(fileName)?.content === data) {\n return;\n }\n\n // Extract inline sourcemap which will later be used by rollup.\n let map = undefined;\n const version = createHash('sha256').update(data).digest('hex');\n\n if (fileName.endsWith('.mjs')) {\n if (outputCache.get(fileName)?.version === version) {\n // Only emit changed files\n return;\n }\n\n map = convertSourceMap.fromComment(data).toJSON();\n }\n\n outputCache.set(fileName, {\n content: data,\n version,\n map,\n });\n }\n\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n },\n\n readFile: (fileName: string) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = compilerHost.readFile.call(this, fileName);\n }\n\n return cache.content;\n },\n\n resolveModuleNames: (moduleNames: string[], containingFile: string) => {\n return moduleNames.map(moduleName => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule;\n });\n },\n\n resourceNameToFileName: (resourceName: string, containingFilePath: string) => {\n const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);\n const containingNode = getNode(containingFilePath);\n const resourceNode = getNode(resourcePath);\n containingNode.dependsOn(resourceNode);\n\n return resourcePath;\n },\n\n readResource: async (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n if (!compilerHost.fileExists(fileName)) {\n throw new Error(`Cannot read file ${fileName}.`);\n }\n\n if (/(?:html?|svg)$/.test(path.extname(fileName))) {\n // template\n cache.content = compilerHost.readFile.call(this, fileName);\n } else {\n // stylesheet\n cache.content = await stylesheetProcessor.process({\n filePath: fileName,\n content: compilerHost.readFile.call(this, fileName),\n });\n }\n\n cache.exists = true;\n }\n\n return cache.content;\n },\n transformResource: async (data, context) => {\n if (context.resourceFile || context.type !== 'style') {\n return null;\n }\n\n if (inlineStyleLanguage) {\n const key = createHash('sha1').update(data).digest('hex');\n const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = await stylesheetProcessor.process({\n filePath: fileName,\n content: data,\n });\n\n const virtualFileNode = getNode(fileName);\n const containingFileNode = getNode(context.containingFile);\n virtualFileNode.dependsOn(containingFileNode);\n }\n\n cache.exists = true;\n\n return { content: cache.content };\n }\n\n return null;\n },\n };\n}\n\nexport function augmentProgramWithVersioning(program: ts.Program): void {\n const baseGetSourceFiles = program.getSourceFiles;\n program.getSourceFiles = function (...parameters) {\n const files: readonly (ts.SourceFile & { version?: string })[] = baseGetSourceFiles(...parameters);\n\n for (const file of files) {\n if (file.version === undefined) {\n file.version = createHash('sha256').update(file.text).digest('hex');\n }\n }\n\n return files;\n };\n}\n"]}
1
+ {"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../src/lib/ts/cache-compiler-host.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,8CAmOC;AAED,oEAaC;AA/PD,4EAAkD;AAClD,mCAAoC;AACpC,8DAAiC;AACjC,2CAA6B;AAC7B,4DAA4B;AAI5B,wCAAqC;AACrC,+CAA8D;AAE9D,wCAA+C;AAE/C,SAAgB,iBAAiB,CAC/B,KAAiB,EACjB,UAA0B,EAC1B,eAAgC,EAChC,qBAA+C,EAC/C,mBAAyC,EACzC,mBAA4D,EAC5D,mBAA8B,UAAU,CAAC,KAAK,CAAC,gBAAgB;IAE/D,MA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CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAgB,4BAA4B,CAAC,OAAmB;IAC9D,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAClD,OAAO,CAAC,cAAc,GAAG,UAAU,GAAG,UAAU;QAC9C,MAAM,KAAK,GAAsD,kBAAkB,CAAC,GAAG,UAAU,CAAC,CAAC;QAEnG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { CompilerHost, CompilerOptions } from '@angular/compiler-cli';\nimport convertSourceMap from 'convert-source-map';\nimport { createHash } from 'crypto';\nimport assert from 'node:assert';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { NgPackageConfig } from '../../ng-package.schema';\nimport { FileCache } from '../file-system/file-cache';\nimport { BuildGraph } from '../graph/build-graph';\nimport { Node } from '../graph/node';\nimport { EntryPointNode, fileUrl } from '../ng-package/nodes';\nimport { StylesheetProcessor } from '../styles/stylesheet-processor';\nimport { ensureUnixPath } from '../utils/path';\n\nexport function cacheCompilerHost(\n graph: BuildGraph,\n entryPoint: EntryPointNode,\n compilerOptions: CompilerOptions,\n moduleResolutionCache: ts.ModuleResolutionCache,\n stylesheetProcessor?: StylesheetProcessor,\n inlineStyleLanguage?: NgPackageConfig['inlineStyleLanguage'],\n sourcesFileCache: FileCache = entryPoint.cache.sourcesFileCache,\n): CompilerHost {\n const compilerHost = ts.createIncrementalCompilerHost(compilerOptions);\n\n // Set the parsing mode to the same as TS 5.3 default for tsc. This provides a parse\n // performance improvement by skipping non-type related JSDoc parsing.\n // NOTE: The check for this enum can be removed when TS 5.3 support is the minimum.\n if (ts.JSDocParsingMode) {\n compilerHost.jsDocParsingMode = ts.JSDocParsingMode.ParseForTypeErrors;\n }\n\n const getNode = (fileName: string) => {\n const nodeUri = fileUrl(ensureUnixPath(fileName));\n let node = graph.get(nodeUri);\n\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n\n return node;\n };\n\n const addDependee = (fileName: string) => {\n const node = getNode(fileName);\n entryPoint.dependsOn(node);\n };\n\n const { flatModuleFile, destinationPath, entryFile } = entryPoint.data.entryPoint;\n const flatModuleFileDtsFilename = `${flatModuleFile}.d.ts`;\n const flatModuleFileDtsPath = ensureUnixPath(path.join(destinationPath, flatModuleFileDtsFilename));\n const hasIndexEntryFile = path.basename(entryFile.toLowerCase()) === 'index.ts';\n\n return {\n ...compilerHost,\n\n // ts specific\n fileExists: (fileName: string) => {\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.exists === undefined) {\n cache.exists = compilerHost.fileExists.call(this, fileName);\n }\n\n return cache.exists;\n },\n\n getSourceFile: (fileName: string, languageVersion: ts.ScriptTarget) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (!cache.sourceFile) {\n cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);\n }\n\n return cache.sourceFile;\n },\n\n writeFile: (\n fileName: string,\n data: string,\n writeByteOrderMark: boolean,\n onError?: (message: string) => void,\n sourceFiles?: ReadonlyArray<ts.SourceFile>,\n ) => {\n if (fileName.includes('.ngtypecheck.')) {\n return;\n }\n\n if (!sourceFiles?.length && fileName.endsWith('.tsbuildinfo')) {\n // Save builder info contents to specified location\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n\n return;\n }\n\n assert(sourceFiles?.length === 1, 'Invalid TypeScript program emit for ' + fileName);\n const outputCache = entryPoint.cache.outputCache;\n\n if (fileName.endsWith('.d.ts')) {\n if (fileName === flatModuleFileDtsPath) {\n if (hasIndexEntryFile) {\n // In case the entry file is index.ts, we should not emit the `d.ts` which are a re-export of the `index.ts`.\n // Because it will cause a conflict.\n return;\n } else {\n // Rename file to index.d.ts so that TypeScript can resolve types without\n // them needing to be referenced in the package.json manifest.\n fileName = fileName.replace(flatModuleFileDtsFilename, 'index.d.ts');\n }\n }\n\n sourceFiles.forEach(source => {\n const cache = sourcesFileCache.getOrCreate(source.fileName);\n if (!cache.declarationFileName) {\n cache.declarationFileName = ensureUnixPath(fileName);\n }\n });\n\n if (outputCache.get(fileName)?.content === data) {\n // Only emit files that changed content.\n return;\n }\n\n outputCache.set(fileName, {\n content: data,\n });\n } else {\n fileName = fileName.replace(/\\.js(\\.map)?$/, '.mjs$1');\n if (outputCache.get(fileName)?.content === data) {\n return;\n }\n\n // Extract inline sourcemap which will later be used by rollup.\n let map = undefined;\n const version = createHash('sha256').update(data).digest('hex');\n\n if (fileName.endsWith('.mjs')) {\n if (outputCache.get(fileName)?.version === version) {\n // Only emit changed files\n return;\n }\n\n map = convertSourceMap.fromComment(data).toJSON();\n }\n\n outputCache.set(fileName, {\n content: data,\n version,\n map,\n });\n }\n\n compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);\n },\n\n readFile: (fileName: string) => {\n addDependee(fileName);\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = compilerHost.readFile.call(this, fileName);\n }\n\n return cache.content;\n },\n\n resolveModuleNames: (moduleNames: string[], containingFile: string) => {\n return moduleNames.map(moduleName => {\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n compilerOptions,\n compilerHost,\n moduleResolutionCache,\n );\n\n return resolvedModule;\n });\n },\n\n resourceNameToFileName: (resourceName: string, containingFilePath: string) => {\n const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);\n const containingNode = getNode(containingFilePath);\n const resourceNode = getNode(resourcePath);\n containingNode.dependsOn(resourceNode);\n\n return resourcePath;\n },\n\n readResource: async (fileName: string) => {\n addDependee(fileName);\n\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n if (!compilerHost.fileExists(fileName)) {\n throw new Error(`Cannot read file ${fileName}.`);\n }\n\n if (/(?:html?|svg)$/.test(path.extname(fileName))) {\n // template\n cache.content = compilerHost.readFile.call(this, fileName);\n } else {\n // stylesheet\n cache.content = await stylesheetProcessor.process({\n filePath: fileName,\n content: compilerHost.readFile.call(this, fileName),\n });\n }\n\n cache.exists = true;\n }\n\n return cache.content;\n },\n transformResource: async (data, context) => {\n if (context.resourceFile || context.type !== 'style') {\n return null;\n }\n\n if (inlineStyleLanguage) {\n const key = createHash('sha1').update(data).digest('hex');\n const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;\n const cache = sourcesFileCache.getOrCreate(fileName);\n if (cache.content === undefined) {\n cache.content = await stylesheetProcessor.process({\n filePath: fileName,\n content: data,\n });\n\n const virtualFileNode = getNode(fileName);\n const containingFileNode = getNode(context.containingFile);\n virtualFileNode.dependsOn(containingFileNode);\n }\n\n cache.exists = true;\n\n return { content: cache.content };\n }\n\n return null;\n },\n };\n}\n\nexport function augmentProgramWithVersioning(program: ts.Program): void {\n const baseGetSourceFiles = program.getSourceFiles;\n program.getSourceFiles = function (...parameters) {\n const files: readonly (ts.SourceFile & { version?: string })[] = baseGetSourceFiles(...parameters);\n\n for (const file of files) {\n if (file.version === undefined) {\n file.version = createHash('sha256').update(file.text).digest('hex');\n }\n }\n\n return files;\n };\n}\n"]}
@@ -26,7 +26,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.setDependenciesTsConfigPaths = exports.initializeTsConfig = exports.defaultTsConfigPath = void 0;
29
+ exports.defaultTsConfigPath = void 0;
30
+ exports.initializeTsConfig = initializeTsConfig;
31
+ exports.setDependenciesTsConfigPaths = setDependenciesTsConfigPaths;
30
32
  const path = __importStar(require("path"));
31
33
  const typescript_1 = __importDefault(require("typescript"));
32
34
  const load_esm_1 = require("../utils/load-esm");
@@ -98,7 +100,6 @@ async function initializeTsConfig(defaultTsConfig, entryPoints) {
98
100
  currentEntryPoint.data.tsConfig = tsConfig;
99
101
  });
100
102
  }
101
- exports.initializeTsConfig = initializeTsConfig;
102
103
  /**
103
104
  * Set the paths for entrypoint dependencies.
104
105
  *
@@ -128,5 +129,4 @@ function setDependenciesTsConfigPaths(parsedTsConfig, entryPoints, pointToSource
128
129
  }
129
130
  return tsConfig;
130
131
  }
131
- exports.setDependenciesTsConfigPaths = setDependenciesTsConfigPaths;
132
132
  //# sourceMappingURL=tsconfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,4DAA4B;AAE5B,gDAAkD;AAClD,kDAAoC;AAEvB,QAAA,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;AACrF;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,QAAQ,GAAG,2BAAmB;IAC/D,8BAA8B;IAC9B,MAAM,YAAY,GAAoB;QACpC,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;QAE9B,aAAa;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QAErB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,IAAI;QAEjB,cAAc;QACd,sBAAsB,EAAE,IAAI;QAE5B,sDAAsD;QACtD,YAAY,EAAE,eAAe;QAC7B,iBAAiB,EAAE,eAAe;KACnC,CAAC;IAEF,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,wBAAa,GAAE,CAAC;IAEpD,OAAO,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AAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzBD,oEAyBC","sourcesContent":["import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport * as log from '../utils/log';\n\nexport const defaultTsConfigPath = path.join(__dirname, 'conf', 'tsconfig.ngc.json');\n/**\n * Reads the default TypeScript configuration.\n */\nasync function readDefaultTsConfig(fileName = defaultTsConfigPath): Promise<ParsedConfiguration> {\n // these options are mandatory\n const extraOptions: CompilerOptions = {\n target: ts.ScriptTarget.ES2022,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const { readConfiguration } = await ngCompilerCli();\n\n return readConfiguration(fileName, extraOptions);\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nasync function createDefaultTsConfig(values?: ParsedConfiguration | string): Promise<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 async function initializeTsConfig(\n defaultTsConfig: ParsedConfiguration | string | undefined,\n entryPoints: EntryPointNode[],\n): Promise<void> {\n const defaultTsConfigParsed = await createDefaultTsConfig(defaultTsConfig);\n if (defaultTsConfigParsed.errors.length > 0) {\n const { formatDiagnostics } = await ngCompilerCli();\n throw new Error(formatDiagnostics(defaultTsConfigParsed.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 const tsConfig: ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfigParsed));\n const overrideOptions: CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: '',\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: ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): 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 (const 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,gDA6BC;AAYD,oEAyBC;AAzHD,2CAA6B;AAC7B,4DAA4B;AAE5B,gDAAkD;AAClD,kDAAoC;A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,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;QAC9B,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAChC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;QACjE,MAAM,UAAU,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;QAEnF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport * as log from '../utils/log';\n\nexport const defaultTsConfigPath = path.join(__dirname, 'conf', 'tsconfig.ngc.json');\n/**\n * Reads the default TypeScript configuration.\n */\nasync function readDefaultTsConfig(fileName = defaultTsConfigPath): Promise<ParsedConfiguration> {\n // these options are mandatory\n const extraOptions: CompilerOptions = {\n target: ts.ScriptTarget.ES2022,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const { readConfiguration } = await ngCompilerCli();\n\n return readConfiguration(fileName, extraOptions);\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nasync function createDefaultTsConfig(values?: ParsedConfiguration | string): Promise<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 async function initializeTsConfig(\n defaultTsConfig: ParsedConfiguration | string | undefined,\n entryPoints: EntryPointNode[],\n): Promise<void> {\n const defaultTsConfigParsed = await createDefaultTsConfig(defaultTsConfig);\n if (defaultTsConfigParsed.errors.length > 0) {\n const { formatDiagnostics } = await ngCompilerCli();\n throw new Error(formatDiagnostics(defaultTsConfigParsed.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 const tsConfig: ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfigParsed));\n const overrideOptions: CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: '',\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: ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): 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 (const 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,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unique = exports.toArray = void 0;
3
+ exports.toArray = toArray;
4
+ exports.unique = unique;
4
5
  function toArray(value) {
5
6
  return [].concat(value);
6
7
  }
7
- exports.toArray = toArray;
8
8
  function unique(value) {
9
9
  return [...new Set(value)];
10
10
  }
11
- exports.unique = unique;
12
11
  //# sourceMappingURL=array.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/lib/utils/array.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAI,KAAc;IACvC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAFD,0BAEC;AAED,SAAgB,MAAM,CAAI,KAAU;IAClC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC;AAFD,wBAEC","sourcesContent":["export function toArray<T>(value: T | T[]): T[] {\n return [].concat(value);\n}\n\nexport function unique<T>(value: T[]): T[] {\n return [...new Set(value)];\n}\n"]}
1
+ {"version":3,"file":"array.js","sourceRoot":"","sources":["../../../src/lib/utils/array.ts"],"names":[],"mappings":";;AAAA,0BAEC;AAED,wBAEC;AAND,SAAgB,OAAO,CAAI,KAAc;IACvC,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,SAAgB,MAAM,CAAI,KAAU;IAClC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["export function toArray<T>(value: T | T[]): T[] {\n return [].concat(value);\n}\n\nexport function unique<T>(value: T[]): T[] {\n return [...new Set(value)];\n}\n"]}
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.saveCacheEntry = exports.readCacheEntry = exports.generateKey = void 0;
26
+ exports.generateKey = generateKey;
27
+ exports.readCacheEntry = readCacheEntry;
28
+ exports.saveCacheEntry = saveCacheEntry;
27
29
  const cacache = __importStar(require("cacache"));
28
30
  const crypto_1 = require("crypto");
29
31
  const fs_1 = require("../utils/fs");
@@ -47,7 +49,6 @@ async function generateKey(...valuesToConsider) {
47
49
  .update(valuesToConsider.join(':'))
48
50
  .digest('hex');
49
51
  }
50
- exports.generateKey = generateKey;
51
52
  async function readCacheEntry(cachePath, key) {
52
53
  const entry = await cacache.get.info(cachePath, key);
53
54
  if (entry) {
@@ -55,9 +56,7 @@ async function readCacheEntry(cachePath, key) {
55
56
  }
56
57
  return undefined;
57
58
  }
58
- exports.readCacheEntry = readCacheEntry;
59
59
  async function saveCacheEntry(cachePath, key, content) {
60
60
  await cacache.put(cachePath, key, content);
61
61
  }
62
- exports.saveCacheEntry = saveCacheEntry;
63
62
  //# sourceMappingURL=cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/lib/utils/cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAmC;AACnC,mCAAoC;AACpC,oCAAuC;AACvC,yCAA2C;AAE3C,IAAI,gBAAoC,CAAC;AACzC,IAAI,CAAC;IACH,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAAC,MAAM,CAAC;IACP,WAAW;IACX,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,IAAI,kBAAsC,CAAC;AAEpC,KAAK,UAAU,WAAW,CAAC,GAAG,gBAA0B;IAC7D,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACrC,kBAAkB,GAAG,CAAC,MAAM,IAAA,wBAAa,GAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5D,CAAC;IAED,OAAO,IAAA,mBAAU,EAAC,MAAM,CAAC;SACtB,MAAM,CAAC,gBAAgB,CAAC;SACxB,MAAM,CAAC,kBAAkB,CAAC;SAC1B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAVD,kCAUC;AAEM,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,GAAW;IACjE,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAPD,wCAOC;AAEM,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,GAAW,EAAE,OAAe;IAClF,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAFD,wCAEC","sourcesContent":["import * as cacache from 'cacache';\nimport { createHash } from 'crypto';\nimport { readFile } from '../utils/fs';\nimport { ngCompilerCli } from './load-esm';\n\nlet ngPackagrVersion: string | undefined;\ntry {\n ngPackagrVersion = require('../../package.json').version;\n} catch {\n // dev path\n ngPackagrVersion = require('../../../package.json').version;\n}\n\nlet compilerCliVersion: string | undefined;\n\nexport async function generateKey(...valuesToConsider: string[]): Promise<string> {\n if (compilerCliVersion === undefined) {\n compilerCliVersion = (await ngCompilerCli()).VERSION.full;\n }\n\n return createHash('sha1')\n .update(ngPackagrVersion)\n .update(compilerCliVersion)\n .update(valuesToConsider.join(':'))\n .digest('hex');\n}\n\nexport async function readCacheEntry(cachePath: string, key: string): Promise<any> {\n const entry = await cacache.get.info(cachePath, key);\n if (entry) {\n return JSON.parse(await readFile(entry.path, 'utf8'));\n }\n\n return undefined;\n}\n\nexport async function saveCacheEntry(cachePath: string, key: string, content: string): Promise<void> {\n await cacache.put(cachePath, key, content);\n}\n"]}
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../src/lib/utils/cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAeA,kCAUC;AAED,wCAOC;AAED,wCAEC;AAtCD,iDAAmC;AACnC,mCAAoC;AACpC,oCAAuC;AACvC,yCAA2C;AAE3C,IAAI,gBAAoC,CAAC;AACzC,IAAI,CAAC;IACH,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAAC,MAAM,CAAC;IACP,WAAW;IACX,gBAAgB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAC9D,CAAC;AAED,IAAI,kBAAsC,CAAC;AAEpC,KAAK,UAAU,WAAW,CAAC,GAAG,gBAA0B;IAC7D,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;QACrC,kBAAkB,GAAG,CAAC,MAAM,IAAA,wBAAa,GAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC5D,CAAC;IAED,OAAO,IAAA,mBAAU,EAAC,MAAM,CAAC;SACtB,MAAM,CAAC,gBAAgB,CAAC;SACxB,MAAM,CAAC,kBAAkB,CAAC;SAC1B,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,GAAW;IACjE,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACrD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,aAAQ,EAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAEM,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,GAAW,EAAE,OAAe;IAClF,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import * as cacache from 'cacache';\nimport { createHash } from 'crypto';\nimport { readFile } from '../utils/fs';\nimport { ngCompilerCli } from './load-esm';\n\nlet ngPackagrVersion: string | undefined;\ntry {\n ngPackagrVersion = require('../../package.json').version;\n} catch {\n // dev path\n ngPackagrVersion = require('../../../package.json').version;\n}\n\nlet compilerCliVersion: string | undefined;\n\nexport async function generateKey(...valuesToConsider: string[]): Promise<string> {\n if (compilerCliVersion === undefined) {\n compilerCliVersion = (await ngCompilerCli()).VERSION.full;\n }\n\n return createHash('sha1')\n .update(ngPackagrVersion)\n .update(compilerCliVersion)\n .update(valuesToConsider.join(':'))\n .digest('hex');\n}\n\nexport async function readCacheEntry(cachePath: string, key: string): Promise<any> {\n const entry = await cacache.get.info(cachePath, key);\n if (entry) {\n return JSON.parse(await readFile(entry.path, 'utf8'));\n }\n\n return undefined;\n}\n\nexport async function saveCacheEntry(cachePath: string, key: string, content: string): Promise<void> {\n await cacache.put(cachePath, key, content);\n}\n"]}
package/lib/utils/fs.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import * as fs from 'fs';
4
2
  export declare const readFile: typeof fs.promises.readFile;
5
3
  export declare const writeFile: typeof fs.promises.writeFile;
package/lib/utils/fs.js CHANGED
@@ -23,7 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.copyFile = exports.exists = exports.rmdir = exports.stat = exports.mkdir = exports.access = exports.writeFile = exports.readFile = void 0;
26
+ exports.rmdir = exports.stat = exports.mkdir = exports.access = exports.writeFile = exports.readFile = void 0;
27
+ exports.exists = exists;
28
+ exports.copyFile = copyFile;
27
29
  const fs = __importStar(require("fs"));
28
30
  const path_1 = require("path");
29
31
  const util_1 = require("util");
@@ -42,7 +44,6 @@ async function exists(path) {
42
44
  return false;
43
45
  }
44
46
  }
45
- exports.exists = exists;
46
47
  const cpFile = (0, util_1.promisify)(fs.copyFile);
47
48
  async function copyFile(src, dest) {
48
49
  const dir = (0, path_1.dirname)(dest);
@@ -51,5 +52,4 @@ async function copyFile(src, dest) {
51
52
  }
52
53
  await cpFile(src, dest, fs.constants.COPYFILE_FICLONE);
53
54
  }
54
- exports.copyFile = copyFile;
55
55
  //# sourceMappingURL=fs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../src/lib/utils/fs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,+BAA+B;AAC/B,+BAAiC;AAEpB,QAAA,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAChC,QAAA,SAAS,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC;AAClC,QAAA,MAAM,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC5B,QAAA,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC1B,QAAA,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;AACxB,QAAA,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;AAE7B,KAAK,UAAU,MAAM,CAAC,IAAiB;IAC5C,IAAI,CAAC;QACH,MAAM,IAAA,cAAM,EAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEtC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AARD,wBAQC;AAED,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC/B,KAAK,UAAU,QAAQ,CAAC,GAAW,EAAE,IAAY;IACtD,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACzB,MAAM,IAAA,aAAK,EAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AACzD,CAAC;AAPD,4BAOC","sourcesContent":["import * as fs from 'fs';\nimport { dirname } from 'path';\nimport { promisify } from 'util';\n\nexport const readFile = fs.promises.readFile;\nexport const writeFile = fs.promises.writeFile;\nexport const access = fs.promises.access;\nexport const mkdir = fs.promises.mkdir;\nexport const stat = fs.promises.stat;\nexport const rmdir = fs.promises.rm;\n\nexport async function exists(path: fs.PathLike): Promise<boolean> {\n try {\n await access(path, fs.constants.F_OK);\n\n return true;\n } catch {\n return false;\n }\n}\n\nconst cpFile = promisify(fs.copyFile);\nexport async function copyFile(src: string, dest: string): Promise<void> {\n const dir = dirname(dest);\n if (!(await exists(dir))) {\n await mkdir(dir, { recursive: true });\n }\n\n await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AE,EAAE,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;AACzD,CAAC","sourcesContent":["import * as fs from 'fs';\nimport { dirname } from 'path';\nimport { promisify } from 'util';\n\nexport const readFile = fs.promises.readFile;\nexport const writeFile = fs.promises.writeFile;\nexport const access = fs.promises.access;\nexport const mkdir = fs.promises.mkdir;\nexport const stat = fs.promises.stat;\nexport const rmdir = fs.promises.rm;\n\nexport async function exists(path: fs.PathLike): Promise<boolean> {\n try {\n await access(path, fs.constants.F_OK);\n\n return true;\n } catch {\n return false;\n }\n}\n\nconst cpFile = promisify(fs.copyFile);\nexport async function copyFile(src: string, dest: string): Promise<void> {\n const dir = dirname(dest);\n if (!(await exists(dir))) {\n await mkdir(dir, { recursive: true });\n }\n\n await cpFile(src, dest, fs.constants.COPYFILE_FICLONE);\n}\n"]}
package/lib/utils/glob.js CHANGED
@@ -3,12 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.globFiles = void 0;
6
+ exports.globFiles = globFiles;
7
7
  const fast_glob_1 = __importDefault(require("fast-glob"));
8
8
  const array_1 = require("./array");
9
9
  async function globFiles(pattern, options) {
10
10
  const files = await Promise.all((0, array_1.toArray)(pattern).map(p => (0, fast_glob_1.default)(p, options)));
11
11
  return files.flatMap(x => x);
12
12
  }
13
- exports.globFiles = globFiles;
14
13
  //# sourceMappingURL=glob.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/lib/utils/glob.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA0C;AAC1C,mCAAkC;AAE3B,KAAK,UAAU,SAAS,CAAC,OAA0B,EAAE,OAAiB;IAC3E,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,mBAAI,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC;AAJD,8BAIC","sourcesContent":["import glob, { Options } from 'fast-glob';\nimport { toArray } from './array';\n\nexport async function globFiles(pattern: string | string[], options?: Options): Promise<string[]> {\n const files = await Promise.all(toArray(pattern).map(p => glob(p, options)));\n\n return files.flatMap(x => x);\n}\n"]}
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/lib/utils/glob.ts"],"names":[],"mappings":";;;;;AAGA,8BAIC;AAPD,0DAA0C;AAC1C,mCAAkC;AAE3B,KAAK,UAAU,SAAS,CAAC,OAA0B,EAAE,OAAiB;IAC3E,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAA,eAAO,EAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,mBAAI,EAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE7E,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import glob, { Options } from 'fast-glob';\nimport { toArray } from './array';\n\nexport async function globFiles(pattern: string | string[], options?: Options): Promise<string[]> {\n const files = await Promise.all(toArray(pattern).map(p => glob(p, options)));\n\n return files.flatMap(x => x);\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadEsmModule = exports.ngCompilerCli = void 0;
3
+ exports.ngCompilerCli = ngCompilerCli;
4
+ exports.loadEsmModule = loadEsmModule;
4
5
  function ngCompilerCli() {
5
6
  return loadEsmModule('@angular/compiler-cli');
6
7
  }
7
- exports.ngCompilerCli = ngCompilerCli;
8
8
  /**
9
9
  * Lazily compiled dynamic import loader function.
10
10
  */
@@ -25,5 +25,4 @@ function loadEsmModule(modulePath) {
25
25
  load !== null && load !== void 0 ? load : (load = new Function('modulePath', `return import(modulePath);`));
26
26
  return load(modulePath);
27
27
  }
28
- exports.loadEsmModule = loadEsmModule;
29
28
  //# sourceMappingURL=load-esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load-esm.js","sourceRoot":"","sources":["../../../src/lib/utils/load-esm.ts"],"names":[],"mappings":";;;AAAA,SAAgB,aAAa;IAC3B,OAAO,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAChD,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH,IAAI,IAA+D,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAI,UAAwB;IACvD,IAAI,aAAJ,IAAI,cAAJ,IAAI,IAAJ,IAAI,GAAK,IAAI,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAoC,EAAC;IAErG,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC;AAJD,sCAIC","sourcesContent":["export function ngCompilerCli(): Promise<typeof import('@angular/compiler-cli')> {\n return loadEsmModule('@angular/compiler-cli');\n}\n\n/**\n * Lazily compiled dynamic import loader function.\n */\nlet load: (<T>(modulePath: string | URL) => Promise<T>) | undefined;\n\n/**\n * This uses a dynamic import to load a module which may be ESM.\n * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript\n * will currently, unconditionally downlevel dynamic import into a require call.\n * require calls cannot load ESM code and will result in a runtime error. To workaround\n * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.\n * Once TypeScript provides support for keeping the dynamic import this workaround can\n * be dropped.\n *\n * @param modulePath The path of the module to load.\n * @returns A Promise that resolves to the dynamically imported module.\n */\nexport function loadEsmModule<T>(modulePath: string | URL): Promise<T> {\n load ??= new Function('modulePath', `return import(modulePath);`) as Exclude<typeof load, undefined>;\n\n return load(modulePath);\n}\n"]}
1
+ {"version":3,"file":"load-esm.js","sourceRoot":"","sources":["../../../src/lib/utils/load-esm.ts"],"names":[],"mappings":";;AAAA,sCAEC;AAmBD,sCAIC;AAzBD,SAAgB,aAAa;IAC3B,OAAO,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAChD,CAAC;AAED;;GAEG;AACH,IAAI,IAA+D,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,aAAa,CAAI,UAAwB;IACvD,IAAI,aAAJ,IAAI,cAAJ,IAAI,IAAJ,IAAI,GAAK,IAAI,QAAQ,CAAC,YAAY,EAAE,4BAA4B,CAAoC,EAAC;IAErG,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["export function ngCompilerCli(): Promise<typeof import('@angular/compiler-cli')> {\n return loadEsmModule('@angular/compiler-cli');\n}\n\n/**\n * Lazily compiled dynamic import loader function.\n */\nlet load: (<T>(modulePath: string | URL) => Promise<T>) | undefined;\n\n/**\n * This uses a dynamic import to load a module which may be ESM.\n * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript\n * will currently, unconditionally downlevel dynamic import into a require call.\n * require calls cannot load ESM code and will result in a runtime error. To workaround\n * this, a Function constructor is used to prevent TypeScript from changing the dynamic import.\n * Once TypeScript provides support for keeping the dynamic import this workaround can\n * be dropped.\n *\n * @param modulePath The path of the module to load.\n * @returns A Promise that resolves to the dynamically imported module.\n */\nexport function loadEsmModule<T>(modulePath: string | URL): Promise<T> {\n load ??= new Function('modulePath', `return import(modulePath);`) as Exclude<typeof load, undefined>;\n\n return load(modulePath);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "18.0.0",
3
+ "version": "18.1.0",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -48,7 +48,7 @@
48
48
  "commander": "^12.0.0",
49
49
  "convert-source-map": "^2.0.0",
50
50
  "dependency-graph": "^1.0.0",
51
- "esbuild": "^0.21.3",
51
+ "esbuild": "^0.23.0",
52
52
  "fast-glob": "^3.3.1",
53
53
  "find-cache-dir": "^3.3.2",
54
54
  "injection-js": "^2.4.0",
@@ -64,10 +64,10 @@
64
64
  "rollup": "^4.18.0"
65
65
  },
66
66
  "peerDependencies": {
67
- "@angular/compiler-cli": "^18.0.0-next.0 || ^18.1.0-next.0",
67
+ "@angular/compiler-cli": "^18.0.0 || ^18.2.0-next.0",
68
68
  "tailwindcss": "^2.0.0 || ^3.0.0",
69
69
  "tslib": "^2.3.0",
70
- "typescript": ">=5.4 <5.5"
70
+ "typescript": ">=5.4 <5.6"
71
71
  },
72
72
  "peerDependenciesMeta": {
73
73
  "tailwindcss": {