ng-packagr 17.0.1 → 17.0.3

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.
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- const rollup_1 = require("rollup");
5
4
  const typescript_1 = require("typescript");
6
5
  const load_esm_1 = require("../utils/load-esm");
7
6
  const log_1 = require("../utils/log");
@@ -13,7 +12,6 @@ const log_1 = require("../utils/log");
13
12
  const version = async () => {
14
13
  (0, log_1.msg)(`ng-packagr: ` + require('../../package.json').version);
15
14
  (0, log_1.msg)(`@angular/compiler: ` + (await (0, load_esm_1.ngCompilerCli)()).VERSION.full);
16
- (0, log_1.msg)(`rollup: ` + rollup_1.VERSION);
17
15
  (0, log_1.msg)(`typescript: ` + typescript_1.version);
18
16
  };
19
17
  exports.version = version;
@@ -1 +1 @@
1
- {"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../../src/lib/commands/version.command.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AACnD,2CAAmD;AACnD,gDAAkD;AAClD,sCAAmC;AAGnC;;;;GAIG;AACI,MAAM,OAAO,GAAgC,KAAK,IAAI,EAAE;IAC7D,IAAA,SAAG,EAAC,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;IACvE,IAAA,SAAG,EAAC,yBAAyB,GAAG,CAAC,MAAM,IAAA,wBAAa,GAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,IAAA,SAAG,EAAC,yBAAyB,GAAG,gBAAc,CAAC,CAAC;IAChD,IAAA,SAAG,EAAC,yBAAyB,GAAG,oBAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB","sourcesContent":["import { VERSION as ROLLUP_VERSION } from 'rollup';\nimport { version as TS_VERSION } from 'typescript';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport { msg } from '../utils/log';\nimport { Command } from './command';\n\n/**\n * Prints version information.\n *\n * @stable\n */\nexport const version: Command<any, Promise<void>> = async () => {\n msg(`ng-packagr: ` + require('../../package.json').version);\n msg(`@angular/compiler: ` + (await ngCompilerCli()).VERSION.full);\n msg(`rollup: ` + ROLLUP_VERSION);\n msg(`typescript: ` + TS_VERSION);\n};\n"]}
1
+ {"version":3,"file":"version.command.js","sourceRoot":"","sources":["../../../src/lib/commands/version.command.ts"],"names":[],"mappings":";;;AAAA,2CAAmD;AACnD,gDAAkD;AAClD,sCAAmC;AAGnC;;;;GAIG;AACI,MAAM,OAAO,GAAgC,KAAK,IAAI,EAAE;IAC7D,IAAA,SAAG,EAAC,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAC;IACvE,IAAA,SAAG,EAAC,yBAAyB,GAAG,CAAC,MAAM,IAAA,wBAAa,GAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,IAAA,SAAG,EAAC,yBAAyB,GAAG,oBAAU,CAAC,CAAC;AAC9C,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB","sourcesContent":["import { version as TS_VERSION } from 'typescript';\nimport { ngCompilerCli } from '../utils/load-esm';\nimport { msg } from '../utils/log';\nimport { Command } from './command';\n\n/**\n * Prints version information.\n *\n * @stable\n */\nexport const version: Command<any, Promise<void>> = async () => {\n msg(`ng-packagr: ` + require('../../package.json').version);\n msg(`@angular/compiler: ` + (await ngCompilerCli()).VERSION.full);\n msg(`typescript: ` + TS_VERSION);\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { Plugin } from 'rollup';
1
+ import type { Plugin } from 'rollup';
2
2
  import { OutputFileCache } from '../ng-package/nodes';
3
3
  /**
4
4
  * Loads a file and it's 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;gBACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;aACxD;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 { 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":";;;;;;;;;;;;;;;;;;;;;;;;;;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;gBACT,MAAM,IAAI,KAAK,CAAC,mBAAmB,EAAE,gBAAgB,CAAC,CAAC;aACxD;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,4 +1,4 @@
1
- import * as rollup from 'rollup';
1
+ import type { OutputAsset, OutputChunk, RollupCache } from 'rollup';
2
2
  import { OutputFileCache } from '../ng-package/nodes';
3
3
  /**
4
4
  * Options used in `ng-packagr` for writing flat bundle files.
@@ -11,13 +11,13 @@ export interface RollupOptions {
11
11
  entryName: string;
12
12
  dir: string;
13
13
  sourceRoot: string;
14
- cache?: rollup.RollupCache;
14
+ cache?: RollupCache;
15
15
  cacheDirectory?: string | false;
16
16
  fileCache: OutputFileCache;
17
17
  cacheKey: string;
18
18
  }
19
19
  /** Runs rollup over the given entry file, writes a bundle file. */
20
20
  export declare function rollupBundleFile(opts: RollupOptions): Promise<{
21
- cache: rollup.RollupCache;
22
- files: (rollup.OutputChunk | rollup.OutputAsset)[];
21
+ cache: RollupCache;
22
+ files: (OutputChunk | OutputAsset)[];
23
23
  }>;
@@ -30,13 +30,14 @@ exports.rollupBundleFile = void 0;
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"));
33
- const rollup = __importStar(require("rollup"));
34
33
  const cache_1 = require("../utils/cache");
35
34
  const log = __importStar(require("../utils/log"));
36
35
  const file_loader_plugin_1 = require("./file-loader-plugin");
36
+ let rollup;
37
37
  /** Runs rollup over the given entry file, writes a bundle file. */
38
38
  async function rollupBundleFile(opts) {
39
39
  var _a;
40
+ await ensureRollup();
40
41
  log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dir}`);
41
42
  const cacheDirectory = opts.cacheDirectory;
42
43
  // Create the bundle
@@ -84,6 +85,19 @@ async function rollupBundleFile(opts) {
84
85
  };
85
86
  }
86
87
  exports.rollupBundleFile = rollupBundleFile;
88
+ async function ensureRollup() {
89
+ if (rollup) {
90
+ return;
91
+ }
92
+ try {
93
+ rollup = await Promise.resolve().then(() => __importStar(require('rollup')));
94
+ log.debug(`rollup using native version.`);
95
+ }
96
+ catch {
97
+ rollup = await Promise.resolve().then(() => __importStar(require('@rollup/wasm-node')));
98
+ log.debug(`rollup using wasm version.`);
99
+ }
100
+ }
87
101
  function isExternalDependency(moduleId) {
88
102
  // more information about why we don't check for 'node_modules' path
89
103
  // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/flatten/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA6C;AAC7C,sFAAsD;AACtD,2CAA6B;AAC7B,+CAAiC;AAEjC,0CAAgE;AAChE,kDAAoC;AACpC,6DAAwD;AAmBxD,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAA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AAE,IAAI,CAAC,SAAS,GAAG,MAAM;QACvC,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACnF;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;AAvDD,4CAuDC;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;QACrF,yGAAyG;QACzG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import rollupJson from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport * as path from 'path';\nimport * as rollup from 'rollup';\nimport { 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?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; files: (rollup.OutputChunk | rollup.OutputAsset)[] }> {\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\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA6C;AAC7C,sF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I,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 +1 @@
1
- {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,+BAA4B;AAE5B,iDAAwD;AACxD,qDAA6D;AAC7D,6CAAgF;AAChF,uCAAkD;AAClD,oCAAkE;AAQ3D,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACjC,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAC/B,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC;IAElD,MAAM,OA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;QAE3B,OAAO,CAAC,OAAO,EAAE,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;KACtE;AACH,CAAC,CAAC,CAAC;AAtFQ,QAAA,qBAAqB,yBAsF7B","sourcesContent":["import ora from 'ora';\nimport { join } from 'path';\nimport { OutputAsset, OutputChunk, RollupCache } from 'rollup';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../../utils/cache';\nimport { mkdir, writeFile } from '../../utils/fs';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\ninterface BundlesCache {\n hash: string;\n fesm2022: (OutputChunk | OutputAsset)[];\n}\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2022Dir, esm2022 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const key = await generateKey(ngEntryPoint.moduleId, esm2022, fesm2022Dir, tsConfig.options.compilationMode);\n const hash = await generateKey([...cache.outputCache.values()].map(({ version }) => version).join(':'));\n const cacheDirectory = options.cacheEnabled && options.cacheDirectory;\n if (cacheDirectory) {\n const cacheResult: BundlesCache = await readCacheEntry(options.cacheDirectory, key);\n\n if (cacheResult?.hash === hash) {\n try {\n spinner.start('Writing FESM bundles');\n await mkdir(fesm2022Dir, { recursive: true });\n\n for (const file of cacheResult.fesm2022) {\n await writeFile(join(fesm2022Dir, file.fileName), file.type === 'asset' ? file.source : file.code);\n }\n\n spinner.succeed('Writing FESM bundles');\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n return;\n }\n }\n\n async function generateFESM(\n rollupCache: RollupCache,\n dir: string,\n ): Promise<{ files: (OutputChunk | OutputAsset)[]; rollupCache: RollupCache }> {\n const { cache: rollupFESMCache, files } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2022,\n entryName: ngEntryPoint.flatModuleFile,\n moduleName: ngEntryPoint.moduleId,\n dir,\n cache: rollupCache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2022, dir, ngEntryPoint.moduleId, tsConfig.options.compilationMode),\n });\n\n return {\n /** The map contents are in an asset file type, which makes storing the map in the cache as redudant. */\n files: files.map(f => {\n if (f.type === 'chunk') {\n f.map = null;\n }\n\n return f;\n }),\n rollupCache: options.watch ? rollupFESMCache : undefined,\n };\n }\n\n const fesmCache: Partial<BundlesCache> = {\n hash,\n };\n\n try {\n spinner.start('Generating FESM bundles');\n const { rollupCache, files } = await generateFESM(cache.rollupFESM2022Cache, fesm2022Dir);\n\n cache.rollupFESM2022Cache = rollupCache;\n fesmCache.fesm2022 = files;\n\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, key, JSON.stringify(fesmCache));\n }\n });\n"]}
1
+ {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,+BAA4B;AAE5B,iDAAwD;AACxD,qDAA6D;AAC7D,6CAAgF;AAChF,uCAAkD;AAClD,oCAAkE;AAQ3D,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACjC,MAAM,UAAU,GAAmB,KAAK,CAAC,IAA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,CAAC;IAEF,IAAI;QACF,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACzC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,mBAAmB,EAAE,WAAW,CAAC,CAAC;QAE1F,KAAK,CAAC,mBAAmB,GAAG,WAAW,CAAC;QACxC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC;QAE3B,OAAO,CAAC,OAAO,EAAE,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;KACtE;AACH,CAAC,CAAC,CAAC;AAtFQ,QAAA,qBAAqB,yBAsF7B","sourcesContent":["import ora from 'ora';\nimport { join } from 'path';\nimport type { OutputAsset, OutputChunk, RollupCache } from 'rollup';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../../utils/cache';\nimport { mkdir, writeFile } from '../../utils/fs';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\ninterface BundlesCache {\n hash: string;\n fesm2022: (OutputChunk | OutputAsset)[];\n}\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2022Dir, esm2022 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const key = await generateKey(ngEntryPoint.moduleId, esm2022, fesm2022Dir, tsConfig.options.compilationMode);\n const hash = await generateKey([...cache.outputCache.values()].map(({ version }) => version).join(':'));\n const cacheDirectory = options.cacheEnabled && options.cacheDirectory;\n if (cacheDirectory) {\n const cacheResult: BundlesCache = await readCacheEntry(options.cacheDirectory, key);\n\n if (cacheResult?.hash === hash) {\n try {\n spinner.start('Writing FESM bundles');\n await mkdir(fesm2022Dir, { recursive: true });\n\n for (const file of cacheResult.fesm2022) {\n await writeFile(join(fesm2022Dir, file.fileName), file.type === 'asset' ? file.source : file.code);\n }\n\n spinner.succeed('Writing FESM bundles');\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n return;\n }\n }\n\n async function generateFESM(\n rollupCache: RollupCache,\n dir: string,\n ): Promise<{ files: (OutputChunk | OutputAsset)[]; rollupCache: RollupCache }> {\n const { cache: rollupFESMCache, files } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2022,\n entryName: ngEntryPoint.flatModuleFile,\n moduleName: ngEntryPoint.moduleId,\n dir,\n cache: rollupCache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2022, dir, ngEntryPoint.moduleId, tsConfig.options.compilationMode),\n });\n\n return {\n /** The map contents are in an asset file type, which makes storing the map in the cache as redudant. */\n files: files.map(f => {\n if (f.type === 'chunk') {\n f.map = null;\n }\n\n return f;\n }),\n rollupCache: options.watch ? rollupFESMCache : undefined,\n };\n }\n\n const fesmCache: Partial<BundlesCache> = {\n hash,\n };\n\n try {\n spinner.start('Generating FESM bundles');\n const { rollupCache, files } = await generateFESM(cache.rollupFESM2022Cache, fesm2022Dir);\n\n cache.rollupFESM2022Cache = rollupCache;\n fesmCache.fesm2022 = files;\n\n spinner.succeed();\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, key, JSON.stringify(fesmCache));\n }\n });\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { NgtscProgram, ParsedConfiguration, Program } from '@angular/compiler-cli';
2
- import { RollupCache } from 'rollup';
2
+ import type { RollupCache } from 'rollup';
3
3
  import ts from 'typescript';
4
4
  import { FileCache } from '../file-system/file-cache';
5
5
  import { ComplexPredicate } from '../graph/build-graph';
@@ -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;QACrC,OAAO,GAAG,CAAC,SAAS,CAAC,yBAAiB,CAAC,MAAM,CAAC,CAAC;KAChD;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 { 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":";;;;;;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;QACrC,OAAO,GAAG,CAAC,SAAS,CAAC,yBAAiB,CAAC,MAAM,CAAC,CAAC;KAChD;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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "17.0.1",
3
+ "version": "17.0.3",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -34,6 +34,7 @@
34
34
  "dependencies": {
35
35
  "@rollup/plugin-json": "^6.0.1",
36
36
  "@rollup/plugin-node-resolve": "^15.2.3",
37
+ "@rollup/wasm-node": "^4.5.0",
37
38
  "ajv": "^8.12.0",
38
39
  "ansi-colors": "^4.1.3",
39
40
  "autoprefixer": "^10.4.16",
@@ -53,12 +54,12 @@
53
54
  "piscina": "^4.1.0",
54
55
  "postcss": "^8.4.31",
55
56
  "postcss-url": "^10.1.3",
56
- "rollup": "^4.2.0",
57
57
  "rxjs": "^7.8.1",
58
58
  "sass": "^1.69.5"
59
59
  },
60
60
  "optionalDependencies": {
61
- "esbuild": "^0.19.0"
61
+ "esbuild": "^0.19.0",
62
+ "rollup": "^4.5.0"
62
63
  },
63
64
  "peerDependencies": {
64
65
  "@angular/compiler-cli": "^17.0.0 || ^17.0.0-next.0",