ng-packagr 15.0.1 → 15.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.
package/README.md CHANGED
@@ -20,7 +20,7 @@ npm install -D ng-packagr
20
20
  ## Usage Example
21
21
 
22
22
  Let's walk through a _getting started_ that'll build an Angular library from TypeScript sources and create a distribution-ready npm package:
23
- create a `ng-package.json` file and run `ng-packagr -p package.json`
23
+ create a `ng-package.json` file and run `ng-packagr -p ng-package.json`
24
24
  – Here we go:
25
25
 
26
26
  ```json
@@ -57,12 +57,12 @@ Create one `package.json` per npm package, run _ng-packagr_ for each!
57
57
 
58
58
  * :gift: Implements [Angular Package Format](https://angular.io/guide/angular-package-format)
59
59
  * :checkered_flag: Bundles your library in FESM2020
60
- * :school_satchel: npm package can be consumed by [Angular CLI](https://github.com/angular/angular-cli), [Webpack](https://github.com/webpack/webpack), or [SystemJS](https://github.com/systemjs/systemjs)
60
+ * :school_satchel: npm package can be consumed by [Angular CLI](https://github.com/angular/angular-cli), [Webpack](https://github.com/webpack/webpack), or ESM Bundlers
61
61
  * :dancer: Creates type definitions (`.d.ts`)
62
62
  * :mag_right: Creates [scoped and non-scoped packages](https://docs.npmjs.com/misc/scope) for publishing to npm registry
63
63
  * :surfer: Inlines Templates and Stylesheets
64
64
  * :sparkles: CSS Features
65
- * :camel: Runs [SCSS](http://sass-lang.com/guide) preprocessor, supporting the [relative `~` import syntax](https://github.com/webpack-contrib/sass-loader#imports) and custom include paths
65
+ * :camel: Runs [SCSS](http://sass-lang.com/guide) preprocessor, supporting custom include paths
66
66
  * :monkey: Adds vendor-specific prefixes w/ [autoprefixer](https://github.com/postcss/autoprefixer#autoprefixer-) and [browserslist](https://github.com/ai/browserslist#queries) — just tell your desired `.browserslistrc`
67
67
  * :tiger: Embed assets data w/ [postcss-url](https://github.com/postcss/postcss-url#inline)
68
68
 
@@ -1,5 +1,5 @@
1
- import { TransformResult } from 'rollup';
1
+ import { Plugin } from 'rollup';
2
2
  /**
3
3
  * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.
4
4
  */
5
- export declare function downlevelCodeWithTsc(code: string, filePath: string): TransformResult;
5
+ export declare function downlevelCodeWithTscPlugin(): Plugin;
@@ -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.downlevelCodeWithTsc = void 0;
26
+ exports.downlevelCodeWithTscPlugin = void 0;
27
27
  const path = __importStar(require("path"));
28
28
  const typescript_1 = require("typescript");
29
29
  const log = __importStar(require("../utils/log"));
@@ -42,19 +42,24 @@ const COMPILER_OPTIONS = {
42
42
  /**
43
43
  * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.
44
44
  */
45
- function downlevelCodeWithTsc(code, filePath) {
46
- log.debug(`tsc ${filePath}`);
47
- const compilerOptions = {
48
- ...COMPILER_OPTIONS,
49
- mapRoot: path.dirname(filePath),
50
- };
51
- const { outputText, sourceMapText } = (0, typescript_1.transpileModule)(code, {
52
- compilerOptions,
53
- });
45
+ function downlevelCodeWithTscPlugin() {
54
46
  return {
55
- code: outputText,
56
- map: JSON.parse(sourceMapText),
47
+ name: 'downlevel-ts',
48
+ transform: function (code, id) {
49
+ log.debug(`tsc ${id}`);
50
+ const compilerOptions = {
51
+ ...COMPILER_OPTIONS,
52
+ mapRoot: path.dirname(id),
53
+ };
54
+ const { outputText, sourceMapText } = (0, typescript_1.transpileModule)(code, {
55
+ compilerOptions,
56
+ });
57
+ return {
58
+ code: outputText,
59
+ map: JSON.parse(sourceMapText),
60
+ };
61
+ },
57
62
  };
58
63
  }
59
- exports.downlevelCodeWithTsc = downlevelCodeWithTsc;
64
+ exports.downlevelCodeWithTscPlugin = downlevelCodeWithTscPlugin;
60
65
  //# sourceMappingURL=downlevel-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"downlevel-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/downlevel-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,2CAA8G;AAE9G,kDAAoC;AAEpC;;GAEG;AACH,MAAM,gBAAgB,GAAoB;IACxC,MAAM,EAAE,yBAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,uBAAU,CAAC,MAAM;IACzB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,iCAAoB,CAAC,OAAO;CAC/C,CAAC;AAEF;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAY,EAAE,QAAgB;IACjE,GAAG,CAAC,KAAK,CAAC,OAAO,QAAQ,EAAE,CAAC,CAAC;IAC7B,MAAM,eAAe,GAAoB;QACvC,GAAG,gBAAgB;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;KAChC,CAAC;IAEF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE;QAC1D,eAAe;KAChB,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;KAC/B,CAAC;AACJ,CAAC;AAfD,oDAeC","sourcesContent":["import * as path from 'path';\nimport { TransformResult } from 'rollup';\nimport { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, transpileModule } from 'typescript';\n\nimport * as log from '../utils/log';\n\n/**\n * Base `tsc` `CompilerOptions` shared among various downleveling methods.\n */\nconst COMPILER_OPTIONS: CompilerOptions = {\n target: ScriptTarget.ES2015,\n module: ModuleKind.ESNext,\n allowJs: true,\n sourceMap: true,\n importHelpers: true,\n downlevelIteration: true,\n moduleResolution: ModuleResolutionKind.Classic,\n};\n\n/**\n * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.\n */\nexport function downlevelCodeWithTsc(code: string, filePath: string): TransformResult {\n log.debug(`tsc ${filePath}`);\n const compilerOptions: CompilerOptions = {\n ...COMPILER_OPTIONS,\n mapRoot: path.dirname(filePath),\n };\n\n const { outputText, sourceMapText } = transpileModule(code, {\n compilerOptions,\n });\n\n return {\n code: outputText,\n map: JSON.parse(sourceMapText),\n };\n}\n"]}
1
+ {"version":3,"file":"downlevel-plugin.js","sourceRoot":"","sources":["../../../src/lib/flatten/downlevel-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAE7B,2CAA8G;AAE9G,kDAAoC;AAEpC;;GAEG;AACH,MAAM,gBAAgB,GAAoB;IACxC,MAAM,EAAE,yBAAY,CAAC,MAAM;IAC3B,MAAM,EAAE,uBAAU,CAAC,MAAM;IACzB,OAAO,EAAE,IAAI;IACb,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,IAAI;IACnB,kBAAkB,EAAE,IAAI;IACxB,gBAAgB,EAAE,iCAAoB,CAAC,OAAO;CAC/C,CAAC;AAEF;;GAEG;AACH,SAAgB,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,UAAU,IAAI,EAAE,EAAE;YAC3B,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACvB,MAAM,eAAe,GAAoB;gBACvC,GAAG,gBAAgB;gBACnB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;aAC1B,CAAC;YAEF,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAe,EAAC,IAAI,EAAE;gBAC1D,eAAe;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,IAAI,EAAE,UAAU;gBAChB,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;aAC/B,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AApBD,gEAoBC","sourcesContent":["import * as path from 'path';\nimport { Plugin } from 'rollup';\nimport { CompilerOptions, ModuleKind, ModuleResolutionKind, ScriptTarget, transpileModule } from 'typescript';\n\nimport * as log from '../utils/log';\n\n/**\n * Base `tsc` `CompilerOptions` shared among various downleveling methods.\n */\nconst COMPILER_OPTIONS: CompilerOptions = {\n target: ScriptTarget.ES2015,\n module: ModuleKind.ESNext,\n allowJs: true,\n sourceMap: true,\n importHelpers: true,\n downlevelIteration: true,\n moduleResolution: ModuleResolutionKind.Classic,\n};\n\n/**\n * Downlevels a .js file from `ES2015` to `ES2015`. Internally, uses `tsc`.\n */\nexport function downlevelCodeWithTscPlugin(): Plugin {\n return {\n name: 'downlevel-ts',\n transform: function (code, id) {\n log.debug(`tsc ${id}`);\n const compilerOptions: CompilerOptions = {\n ...COMPILER_OPTIONS,\n mapRoot: path.dirname(id),\n };\n\n const { outputText, sourceMapText } = transpileModule(code, {\n compilerOptions,\n });\n\n return {\n code: outputText,\n map: JSON.parse(sourceMapText),\n };\n },\n };\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import { Plugin } from 'rollup';
2
+ import { OutputFileCache } from '../ng-package/nodes';
3
+ /**
4
+ * Loads a file and it's map.
5
+ */
6
+ export declare function fileLoaderPlugin(fileCache: OutputFileCache): Plugin;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.fileLoaderPlugin = void 0;
27
+ const log = __importStar(require("../utils/log"));
28
+ const path_1 = require("../utils/path");
29
+ /**
30
+ * Loads a file and it's map.
31
+ */
32
+ function fileLoaderPlugin(fileCache) {
33
+ return {
34
+ name: 'file-loader',
35
+ load: function (id) {
36
+ log.debug(`file-loader ${id}`);
37
+ const data = fileCache.get((0, path_1.ensureUnixPath)(id));
38
+ if (!data) {
39
+ throw new Error(`Could not load '${id}' from memory.`);
40
+ }
41
+ return {
42
+ code: data.content,
43
+ map: data.map,
44
+ };
45
+ },
46
+ };
47
+ }
48
+ exports.fileLoaderPlugin = fileLoaderPlugin;
49
+ //# sourceMappingURL=file-loader-plugin.js.map
@@ -0,0 +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,5 +1,4 @@
1
1
  import * as rollup from 'rollup';
2
- import { TransformHook } from 'rollup';
3
2
  import { OutputFileCache } from '../ng-package/nodes';
4
3
  /**
5
4
  * Options used in `ng-packagr` for writing flat bundle files.
@@ -11,7 +10,7 @@ export interface RollupOptions {
11
10
  entry: string;
12
11
  dest: string;
13
12
  sourceRoot: string;
14
- transform?: TransformHook;
13
+ downlevel?: boolean;
15
14
  cache?: rollup.RollupCache;
16
15
  cacheDirectory?: string | false;
17
16
  fileCache: OutputFileCache;
@@ -31,10 +31,10 @@ 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
33
  const rollup = __importStar(require("rollup"));
34
- const rollup_plugin_sourcemaps_1 = __importDefault(require("rollup-plugin-sourcemaps"));
35
34
  const cache_1 = require("../utils/cache");
36
35
  const log = __importStar(require("../utils/log"));
37
- const path_1 = require("../utils/path");
36
+ const downlevel_plugin_1 = require("./downlevel-plugin");
37
+ const file_loader_plugin_1 = require("./file-loader-plugin");
38
38
  /** Runs rollup over the given entry file, writes a bundle file. */
39
39
  async function rollupBundleFile(opts) {
40
40
  var _a;
@@ -49,14 +49,9 @@ async function rollupBundleFile(opts) {
49
49
  input: opts.entry,
50
50
  plugins: [
51
51
  (0, plugin_node_resolve_1.default)(),
52
- (0, rollup_plugin_sourcemaps_1.default)({
53
- readFile: (path, callback) => {
54
- const fileData = opts.fileCache.get((0, path_1.ensureUnixPath)(path));
55
- callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData === null || fileData === void 0 ? void 0 : fileData.content);
56
- },
57
- }),
58
52
  (0, plugin_json_1.default)(),
59
- opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,
53
+ (0, file_loader_plugin_1.fileLoaderPlugin)(opts.fileCache),
54
+ opts.downlevel ? (0, downlevel_plugin_1.downlevelCodeWithTscPlugin)() : undefined,
60
55
  ],
61
56
  onwarn: warning => {
62
57
  switch (warning.code) {
@@ -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,wFAAkD;AAElD,0CAAgE;AAChE,kDAAoC;AACpC,wCAA+C;AAmB/C,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvE,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,oBAAoB,EAAE,KAAK;QAC3B,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,CAA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AE,IAAI;QACZ,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,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,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvC,gFAAgF;IAChF,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IAErB,OAAO;QACL,IAAI,EAAE,IAAI,GAAG,mBAAmB,GAAG,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;QAC1E,GAAG;QACH,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAlED,4CAkEC;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 { TransformHook } from 'rollup';\nimport sourcemaps from 'rollup-plugin-sourcemaps';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface RollupOptions {\n moduleName: string;\n entry: string;\n dest: string;\n sourceRoot: string;\n transform?: TransformHook;\n cache?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; code: string; map: rollup.SourceMap }> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n const cacheDirectory = opts.cacheDirectory;\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [\n nodeResolve(),\n sourcemaps({\n readFile: (path: string, callback: (error: Error | null, data: Buffer | string) => void) => {\n const fileData = opts.fileCache.get(ensureUnixPath(path));\n callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData?.content);\n },\n }),\n rollupJson(),\n opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,\n ],\n onwarn: warning => {\n switch (warning.code) {\n case '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 file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n const { code, map } = output.output[0];\n\n // Close the bundle to let plugins clean up their external processes or services\n await bundle.close();\n\n return {\n code: code + '//# sourceMapping' + `URL=${path.basename(opts.dest)}.map\\n`,\n map,\n cache: bundle.cache,\n };\n}\n\nfunction isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n return true;\n}\n"]}
1
+ {"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,yDAAgE;AAChE,6DAAwD;AAmBxD,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvE,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,oBAAoB,EAAE,KAAK;QAC3B,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvG,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,OAAO,EAAE;YACP,IAAA,6BAAW,GAAE;YACb,IAAA,qBAAU,GAAE;YACZ,IAAA,qCAAgB,EAAC,IAAI,CAAC,SAAS,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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 { downlevelCodeWithTscPlugin } from './downlevel-plugin';\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 dest: string;\n sourceRoot: string;\n downlevel?: boolean;\n cache?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; code: string; map: rollup.SourceMap }> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n const cacheDirectory = opts.cacheDirectory;\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [\n nodeResolve(),\n rollupJson(),\n fileLoaderPlugin(opts.fileCache),\n opts.downlevel ? downlevelCodeWithTscPlugin() : undefined,\n ],\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 file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n const { code, map } = output.output[0];\n\n // Close the bundle to let plugins clean up their external processes or services\n await bundle.close();\n\n return {\n code: code + '//# sourceMapping' + `URL=${path.basename(opts.dest)}.map\\n`,\n map,\n cache: bundle.cache,\n };\n}\n\nfunction isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n return true;\n}\n"]}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.writeBundlesTransform = void 0;
7
7
  const ora_1 = __importDefault(require("ora"));
8
8
  const path_1 = require("path");
9
- const downlevel_plugin_1 = require("../../flatten/downlevel-plugin");
10
9
  const rollup_1 = require("../../flatten/rollup");
11
10
  const transform_1 = require("../../graph/transform");
12
11
  const cache_1 = require("../../utils/cache");
@@ -83,7 +82,7 @@ const writeBundlesTransform = (options) => (0, transform_1.transformFromPromise)
83
82
  entry: esm2020,
84
83
  moduleName: ngEntryPoint.moduleId,
85
84
  dest: fesm2015,
86
- transform: downlevel_plugin_1.downlevelCodeWithTsc,
85
+ downlevel: true,
87
86
  cache: cache.rollupFESM2015Cache,
88
87
  cacheDirectory,
89
88
  fileCache: cache.outputCache,
@@ -1 +1 @@
1
- {"version":3,"file":"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AS,CAAC,QAAQ,GAAG;YACnB,IAAI;YACJ,GAAG;SACJ,CAAC;QAEF,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;KACtE;AACH,CAAC,CAAC,CAAC;AAnHQ,QAAA,qBAAqB,yBAmH7B","sourcesContent":["import ora from 'ora';\nimport { dirname } from 'path';\nimport { SourceMap } from 'rollup';\nimport { downlevelCodeWithTsc } from '../../flatten/downlevel-plugin';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../../utils/cache';\nimport { mkdir, writeFile } from '../../utils/fs';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\ninterface BundlesCache {\n hash: string;\n fesm2020: {\n code: string;\n map: SourceMap;\n };\n fesm2015: {\n code: string;\n map: SourceMap;\n };\n}\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2020, fesm2015, esm2020 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const key = await generateKey(ngEntryPoint.moduleId, esm2020, 'fesm-bundles', tsConfig.options.compilationMode);\n const hash = await generateKey(...[...cache.outputCache.values()].map(({ version }) => version));\n const cacheDirectory = options.cacheEnabled && options.cacheDirectory;\n if (cacheDirectory) {\n const cacheResult: BundlesCache = await readCacheEntry(options.cacheDirectory, key);\n\n if (cacheResult?.hash === hash) {\n try {\n spinner.start('Writing FESM bundles');\n await Promise.all([\n mkdir(dirname(fesm2020), { recursive: true }),\n mkdir(dirname(fesm2015), { recursive: true }),\n ]);\n\n await Promise.all([\n writeFile(fesm2020, cacheResult.fesm2020.code),\n writeFile(`${fesm2020}.map`, JSON.stringify(cacheResult.fesm2020.map)),\n writeFile(fesm2015, cacheResult.fesm2015.code),\n writeFile(`${fesm2015}.map`, JSON.stringify(cacheResult.fesm2015.map)),\n ]);\n\n spinner.succeed('Writing FESM bundles');\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n return;\n }\n }\n\n const fesmCache: Partial<BundlesCache> = {\n hash,\n };\n\n try {\n spinner.start('Generating FESM2020');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2020,\n cache: cache.rollupFESM2020Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2020, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2020 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2020Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n try {\n spinner.start('Generating FESM2015');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2015,\n transform: downlevelCodeWithTsc,\n cache: cache.rollupFESM2015Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2015, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2015 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2015Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, key, JSON.stringify(fesmCache));\n }\n });\n"]}
1
+ {"version":3,"file":"write-bundles.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-bundles.transform.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAsB;AACtB,+BAA+B;AAE/B,iDAAwD;AACxD,qDAA6D;AAC7D,6CAAgF;AAChF,uCAAkD;AAClD,oCAAkE;AAe3D,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACjC,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IACjF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;IAC/B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC;IAEzD,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC;QAClB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAW,EAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAChH,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAW,EAAC,GAAG,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,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KAAK,CAAC,WAAW;YAC5B,QAAQ,EAAE,MAAM,IAAA,mBAAW,EAAC,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC;SACxG,CAAC,CAAC;QAEH,SAAS,CAAC,QAAQ,GAAG;YACnB,IAAI;YACJ,GAAG;SACJ,CAAC;QAEF,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,KAAK,CAAC,mBAAmB,GAAG,eAAe,CAAC;SAC7C;KACF;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,KAAK,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;KACtE;AACH,CAAC,CAAC,CAAC;AAnHQ,QAAA,qBAAqB,yBAmH7B","sourcesContent":["import ora from 'ora';\nimport { dirname } from 'path';\nimport { SourceMap } from 'rollup';\nimport { rollupBundleFile } from '../../flatten/rollup';\nimport { transformFromPromise } from '../../graph/transform';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../../utils/cache';\nimport { mkdir, writeFile } from '../../utils/fs';\nimport { EntryPointNode, isEntryPointInProgress } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\ninterface BundlesCache {\n hash: string;\n fesm2020: {\n code: string;\n map: SourceMap;\n };\n fesm2015: {\n code: string;\n map: SourceMap;\n };\n}\n\nexport const writeBundlesTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const { destinationFiles, entryPoint: ngEntryPoint, tsConfig } = entryPoint.data;\n const cache = entryPoint.cache;\n const { fesm2020, fesm2015, esm2020 } = destinationFiles;\n\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const key = await generateKey(ngEntryPoint.moduleId, esm2020, 'fesm-bundles', tsConfig.options.compilationMode);\n const hash = await generateKey(...[...cache.outputCache.values()].map(({ version }) => version));\n const cacheDirectory = options.cacheEnabled && options.cacheDirectory;\n if (cacheDirectory) {\n const cacheResult: BundlesCache = await readCacheEntry(options.cacheDirectory, key);\n\n if (cacheResult?.hash === hash) {\n try {\n spinner.start('Writing FESM bundles');\n await Promise.all([\n mkdir(dirname(fesm2020), { recursive: true }),\n mkdir(dirname(fesm2015), { recursive: true }),\n ]);\n\n await Promise.all([\n writeFile(fesm2020, cacheResult.fesm2020.code),\n writeFile(`${fesm2020}.map`, JSON.stringify(cacheResult.fesm2020.map)),\n writeFile(fesm2015, cacheResult.fesm2015.code),\n writeFile(`${fesm2015}.map`, JSON.stringify(cacheResult.fesm2015.map)),\n ]);\n\n spinner.succeed('Writing FESM bundles');\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n return;\n }\n }\n\n const fesmCache: Partial<BundlesCache> = {\n hash,\n };\n\n try {\n spinner.start('Generating FESM2020');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2020,\n cache: cache.rollupFESM2020Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2020, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2020 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2020Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n try {\n spinner.start('Generating FESM2015');\n const {\n cache: rollupFESMCache,\n code,\n map,\n } = await rollupBundleFile({\n sourceRoot: tsConfig.options.sourceRoot,\n entry: esm2020,\n moduleName: ngEntryPoint.moduleId,\n dest: fesm2015,\n downlevel: true,\n cache: cache.rollupFESM2015Cache,\n cacheDirectory,\n fileCache: cache.outputCache,\n cacheKey: await generateKey(esm2020, ngEntryPoint.moduleId, fesm2015, tsConfig.options.compilationMode),\n });\n\n fesmCache.fesm2015 = {\n code,\n map,\n };\n\n spinner.succeed();\n\n if (options.watch) {\n cache.rollupFESM2015Cache = rollupFESMCache;\n }\n } catch (error) {\n spinner.fail();\n throw error;\n }\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, key, JSON.stringify(fesmCache));\n }\n });\n"]}
@@ -27,6 +27,7 @@ export declare function ngUrl(path: string): string;
27
27
  export declare type OutputFileCache = Map<string, {
28
28
  version: string;
29
29
  content: string;
30
+ map?: any;
30
31
  }>;
31
32
  export declare class EntryPointNode extends Node {
32
33
  readonly url: string;
@@ -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;AAG5D,6CAAmD;AAGtC,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,mBAAmB,GAAG,4BAA4B,CAAC;AAIhE,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;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CAAmB,EAAE;YAC9C,qBAAqB,EAAE,oBAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7E,CAAC;IACJ,CAAC;CAAA;AAVD,kCAUC","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 { NgccProcessingCache } from './ngcc-cache';\nimport { NgPackage } from './package';\n\nexport const TYPE_NG_PACKAGE = 'application/ng-package';\nexport const TYPE_NG_ENTRY_POINT = 'application/ng-entry-point';\n\nexport type GlobCache = Record<string, boolean | 'DIR' | 'FILE' | string[]>;\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 }>;\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 ngccProcessingCache: NgccProcessingCache,\n moduleResolutionCache: ts.ModuleResolutionCache,\n ) {\n super(url);\n\n this.cache = {\n sourcesFileCache,\n ngccProcessingCache,\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 ngccProcessingCache: NgccProcessingCache;\n analysesSourcesFileCache: FileCache;\n moduleResolutionCache: ts.ModuleResolutionCache;\n rollupFESM2020Cache?: RollupCache;\n rollupFESM2015Cache?: 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 globCache: {} as GlobCache,\n sourcesFileCache: new FileCache(),\n ngccProcessingCache: new NgccProcessingCache(),\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;AAG5D,6CAAmD;AAGtC,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,mBAAmB,GAAG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B,GAAW,EAC3B,gBAA2B,EAC3B,mBAAwC,EACxC,qBAA+C;QAE/C,KAAK,CAAC,GAAG,CAAC,CAAC;QALK,QAAG,GAAH,GAAG,CAAQ;QAHpB,SAAI,GAAG,2BAAmB,CAAC;QAUlC,IAAI,CAAC,KAAK,GAAG;YACX,gBAAgB;YAChB,mBAAmB;YACnB,wBAAwB,EAAE,IAAI,sBAAS,EAAE;YACzC,qBAAqB;YACrB,WAAW,EAAE,IAAI,GAAG,EAAE;SACvB,CAAC;IACJ,CAAC;CAqBF;AAvCD,wCAuCC;AAED,MAAa,WAAY,SAAQ,WAAI;IAArC;;QACW,SAAI,GAAG,uBAAe,CAAC;QAGhC,UAAK,GAAG;YACN,SAAS,EAAE,EAAe;YAC1B,gBAAgB,EAAE,IAAI,sBAAS,EAAE;YACjC,mBAAmB,EAAE,IAAI,gCAAmB,EAAE;YAC9C,qBAAqB,EAAE,oBAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7E,CAAC;IACJ,CAAC;CAAA;AAVD,kCAUC","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 { NgccProcessingCache } from './ngcc-cache';\nimport { NgPackage } from './package';\n\nexport const TYPE_NG_PACKAGE = 'application/ng-package';\nexport const TYPE_NG_ENTRY_POINT = 'application/ng-entry-point';\n\nexport type GlobCache = Record<string, boolean | 'DIR' | 'FILE' | string[]>;\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 ngccProcessingCache: NgccProcessingCache,\n moduleResolutionCache: ts.ModuleResolutionCache,\n ) {\n super(url);\n\n this.cache = {\n sourcesFileCache,\n ngccProcessingCache,\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 ngccProcessingCache: NgccProcessingCache;\n analysesSourcesFileCache: FileCache;\n moduleResolutionCache: ts.ModuleResolutionCache;\n rollupFESM2020Cache?: RollupCache;\n rollupFESM2015Cache?: 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 globCache: {} as GlobCache,\n sourcesFileCache: new FileCache(),\n ngccProcessingCache: new NgccProcessingCache(),\n moduleResolutionCache: ts.createModuleResolutionCache(process.cwd(), s => s),\n };\n}\n"]}
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
30
+ const convert_source_map_1 = __importDefault(require("convert-source-map"));
30
31
  const crypto_1 = require("crypto");
31
32
  const path = __importStar(require("path"));
32
33
  const typescript_1 = __importDefault(require("typescript"));
@@ -94,9 +95,17 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
94
95
  else {
95
96
  fileName = fileName.replace(/\.js(\.map)?$/, '.mjs$1');
96
97
  const outputCache = entryPoint.cache.outputCache;
98
+ // Extract inline sourcemap which will later be used by rolluo.
99
+ const version = (0, crypto_1.createHash)('sha256').update(data).digest('hex');
100
+ let map = undefined;
101
+ if (fileName.endsWith('.mjs')) {
102
+ const cachedData = outputCache.get(fileName);
103
+ map = (cachedData === null || cachedData === void 0 ? void 0 : cachedData.version) === version ? cachedData.map : convert_source_map_1.default.fromComment(data).toJSON();
104
+ }
97
105
  outputCache.set(fileName, {
98
106
  content: data,
99
- version: (0, crypto_1.createHash)('sha256').update(data).digest('hex'),
107
+ version,
108
+ map,
100
109
  });
101
110
  }
102
111
  compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
@@ -1 +1 @@
1
- {"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../src/lib/ts/cache-compiler-host.ts"],"names":[],"mappings":";;;;;;;;;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,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;YACxB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC9B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACrE;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAbD,oEAaC","sourcesContent":["import type { CompilerHost, CompilerOptions } from '@angular/compiler-cli';\n\nimport { createHash } from 'crypto';\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 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.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 } else {\n fileName = fileName.replace(/\\.js(\\.map)?$/, '.mjs$1');\n const outputCache = entryPoint.cache.outputCache;\n\n outputCache.set(fileName, {\n content: data,\n version: createHash('sha256').update(data).digest('hex'),\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,4EAAkD;AAElD,mCAAoC;AACpC,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,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,IAAA,qBAAc,EAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,IAAI,WAAI,CAAC,OAAO,CAAC,CAAC;YACzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACjB;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/B,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAA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K,GAAG,gBAAgB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;gBACrD,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;oBAC/B,KAAK,CAAC,OAAO,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC;wBAChD,QAAQ,EAAE,QAAQ;wBAClB,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBAEH,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC1C,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;oBAC3D,eAAe,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;iBAC/C;gBAED,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;gBAEpB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;aACnC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AA9LD,8CA8LC;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;YACxB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC9B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACrE;SACF;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';\n\nimport { createHash } from 'crypto';\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 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.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 } else {\n fileName = fileName.replace(/\\.js(\\.map)?$/, '.mjs$1');\n const outputCache = entryPoint.cache.outputCache;\n\n // Extract inline sourcemap which will later be used by rolluo.\n const version = createHash('sha256').update(data).digest('hex');\n let map = undefined;\n if (fileName.endsWith('.mjs')) {\n const cachedData = outputCache.get(fileName);\n map = cachedData?.version === version ? cachedData.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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "15.0.1",
3
+ "version": "15.0.3",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -41,8 +41,9 @@
41
41
  "cacache": "^17.0.0",
42
42
  "chokidar": "^3.5.3",
43
43
  "commander": "^9.4.0",
44
+ "convert-source-map": "^2.0.0",
44
45
  "dependency-graph": "^0.11.0",
45
- "esbuild-wasm": "^0.15.9",
46
+ "esbuild-wasm": "^0.16.0",
46
47
  "find-cache-dir": "^3.3.2",
47
48
  "glob": "^8.0.3",
48
49
  "injection-js": "^2.4.0",
@@ -52,15 +53,14 @@
52
53
  "postcss": "^8.4.16",
53
54
  "postcss-url": "^10.1.3",
54
55
  "rollup": "^3.0.0",
55
- "rollup-plugin-sourcemaps": "^0.6.3",
56
56
  "rxjs": "^7.5.6",
57
57
  "sass": "^1.55.0"
58
58
  },
59
59
  "optionalDependencies": {
60
- "esbuild": "^0.15.9"
60
+ "esbuild": "^0.16.0"
61
61
  },
62
62
  "peerDependencies": {
63
- "@angular/compiler-cli": "^15.0.0-next",
63
+ "@angular/compiler-cli": "^15.0.0 || ^15.1.0-next.0 || ^15.2.0-next.0",
64
64
  "tailwindcss": "^2.0.0 || ^3.0.0",
65
65
  "tslib": "^2.3.0",
66
66
  "typescript": "~4.8.2"