ng-packagr 15.2.1 → 16.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/lib/graph/transform.js +1 -2
  2. package/lib/graph/transform.js.map +1 -1
  3. package/lib/ng-package/entry-point/analyse-sources.transform.js +1 -2
  4. package/lib/ng-package/entry-point/analyse-sources.transform.js.map +1 -1
  5. package/lib/ng-package/entry-point/compile-ngc.transform.js +2 -9
  6. package/lib/ng-package/entry-point/compile-ngc.transform.js.map +1 -1
  7. package/lib/ng-package/entry-point/entry-point.js +2 -1
  8. package/lib/ng-package/entry-point/entry-point.js.map +1 -1
  9. package/lib/ng-package/entry-point/write-package.transform.js +1 -1
  10. package/lib/ng-package/entry-point/write-package.transform.js.map +1 -1
  11. package/lib/ng-package/nodes.d.ts +1 -4
  12. package/lib/ng-package/nodes.js +1 -4
  13. package/lib/ng-package/nodes.js.map +1 -1
  14. package/lib/ng-package/package.transform.js +12 -13
  15. package/lib/ng-package/package.transform.js.map +1 -1
  16. package/lib/ngc/compile-source-files.d.ts +1 -2
  17. package/lib/ngc/compile-source-files.js +2 -3
  18. package/lib/ngc/compile-source-files.js.map +1 -1
  19. package/lib/packagr.js +1 -2
  20. package/lib/packagr.js.map +1 -1
  21. package/lib/utils/ng-compiler-cli.d.ts +0 -1
  22. package/lib/utils/ng-compiler-cli.js +1 -6
  23. package/lib/utils/ng-compiler-cli.js.map +1 -1
  24. package/package.json +3 -3
  25. package/lib/ng-package/ngcc-cache.d.ts +0 -18
  26. package/lib/ng-package/ngcc-cache.js +0 -40
  27. package/lib/ng-package/ngcc-cache.js.map +0 -1
  28. package/lib/ngc/ngcc-processor.d.ts +0 -25
  29. package/lib/ngc/ngcc-processor.js +0 -238
  30. package/lib/ngc/ngcc-processor.js.map +0 -1
  31. package/lib/ts/ngcc-transform-compiler-host.d.ts +0 -3
  32. package/lib/ts/ngcc-transform-compiler-host.js +0 -33
  33. package/lib/ts/ngcc-transform-compiler-host.js.map +0 -1
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.transformFromPromise = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const transformFromPromise = (transformFn) => (0, rxjs_1.pipe)((0, operators_1.switchMap)(async (graph) => {
5
+ const transformFromPromise = (transformFn) => (0, rxjs_1.pipe)((0, rxjs_1.switchMap)(async (graph) => {
7
6
  const transformResult = await transformFn(graph);
8
7
  return transformResult || graph;
9
8
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.ts"],"names":[],"mappings":";;;AAAA,+BAAkE;AAClE,8CAA2C;AAqBpC,MAAM,oBAAoB,GAAG,CAAC,WAAkC,EAAa,EAAE,CACpF,IAAA,WAAI,EACF,IAAA,qBAAS,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACtB,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC;IAEjD,OAAO,eAAe,IAAI,KAAK,CAAC;AAClC,CAAC,CAAC,CACH,CAAC;AAPS,QAAA,oBAAoB,wBAO7B","sourcesContent":["import { MonoTypeOperatorFunction, Observable, pipe } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { BuildGraph } from './build-graph';\n\n/**\n * A transformation applied over the build graph.\n *\n * By design, a pipeable operator over `BuildGraph`.\n * - A transformation takes a `BuildGraph` as input (from previous transformations).\n * - A transformation performs some operations based on the graph's data, potentially modifying nodes in the graph.\n * - It returns a `BuildGraph` that will be passed to subsequent transformations.\n *\n * @link https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators\n */\nexport interface Transform extends MonoTypeOperatorFunction<BuildGraph> {\n (source$: Observable<BuildGraph>): Observable<BuildGraph>;\n}\n\nexport interface PromiseBasedTransform {\n (graph: BuildGraph): Promise<BuildGraph | void> | BuildGraph | void;\n}\n\nexport const transformFromPromise = (transformFn: PromiseBasedTransform): Transform =>\n pipe(\n switchMap(async graph => {\n const transformResult = await transformFn(graph);\n\n return transformResult || graph;\n }),\n );\n"]}
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/lib/graph/transform.ts"],"names":[],"mappings":";;;AAAA,+BAA6E;AAqBtE,MAAM,oBAAoB,GAAG,CAAC,WAAkC,EAAa,EAAE,CACpF,IAAA,WAAI,EACF,IAAA,gBAAS,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;IACtB,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC;IAEjD,OAAO,eAAe,IAAI,KAAK,CAAC;AAClC,CAAC,CAAC,CACH,CAAC;AAPS,QAAA,oBAAoB,wBAO7B","sourcesContent":["import { MonoTypeOperatorFunction, Observable, pipe, switchMap } from 'rxjs';\nimport { BuildGraph } from './build-graph';\n\n/**\n * A transformation applied over the build graph.\n *\n * By design, a pipeable operator over `BuildGraph`.\n * - A transformation takes a `BuildGraph` as input (from previous transformations).\n * - A transformation performs some operations based on the graph's data, potentially modifying nodes in the graph.\n * - It returns a `BuildGraph` that will be passed to subsequent transformations.\n *\n * @link https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#pipeable-operators\n */\nexport interface Transform extends MonoTypeOperatorFunction<BuildGraph> {\n (source$: Observable<BuildGraph>): Observable<BuildGraph>;\n}\n\nexport interface PromiseBasedTransform {\n (graph: BuildGraph): Promise<BuildGraph | void> | BuildGraph | void;\n}\n\nexport const transformFromPromise = (transformFn: PromiseBasedTransform): Transform =>\n pipe(\n switchMap(async graph => {\n const transformResult = await transformFn(graph);\n\n return transformResult || graph;\n }),\n );\n"]}
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.analyseSourcesTransform = void 0;
7
7
  const path_1 = require("path");
8
8
  const rxjs_1 = require("rxjs");
9
- const operators_1 = require("rxjs/operators");
10
9
  const typescript_1 = __importDefault(require("typescript"));
11
10
  const cache_compiler_host_1 = require("../../ts/cache-compiler-host");
12
11
  const log_1 = require("../../utils/log");
13
12
  const path_2 = require("../../utils/path");
14
13
  const nodes_1 = require("../nodes");
15
- exports.analyseSourcesTransform = (0, rxjs_1.pipe)((0, operators_1.map)(graph => {
14
+ exports.analyseSourcesTransform = (0, rxjs_1.pipe)((0, rxjs_1.map)(graph => {
16
15
  const entryPoints = graph.filter(nodes_1.isEntryPoint);
17
16
  const dirtyEntryPoints = entryPoints.filter(x => x.state !== 'done');
18
17
  for (const entryPoint of dirtyEntryPoints) {
@@ -1 +1 @@
1
- {"version":3,"file":"analyse-sources.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/analyse-sources.transform.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+C;AAC/C,+BAA4B;AAC5B,8CAAqC;AACrC,4DAA4B;AAG5B,sEAAiE;AACjE,yCAAwC;AACxC,2CAAkD;AAClD,oCAAgF;AAEnE,QAAA,uBAAuB,GAAc,IAAA,WAAI,EACpD,IAAA,eAAG,EAAC,KAAK,CAAC,EAAE;IACV,MAAM,WAAW,GAAqB,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAqB,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;IAEvF,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE;QACzC,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;KACnD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,CACH,CAAC;AAEF;;;;;;GAMG;AACH,SAAS,iBAAiB,CAAC,KAAiB,EAAE,UAA0B,EAAE,WAA6B;IACrG,MAAM,EAAE,WAAW,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;IAC1F,MAAM,UAAU,GAAG,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,GAAG,CAAC,CAAC;aACxF;YAED,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SAC3B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,yBAAyB,QAAQ,iBAAiB,CAAC,CAAC;SAC9F;KACF;AACH,CAAC","sourcesContent":["import { basename, dirname, join } from 'path';\nimport { pipe } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport ts from 'typescript';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { Transform } from '../../graph/transform';\nimport { cacheCompilerHost } from '../../ts/cache-compiler-host';\nimport { debug } from '../../utils/log';\nimport { ensureUnixPath } from '../../utils/path';\nimport { EntryPointNode, PackageNode, isEntryPoint, isPackage } from '../nodes';\n\nexport const analyseSourcesTransform: Transform = pipe(\n map(graph => {\n const entryPoints: EntryPointNode[] = graph.filter(isEntryPoint);\n const dirtyEntryPoints: EntryPointNode[] = entryPoints.filter(x => x.state !== 'done');\n\n for (const entryPoint of dirtyEntryPoints) {\n analyseEntryPoint(graph, entryPoint, entryPoints);\n }\n\n return graph;\n }),\n);\n\n/**\n * Analyses an entrypoint, searching for TypeScript dependencies and additional resources (Templates and Stylesheets).\n *\n * @param graph Build graph\n * @param entryPoint Current entry point that should be analysed.\n * @param entryPoints List of all entry points.\n */\nfunction analyseEntryPoint(graph: BuildGraph, entryPoint: EntryPointNode, entryPoints: EntryPointNode[]) {\n const { oldPrograms, analysesSourcesFileCache, moduleResolutionCache } = entryPoint.cache;\n const oldProgram = oldPrograms && (oldPrograms['analysis'] as ts.Program | undefined);\n const { moduleId } = entryPoint.data.entryPoint;\n const packageNode: PackageNode = graph.find(isPackage);\n const primaryModuleId = packageNode.data.primary.moduleId;\n\n debug(`Analysing sources for ${moduleId}`);\n const tsConfigOptions: ts.CompilerOptions = {\n // Needed because of `Property 'extendedDiagnostics' is incompatible with index signature.`\n ...(entryPoint.data.tsConfig.options as ts.CompilerOptions),\n skipLibCheck: true,\n noLib: true,\n noEmit: true,\n types: [],\n target: ts.ScriptTarget.Latest,\n strict: false,\n };\n\n const compilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n undefined,\n undefined,\n analysesSourcesFileCache,\n );\n\n const potentialDependencies = new Set<string>();\n\n compilerHost.resolveTypeReferenceDirectives = (\n moduleNames: string[] | ts.FileReference[],\n containingFile: string,\n redirectedReference: ts.ResolvedProjectReference | undefined,\n options: ts.CompilerOptions,\n ) => {\n return moduleNames.map(name => {\n const moduleName = typeof name === 'string' ? name : name.fileName;\n\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n\n return undefined;\n }\n\n const result = ts.resolveTypeReferenceDirective(\n moduleName,\n ensureUnixPath(containingFile),\n options,\n compilerHost,\n redirectedReference,\n ).resolvedTypeReferenceDirective;\n\n return result;\n });\n };\n\n compilerHost.resolveModuleNames = (\n moduleNames: string[],\n containingFile: string,\n _reusedNames: string[] | undefined,\n redirectedReference: ts.ResolvedProjectReference | undefined,\n options: ts.CompilerOptions,\n ) => {\n return moduleNames.map(moduleName => {\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n\n return undefined;\n }\n\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n options,\n compilerHost,\n moduleResolutionCache,\n redirectedReference,\n );\n\n return resolvedModule;\n });\n };\n\n const program: ts.Program = ts.createProgram(\n entryPoint.data.tsConfig.rootNames,\n tsConfigOptions,\n compilerHost,\n oldProgram,\n );\n\n // If an index file exists parallel to the entryFilePath it is not valid as index should be reserved as an\n // entry file of an entry-point based on node resolution strategy.\n if (basename(entryPoint.data.entryPoint.entryFilePath) !== 'index.ts') {\n const potentialIndexPath = join(dirname(entryPoint.data.entryPoint.entryFilePath), 'index.ts');\n const sf = program.getSourceFile(ensureUnixPath(potentialIndexPath));\n\n if (sf) {\n throw new Error(\n `Entry point '${moduleId}' has an 'index.ts' parallel to the 'entryFilePath'. ` +\n `The 'entryFilePath' should be updated to point to the 'index.ts' file.\\n` +\n `Full path: ${potentialIndexPath}`,\n );\n }\n }\n\n debug(`tsc program structure is reused: ${oldProgram ? (oldProgram as any).structureIsReused : 'No old program'}`);\n\n entryPoint.cache.oldPrograms = { ...entryPoint.cache.oldPrograms, ['analysis']: program };\n\n const entryPointsMapped: Record<string, EntryPointNode> = {};\n for (const dep of entryPoints) {\n entryPointsMapped[dep.data.entryPoint.moduleId] = dep;\n }\n\n for (const moduleName of potentialDependencies) {\n const dep = entryPointsMapped[moduleName];\n\n if (dep) {\n debug(`Found entry point dependency: ${moduleId} -> ${moduleName}`);\n\n if (moduleId === moduleName) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on itself.`);\n }\n\n if (dep.some(n => entryPoint === n)) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on ${moduleId}.`);\n }\n\n entryPoint.dependsOn(dep);\n } else {\n throw new Error(`Entry point ${moduleName} which is required by ${moduleId} doesn't exist.`);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"analyse-sources.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/analyse-sources.transform.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+C;AAC/C,+BAAiC;AACjC,4DAA4B;AAG5B,sEAAiE;AACjE,yCAAwC;AACxC,2CAAkD;AAClD,oCAAgF;AAEnE,QAAA,uBAAuB,GAAc,IAAA,WAAI,EACpD,IAAA,UAAG,EAAC,KAAK,CAAC,EAAE;IACV,MAAM,WAAW,GAAqB,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAqB,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC;IAEvF,KAAK,MAAM,UAAU,IAAI,g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ACP,IAAA,WAAK,EAAC,iCAAiC,QAAQ,OAAO,UAAU,EAAE,CAAC,CAAC;YAEpE,IAAI,QAAQ,KAAK,UAAU,EAAE;gBAC3B,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,uCAAuC,CAAC,CAAC;aACnF;YAED,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,KAAK,CAAC,CAAC,EAAE;gBACnC,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,iCAAiC,QAAQ,GAAG,CAAC,CAAC;aACxF;YAED,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;SAC3B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,eAAe,UAAU,yBAAyB,QAAQ,iBAAiB,CAAC,CAAC;SAC9F;KACF;AACH,CAAC","sourcesContent":["import { basename, dirname, join } from 'path';\nimport { map, pipe } from 'rxjs';\nimport ts from 'typescript';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { Transform } from '../../graph/transform';\nimport { cacheCompilerHost } from '../../ts/cache-compiler-host';\nimport { debug } from '../../utils/log';\nimport { ensureUnixPath } from '../../utils/path';\nimport { EntryPointNode, PackageNode, isEntryPoint, isPackage } from '../nodes';\n\nexport const analyseSourcesTransform: Transform = pipe(\n map(graph => {\n const entryPoints: EntryPointNode[] = graph.filter(isEntryPoint);\n const dirtyEntryPoints: EntryPointNode[] = entryPoints.filter(x => x.state !== 'done');\n\n for (const entryPoint of dirtyEntryPoints) {\n analyseEntryPoint(graph, entryPoint, entryPoints);\n }\n\n return graph;\n }),\n);\n\n/**\n * Analyses an entrypoint, searching for TypeScript dependencies and additional resources (Templates and Stylesheets).\n *\n * @param graph Build graph\n * @param entryPoint Current entry point that should be analysed.\n * @param entryPoints List of all entry points.\n */\nfunction analyseEntryPoint(graph: BuildGraph, entryPoint: EntryPointNode, entryPoints: EntryPointNode[]) {\n const { oldPrograms, analysesSourcesFileCache, moduleResolutionCache } = entryPoint.cache;\n const oldProgram = oldPrograms && (oldPrograms['analysis'] as ts.Program | undefined);\n const { moduleId } = entryPoint.data.entryPoint;\n const packageNode: PackageNode = graph.find(isPackage);\n const primaryModuleId = packageNode.data.primary.moduleId;\n\n debug(`Analysing sources for ${moduleId}`);\n const tsConfigOptions: ts.CompilerOptions = {\n // Needed because of `Property 'extendedDiagnostics' is incompatible with index signature.`\n ...(entryPoint.data.tsConfig.options as ts.CompilerOptions),\n skipLibCheck: true,\n noLib: true,\n noEmit: true,\n types: [],\n target: ts.ScriptTarget.Latest,\n strict: false,\n };\n\n const compilerHost = cacheCompilerHost(\n graph,\n entryPoint,\n tsConfigOptions,\n moduleResolutionCache,\n undefined,\n undefined,\n analysesSourcesFileCache,\n );\n\n const potentialDependencies = new Set<string>();\n\n compilerHost.resolveTypeReferenceDirectives = (\n moduleNames: string[] | ts.FileReference[],\n containingFile: string,\n redirectedReference: ts.ResolvedProjectReference | undefined,\n options: ts.CompilerOptions,\n ) => {\n return moduleNames.map(name => {\n const moduleName = typeof name === 'string' ? name : name.fileName;\n\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n\n return undefined;\n }\n\n const result = ts.resolveTypeReferenceDirective(\n moduleName,\n ensureUnixPath(containingFile),\n options,\n compilerHost,\n redirectedReference,\n ).resolvedTypeReferenceDirective;\n\n return result;\n });\n };\n\n compilerHost.resolveModuleNames = (\n moduleNames: string[],\n containingFile: string,\n _reusedNames: string[] | undefined,\n redirectedReference: ts.ResolvedProjectReference | undefined,\n options: ts.CompilerOptions,\n ) => {\n return moduleNames.map(moduleName => {\n if (!moduleName.startsWith('.')) {\n if (moduleName === primaryModuleId || moduleName.startsWith(`${primaryModuleId}/`)) {\n potentialDependencies.add(moduleName);\n }\n\n return undefined;\n }\n\n const { resolvedModule } = ts.resolveModuleName(\n moduleName,\n ensureUnixPath(containingFile),\n options,\n compilerHost,\n moduleResolutionCache,\n redirectedReference,\n );\n\n return resolvedModule;\n });\n };\n\n const program: ts.Program = ts.createProgram(\n entryPoint.data.tsConfig.rootNames,\n tsConfigOptions,\n compilerHost,\n oldProgram,\n );\n\n // If an index file exists parallel to the entryFilePath it is not valid as index should be reserved as an\n // entry file of an entry-point based on node resolution strategy.\n if (basename(entryPoint.data.entryPoint.entryFilePath) !== 'index.ts') {\n const potentialIndexPath = join(dirname(entryPoint.data.entryPoint.entryFilePath), 'index.ts');\n const sf = program.getSourceFile(ensureUnixPath(potentialIndexPath));\n\n if (sf) {\n throw new Error(\n `Entry point '${moduleId}' has an 'index.ts' parallel to the 'entryFilePath'. ` +\n `The 'entryFilePath' should be updated to point to the 'index.ts' file.\\n` +\n `Full path: ${potentialIndexPath}`,\n );\n }\n }\n\n debug(`tsc program structure is reused: ${oldProgram ? (oldProgram as any).structureIsReused : 'No old program'}`);\n\n entryPoint.cache.oldPrograms = { ...entryPoint.cache.oldPrograms, ['analysis']: program };\n\n const entryPointsMapped: Record<string, EntryPointNode> = {};\n for (const dep of entryPoints) {\n entryPointsMapped[dep.data.entryPoint.moduleId] = dep;\n }\n\n for (const moduleName of potentialDependencies) {\n const dep = entryPointsMapped[moduleName];\n\n if (dep) {\n debug(`Found entry point dependency: ${moduleId} -> ${moduleName}`);\n\n if (moduleId === moduleName) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on itself.`);\n }\n\n if (dep.some(n => entryPoint === n)) {\n throw new Error(`Entry point ${moduleName} has a circular dependency on ${moduleId}.`);\n }\n\n entryPoint.dependsOn(dep);\n } else {\n throw new Error(`Entry point ${moduleName} which is required by ${moduleId} doesn't exist.`);\n }\n }\n}\n"]}
@@ -32,9 +32,7 @@ const path = __importStar(require("path"));
32
32
  const typescript_1 = __importDefault(require("typescript"));
33
33
  const transform_1 = require("../../graph/transform");
34
34
  const compile_source_files_1 = require("../../ngc/compile-source-files");
35
- const ngcc_processor_1 = require("../../ngc/ngcc-processor");
36
35
  const tsconfig_1 = require("../../ts/tsconfig");
37
- const ng_compiler_cli_1 = require("../../utils/ng-compiler-cli");
38
36
  const nodes_1 = require("../nodes");
39
37
  const compileNgcTransformFactory = (StylesheetProcessor, options) => {
40
38
  return (0, transform_1.transformFromPromise)(async (graph) => {
@@ -54,20 +52,15 @@ const compileNgcTransformFactory = (StylesheetProcessor, options) => {
54
52
  // Compile TypeScript sources
55
53
  const { esm2020, declarations } = entryPoint.data.destinationFiles;
56
54
  const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;
57
- const { moduleResolutionCache, ngccProcessingCache } = entryPoint.cache;
55
+ const { moduleResolutionCache } = entryPoint.cache;
58
56
  spinner.start(`Compiling with Angular sources in Ivy ${tsConfig.options.compilationMode || 'full'} compilation mode.`);
59
- const ngccProcessor = new ngcc_processor_1.NgccProcessor(await (0, ng_compiler_cli_1.ngccCompilerCli)(), ngccProcessingCache, tsConfig.project, tsConfig.options, entryPoints);
60
- if (!entryPoint.data.entryPoint.isSecondaryEntryPoint) {
61
- // Only run the async version of NGCC during the primary entrypoint processing.
62
- await ngccProcessor.process();
63
- }
64
57
  (_a = (_c = entryPoint.cache).stylesheetProcessor) !== null && _a !== void 0 ? _a : (_c.stylesheetProcessor = new StylesheetProcessor(projectBasePath, basePath, cssUrl, styleIncludePaths, options.cacheEnabled && options.cacheDirectory));
65
58
  await (0, compile_source_files_1.compileSourceFiles)(graph, tsConfig, moduleResolutionCache, {
66
59
  outDir: path.dirname(esm2020),
67
60
  declarationDir: path.dirname(declarations),
68
61
  declaration: true,
69
62
  target: typescript_1.default.ScriptTarget.ES2020,
70
- }, entryPoint.cache.stylesheetProcessor, ngccProcessor, options.watch);
63
+ }, entryPoint.cache.stylesheetProcessor, options.watch);
71
64
  }
72
65
  catch (error) {
73
66
  spinner.fail();
@@ -1 +1 @@
1
- {"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/compile-ngc.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;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M,IAAA,iCAAe,GAAE,EACvB,mBAAmB,EACnB,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,OAAO,EAChB,WAAW,CACZ,CAAC;YACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE;gBACrD,+EAA+E;gBAC/E,MAAM,aAAa,CAAC,OAAO,EAAE,CAAC;aAC/B;YAED,YAAA,UAAU,CAAC,KAAK,EAAC,mBAAmB,uCAAnB,mBAAmB,GAAK,IAAI,mBAAmB,CAC9D,eAAe,EACf,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,cAAc,CAC/C,EAAC;YAEF,MAAM,IAAA,yCAAkB,EACtB,KAAK,EACL,QAAQ,EACR,qBAAqB,EACrB;gBACE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC7B,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC1C,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;aAC/B,EACD,UAAU,CAAC,KAAK,CAAC,mBAAmB,EACpC,aAAa,EACb,OAAO,CAAC,KAAK,CACd,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;SACb;gBAAS;YACR,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBAClB,MAAA,UAAU,CAAC,KAAK,CAAC,mBAAmB,0CAAE,OAAO,EAAE,CAAC;aACjD;SACF;QAED,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA1EW,QAAA,0BAA0B,8BA0ErC","sourcesContent":["import ora from 'ora';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { compileSourceFiles } from '../../ngc/compile-source-files';\nimport { NgccProcessor } from '../../ngc/ngcc-processor';\nimport { StylesheetProcessor as StylesheetProcessorClass } from '../../styles/stylesheet-processor';\nimport { setDependenciesTsConfigPaths } from '../../ts/tsconfig';\nimport { ngccCompilerCli } from '../../utils/ng-compiler-cli';\nimport { EntryPointNode, PackageNode, isEntryPoint, isEntryPointInProgress, isPackage } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\nexport const compileNgcTransformFactory = (\n StylesheetProcessor: typeof StylesheetProcessorClass,\n options: NgPackagrOptions,\n): Transform => {\n return transformFromPromise(async graph => {\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const entryPoints: EntryPointNode[] = graph.filter(isEntryPoint);\n const entryPoint: EntryPointNode = entryPoints.find(isEntryPointInProgress());\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const projectBasePath = ngPackageNode.data.primary.basePath;\n\n try {\n // Add paths mappings for dependencies\n const tsConfig = setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints);\n\n // Compile TypeScript sources\n const { esm2020, declarations } = entryPoint.data.destinationFiles;\n const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;\n const { moduleResolutionCache, ngccProcessingCache } = entryPoint.cache;\n\n spinner.start(\n `Compiling with Angular sources in Ivy ${tsConfig.options.compilationMode || 'full'} compilation mode.`,\n );\n const ngccProcessor = new NgccProcessor(\n await ngccCompilerCli(),\n ngccProcessingCache,\n tsConfig.project,\n tsConfig.options,\n entryPoints,\n );\n if (!entryPoint.data.entryPoint.isSecondaryEntryPoint) {\n // Only run the async version of NGCC during the primary entrypoint processing.\n await ngccProcessor.process();\n }\n\n entryPoint.cache.stylesheetProcessor ??= new StylesheetProcessor(\n projectBasePath,\n basePath,\n cssUrl,\n styleIncludePaths,\n options.cacheEnabled && options.cacheDirectory,\n );\n\n await compileSourceFiles(\n graph,\n tsConfig,\n moduleResolutionCache,\n {\n outDir: path.dirname(esm2020),\n declarationDir: path.dirname(declarations),\n declaration: true,\n target: ts.ScriptTarget.ES2020,\n },\n entryPoint.cache.stylesheetProcessor,\n ngccProcessor,\n options.watch,\n );\n } catch (error) {\n spinner.fail();\n throw error;\n } finally {\n if (!options.watch) {\n entryPoint.cache.stylesheetProcessor?.destroy();\n }\n }\n\n spinner.succeed();\n\n return graph;\n });\n};\n"]}
1
+ {"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/compile-ngc.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,2CAA6B;AAC7B,4DAA4B;AAC5B,qDAAwE;AACxE,yEAAoE;AAEpE,gDAAiE;AACjE,oCAAwG;AAGjG,MAAM,0BAA0B,GAAG,CACxC,mBAAoD,EACpD,OAAyB,EACd,EAAE;IACb,OAAO,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;;;QACxC,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC;YAClB,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAqB,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;QACjE,MAAM,UAAU,GAAmB,WAAW,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;QAC9E,MAAM,aAAa,GAAgB,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;QACzD,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QAE5D,IAAI;YACF,sCAAsC;YACtC,MAAM,QAAQ,GAAG,IAAA,uCAA4B,EAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;YAErF,6BAA6B;YAC7B,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC;YACnE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;YAC3E,MAAM,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC;YAEnD,OAAO,CAAC,KAAK,CACX,yCAAyC,QAAQ,CAAC,OAAO,CAAC,eAAe,IAAI,MAAM,oBAAoB,CACxG,CAAC;YAEF,YAAA,UAAU,CAAC,KAAK,EAAC,mBAAmB,uCAAnB,mBAAmB,GAAK,IAAI,mBAAmB,CAC9D,eAAe,EACf,QAAQ,EACR,MAAM,EACN,iBAAiB,EACjB,OAAO,CAAC,YAAY,IAAI,OAAO,CAAC,cAAc,CAC/C,EAAC;YAEF,MAAM,IAAA,yCAAkB,EACtB,KAAK,EACL,QAAQ,EACR,qBAAqB,EACrB;gBACE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;gBAC7B,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC1C,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;aAC/B,EACD,UAAU,CAAC,KAAK,CAAC,mBAAmB,EACpC,OAAO,CAAC,KAAK,CACd,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;SACb;gBAAS;YACR,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;gBAClB,MAAA,UAAU,CAAC,KAAK,CAAC,mBAAmB,0CAAE,OAAO,EAAE,CAAC;aACjD;SACF;QAED,OAAO,CAAC,OAAO,EAAE,CAAC;QAElB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA9DW,QAAA,0BAA0B,8BA8DrC","sourcesContent":["import ora from 'ora';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { Transform, transformFromPromise } from '../../graph/transform';\nimport { compileSourceFiles } from '../../ngc/compile-source-files';\nimport { StylesheetProcessor as StylesheetProcessorClass } from '../../styles/stylesheet-processor';\nimport { setDependenciesTsConfigPaths } from '../../ts/tsconfig';\nimport { EntryPointNode, PackageNode, isEntryPoint, isEntryPointInProgress, isPackage } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\n\nexport const compileNgcTransformFactory = (\n StylesheetProcessor: typeof StylesheetProcessorClass,\n options: NgPackagrOptions,\n): Transform => {\n return transformFromPromise(async graph => {\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n\n const entryPoints: EntryPointNode[] = graph.filter(isEntryPoint);\n const entryPoint: EntryPointNode = entryPoints.find(isEntryPointInProgress());\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const projectBasePath = ngPackageNode.data.primary.basePath;\n\n try {\n // Add paths mappings for dependencies\n const tsConfig = setDependenciesTsConfigPaths(entryPoint.data.tsConfig, entryPoints);\n\n // Compile TypeScript sources\n const { esm2020, declarations } = entryPoint.data.destinationFiles;\n const { basePath, cssUrl, styleIncludePaths } = entryPoint.data.entryPoint;\n const { moduleResolutionCache } = entryPoint.cache;\n\n spinner.start(\n `Compiling with Angular sources in Ivy ${tsConfig.options.compilationMode || 'full'} compilation mode.`,\n );\n\n entryPoint.cache.stylesheetProcessor ??= new StylesheetProcessor(\n projectBasePath,\n basePath,\n cssUrl,\n styleIncludePaths,\n options.cacheEnabled && options.cacheDirectory,\n );\n\n await compileSourceFiles(\n graph,\n tsConfig,\n moduleResolutionCache,\n {\n outDir: path.dirname(esm2020),\n declarationDir: path.dirname(declarations),\n declaration: true,\n target: ts.ScriptTarget.ES2020,\n },\n entryPoint.cache.stylesheetProcessor,\n options.watch,\n );\n } catch (error) {\n spinner.fail();\n throw error;\n } finally {\n if (!options.watch) {\n entryPoint.cache.stylesheetProcessor?.destroy();\n }\n }\n\n spinner.succeed();\n\n return graph;\n });\n};\n"]}
@@ -88,6 +88,7 @@ class NgEntryPoint {
88
88
  }
89
89
  }
90
90
  get destinationFiles() {
91
+ var _a;
91
92
  let primaryDestPath = this.destinationPath;
92
93
  let secondaryDir = '';
93
94
  if (this.secondaryData) {
@@ -97,7 +98,7 @@ class NgEntryPoint {
97
98
  const flatModuleFile = this.flatModuleFile;
98
99
  const pathJoinWithDest = (...paths) => path.join(primaryDestPath, ...paths);
99
100
  return {
100
- directory: (0, path_1.ensureUnixPath)(secondaryDir),
101
+ directory: (_a = (0, path_1.ensureUnixPath)(secondaryDir)) !== null && _a !== void 0 ? _a : '',
101
102
  declarations: pathJoinWithDest(secondaryDir, 'index.d.ts'),
102
103
  esm2020: pathJoinWithDest('esm2020', secondaryDir, `${flatModuleFile}.mjs`),
103
104
  fesm2020: pathJoinWithDest('fesm2020', `${flatModuleFile}.mjs`),
@@ -1 +1 @@
1
- {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/entry-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAG7B,2CAAkD;AAoBlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,YAAY;IACvB;IACE,+DAA+D;IAC/C,WAAgC;IAChD,wGAAwG;IACxF,aAA8B;IAC9C,6EAA6E;IAC7D,QAAgB;IAChC,iGAAiG;IAChF,aAAsC;QANvC,gBAAW,GAAX,WAAW,CAAqB;QAEhC,kBAAa,GAAb,aAAa,CAAiB;QAE9B,aAAQ,GAAR,QAAQ,CAAQ;QAEf,kBAAa,GAAb,aAAa,CAAyB;IACtD,CAAC;IAEJ,sEAAsE;IACtE,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;IAED,iDAAiD;IACjD,IAAW,qBAAqB;QAC9B,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED,oEAAoE;IACpE,IAAW,eAAe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IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC9D;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACjD;IACH,CAAC;CACF;AA7GD,oCA6GC","sourcesContent":["import * as path from 'path';\nimport { NgPackageConfig } from '../../../ng-package.schema';\nimport { CssUrl } from '../../styles/stylesheet-processor';\nimport { ensureUnixPath } from '../../utils/path';\n\n/** A list of output absolute paths for various formats */\nexport interface DestinationFiles {\n /** Absolute path of this entry point `declarations` */\n declarations: string;\n /** Absolute path of this entry point `FESM2020` module */\n fesm2020: string;\n /** Absolute path of this entry point `FESM2015` module */\n fesm2015: string;\n /** Absolute path of this entry point `ESM2020` module */\n esm2020: string;\n /** Sub path of entrypoint distributable. */\n directory: string;\n /** Absolute path of this entry point `FESM2020` directory */\n fesm2020Dir: string;\n /** Absolute path of this entry point `FESM2015` directory */\n fesm2015Dir: string;\n}\n\n/**\n * An entry point - quoting Angular Package Format - is:\n *\n * > a module intended to be imported by the user. It is referenced by a unique module ID and\n * > exports the public API referenced by that module ID. An example is `@angular/core` or\n * > `@angular/core/testing`. Both entry points exist in the `@angular/core` package, but they\n * > export different symbols. A package can have many entry points.\n *\n * #### Public API, source file tree and build output\n *\n * An entry point serves as the root of a source tree.\n * The entry point's public API references one TypeScript source file (`*.ts`).\n * That source file, e.g. `public_api.ts`, references other source files who in turn may reference\n * other source files, thus creating a tree of source code files.\n * The source files may be TypeScript (`*.ts`), Templates (`.html`) or Stylesheets\n * (`.css`, `.scss`, ..), or other formats.\n *\n * The compilation process for an entry point is a series of transformations applied to the source\n * files, e.g. TypeScript compilation, Inlining of Stylesheets and Templates, and so on.\n * As a result of the compilation process, an entry point is transpiled to a set of artefacts\n * (the build output) which include a FESM'15 Bundle, a FESM'5 Bundle, AoT metadata, TypeScript\n * type definitions, and so on.\n *\n * #### Representation in the domain\n *\n * The set of artefacts is reflected by `NgArtefacts`;\n * one `NgEntryPoint` relates to one `NgArtefacts`.\n * The parent package of an entry point is reflected by `NgPackage`.\n */\nexport class NgEntryPoint {\n constructor(\n /** Values from the `package.json` file of this entry point. */\n public readonly packageJson: Record<string, any>,\n /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */\n public readonly ngPackageJson: NgPackageConfig,\n /** Absolute directory path of this entry point's `package.json` location. */\n public readonly basePath: string,\n /** XX: additional auto-configured data passed for secondary entry point's. Needs better docs. */\n private readonly secondaryData?: { [key: string]: any },\n ) {}\n\n /** Absolute file path of the entry point's source code entry file. */\n public get entryFilePath(): string {\n return path.resolve(this.basePath, this.entryFile);\n }\n\n /** Whether or not the entrypoint is secondary */\n public get isSecondaryEntryPoint(): boolean {\n return !!this.secondaryData;\n }\n\n /** Absolute directory path of this entry point's 'package.json'. */\n public get destinationPath(): string {\n if (this.secondaryData) {\n return this.secondaryData.destinationPath;\n } else {\n return path.resolve(this.basePath, this.$get('dest'));\n }\n }\n\n public get destinationFiles(): DestinationFiles {\n let primaryDestPath = this.destinationPath;\n let secondaryDir = '';\n\n if (this.secondaryData) {\n primaryDestPath = this.secondaryData.primaryDestinationPath;\n secondaryDir = path.relative(primaryDestPath, this.secondaryData.destinationPath);\n }\n\n const flatModuleFile = this.flatModuleFile;\n const pathJoinWithDest = (...paths: string[]) => path.join(primaryDestPath, ...paths);\n\n return {\n directory: ensureUnixPath(secondaryDir),\n declarations: pathJoinWithDest(secondaryDir, 'index.d.ts'),\n esm2020: pathJoinWithDest('esm2020', secondaryDir, `${flatModuleFile}.mjs`),\n fesm2020: pathJoinWithDest('fesm2020', `${flatModuleFile}.mjs`),\n fesm2015: pathJoinWithDest('fesm2015', `${flatModuleFile}.mjs`),\n fesm2020Dir: pathJoinWithDest('fesm2020'),\n fesm2015Dir: pathJoinWithDest('fesm2015'),\n };\n }\n\n public $get(key: string): any {\n const parts = key.split('.');\n let value = this.ngPackageJson as unknown;\n for (const key of parts) {\n if (typeof value === 'object' && key in value) {\n value = value[key];\n } else {\n return undefined;\n }\n }\n\n return value;\n }\n\n public get entryFile(): string {\n // `./index.ts` -> `index.ts`\n return path.posix.normalize(this.$get('lib.entryFile'));\n }\n\n public get cssUrl(): CssUrl {\n return this.$get('lib.cssUrl');\n }\n\n public get flatModuleFile(): string {\n return this.$get('lib.flatModuleFile') || this.flattenModuleId('-');\n }\n\n public get styleIncludePaths(): string[] {\n const includePaths = this.$get('lib.styleIncludePaths') || [];\n\n return includePaths.map(includePath =>\n path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath),\n );\n }\n\n /**\n * The module ID is an \"identifier of a module used in the import statements, e.g.\n * '@angular/core'. The ID often maps directly to a path on the filesystem, but this\n * is not always the case due to various module resolution strategies.\"\n */\n public get moduleId(): string {\n if (this.secondaryData) {\n return this.secondaryData.moduleId;\n } else {\n return this.packageJson['name'];\n }\n }\n\n private flattenModuleId(separator = '.') {\n if (this.moduleId.startsWith('@')) {\n return this.moduleId.substring(1).split('/').join(separator);\n } else {\n return this.moduleId.split('/').join(separator);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"entry-point.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/entry-point.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAG7B,2CAAkD;AAoBlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,YAAY;IACvB;IACE,+DAA+D;IAC/C,WAAgC;IAChD,wGAAwG;IACxF,aAA8B;IAC9C,6EAA6E;IAC7D,QAAgB;IAChC,iGAAiG;IAChF,aAAsC;QANvC,gBAAW,GAAX,WAAW,CAAqB;QAEhC,kBAAa,GAAb,aAAa,CAAiB;QAE9B,aAAQ,GAAR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CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CACtF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,IAAW,QAAQ;QACjB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC;SACpC;aAAM;YACL,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SACjC;IACH,CAAC;IAEO,eAAe,CAAC,SAAS,GAAG,GAAG;QACrC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;YACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SAC9D;aAAM;YACL,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;SACjD;IACH,CAAC;CACF;AA7GD,oCA6GC","sourcesContent":["import * as path from 'path';\nimport { NgPackageConfig } from '../../../ng-package.schema';\nimport { CssUrl } from '../../styles/stylesheet-processor';\nimport { ensureUnixPath } from '../../utils/path';\n\n/** A list of output absolute paths for various formats */\nexport interface DestinationFiles {\n /** Absolute path of this entry point `declarations` */\n declarations: string;\n /** Absolute path of this entry point `FESM2020` module */\n fesm2020: string;\n /** Absolute path of this entry point `FESM2015` module */\n fesm2015: string;\n /** Absolute path of this entry point `ESM2020` module */\n esm2020: string;\n /** Sub path of entrypoint distributable. */\n directory: string;\n /** Absolute path of this entry point `FESM2020` directory */\n fesm2020Dir: string;\n /** Absolute path of this entry point `FESM2015` directory */\n fesm2015Dir: string;\n}\n\n/**\n * An entry point - quoting Angular Package Format - is:\n *\n * > a module intended to be imported by the user. It is referenced by a unique module ID and\n * > exports the public API referenced by that module ID. An example is `@angular/core` or\n * > `@angular/core/testing`. Both entry points exist in the `@angular/core` package, but they\n * > export different symbols. A package can have many entry points.\n *\n * #### Public API, source file tree and build output\n *\n * An entry point serves as the root of a source tree.\n * The entry point's public API references one TypeScript source file (`*.ts`).\n * That source file, e.g. `public_api.ts`, references other source files who in turn may reference\n * other source files, thus creating a tree of source code files.\n * The source files may be TypeScript (`*.ts`), Templates (`.html`) or Stylesheets\n * (`.css`, `.scss`, ..), or other formats.\n *\n * The compilation process for an entry point is a series of transformations applied to the source\n * files, e.g. TypeScript compilation, Inlining of Stylesheets and Templates, and so on.\n * As a result of the compilation process, an entry point is transpiled to a set of artefacts\n * (the build output) which include a FESM'15 Bundle, a FESM'5 Bundle, AoT metadata, TypeScript\n * type definitions, and so on.\n *\n * #### Representation in the domain\n *\n * The set of artefacts is reflected by `NgArtefacts`;\n * one `NgEntryPoint` relates to one `NgArtefacts`.\n * The parent package of an entry point is reflected by `NgPackage`.\n */\nexport class NgEntryPoint {\n constructor(\n /** Values from the `package.json` file of this entry point. */\n public readonly packageJson: Record<string, any>,\n /** Values from either the `ngPackage` option (from `package.json`) or values from `ng-package.json`. */\n public readonly ngPackageJson: NgPackageConfig,\n /** Absolute directory path of this entry point's `package.json` location. */\n public readonly basePath: string,\n /** XX: additional auto-configured data passed for secondary entry point's. Needs better docs. */\n private readonly secondaryData?: { [key: string]: any },\n ) {}\n\n /** Absolute file path of the entry point's source code entry file. */\n public get entryFilePath(): string {\n return path.resolve(this.basePath, this.entryFile);\n }\n\n /** Whether or not the entrypoint is secondary */\n public get isSecondaryEntryPoint(): boolean {\n return !!this.secondaryData;\n }\n\n /** Absolute directory path of this entry point's 'package.json'. */\n public get destinationPath(): string {\n if (this.secondaryData) {\n return this.secondaryData.destinationPath;\n } else {\n return path.resolve(this.basePath, this.$get('dest'));\n }\n }\n\n public get destinationFiles(): DestinationFiles {\n let primaryDestPath = this.destinationPath;\n let secondaryDir = '';\n\n if (this.secondaryData) {\n primaryDestPath = this.secondaryData.primaryDestinationPath;\n secondaryDir = path.relative(primaryDestPath, this.secondaryData.destinationPath);\n }\n\n const flatModuleFile = this.flatModuleFile;\n const pathJoinWithDest = (...paths: string[]) => path.join(primaryDestPath, ...paths);\n\n return {\n directory: ensureUnixPath(secondaryDir) ?? '',\n declarations: pathJoinWithDest(secondaryDir, 'index.d.ts'),\n esm2020: pathJoinWithDest('esm2020', secondaryDir, `${flatModuleFile}.mjs`),\n fesm2020: pathJoinWithDest('fesm2020', `${flatModuleFile}.mjs`),\n fesm2015: pathJoinWithDest('fesm2015', `${flatModuleFile}.mjs`),\n fesm2020Dir: pathJoinWithDest('fesm2020'),\n fesm2015Dir: pathJoinWithDest('fesm2015'),\n };\n }\n\n public $get(key: string): any {\n const parts = key.split('.');\n let value = this.ngPackageJson as unknown;\n for (const key of parts) {\n if (typeof value === 'object' && key in value) {\n value = value[key];\n } else {\n return undefined;\n }\n }\n\n return value;\n }\n\n public get entryFile(): string {\n // `./index.ts` -> `index.ts`\n return path.posix.normalize(this.$get('lib.entryFile'));\n }\n\n public get cssUrl(): CssUrl {\n return this.$get('lib.cssUrl');\n }\n\n public get flatModuleFile(): string {\n return this.$get('lib.flatModuleFile') || this.flattenModuleId('-');\n }\n\n public get styleIncludePaths(): string[] {\n const includePaths = this.$get('lib.styleIncludePaths') || [];\n\n return includePaths.map(includePath =>\n path.isAbsolute(includePath) ? includePath : path.resolve(this.basePath, includePath),\n );\n }\n\n /**\n * The module ID is an \"identifier of a module used in the import statements, e.g.\n * '@angular/core'. The ID often maps directly to a path on the filesystem, but this\n * is not always the case due to various module resolution strategies.\"\n */\n public get moduleId(): string {\n if (this.secondaryData) {\n return this.secondaryData.moduleId;\n } else {\n return this.packageJson['name'];\n }\n }\n\n private flattenModuleId(separator = '.') {\n if (this.moduleId.startsWith('@')) {\n return this.moduleId.substring(1).split('/').join(separator);\n } else {\n return this.moduleId.split('/').join(separator);\n }\n }\n}\n"]}
@@ -107,7 +107,7 @@ async function copyAssets(graph, entryPointNode, ngPackageNode) {
107
107
  const defaultAssets = [
108
108
  { glob: 'LICENSE', input: '/', output: '/' },
109
109
  ...graph.filter(nodes_1.isEntryPoint).map(({ data }) => {
110
- const subpath = data.entryPoint.destinationFiles.directory;
110
+ const subpath = data.entryPoint.destinationFiles.directory || '/';
111
111
  return {
112
112
  glob: 'README.md',
113
113
  input: subpath,
@@ -1 +1 @@
1
- {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-package.transform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsB;AACtB,2CAA6B;AAG7B,2CAAwC;AACxC,qDAA6D;AAC7D,6CAA2C;AAC3C,uCAAoF;AACpF,2CAA6C;AAC7C,qDAAuC;AACvC,2CAAkD;AAClD,oCAAiH;AAO1G,MAAM,qBAAqB,GAAG,CAAC,OAAyB,EAAE,EAAE,CACjE,IAAA,gCAAoB,EAAC,KAAK,EAAC,KAAK,EAAC,EAAE;;IACjC,MAAM,OAAO,GAAG,IAAA,aAAG,EAAC;QAClB,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;IACH,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;IACxE,MAAM,YAAY,GAAiB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;IAC9D,MAAM,aAAa,GAAgB,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC;IAE7C,IAAI,CAAC,YAAY,CAAC,qBAAqB,EAAE;QACvC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAChC,IAAI;YACF,MAAM,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;SACpD;QAAC,OAAO,KAAK,EAAE;YAC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,CAAC;SACvD;IACH,CAAC,CAAC;IAEF,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,EAAE,CACpD,IAAI,GAAG,IAAA,qBAAc,EAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IAElE,oBAAoB,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAEtE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;IAC/C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;QAC/E,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAEhF,oBAAoB,CAAC,OAAO,EAAE;YAC5B,KAAK,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,YAAY,CAAC;YAC9D,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAC3D,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YAC3D,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YAC3D,IAAI,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YACzD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;SAC7D,CAAC,CAAC;KACJ;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB;IAC3B,OAAO,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import ora from 'ora';\nimport * as path from 'path';\nimport { AssetPattern } from '../../../ng-package.schema';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { Node } from '../../graph/node';\nimport { transformFromPromise } from '../../graph/transform';\nimport { colors } from '../../utils/color';\nimport { copyFile, exists, readFile, rmdir, stat, writeFile } from '../../utils/fs';\nimport { globFiles } from '../../utils/glob';\nimport * as log from '../../utils/log';\nimport { ensureUnixPath } from '../../utils/path';\nimport { EntryPointNode, PackageNode, fileUrl, isEntryPoint, isEntryPointInProgress, isPackage } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\nimport { NgPackage } from '../package';\nimport { NgEntryPoint } from './entry-point';\n\ntype CompilationMode = 'partial' | 'full' | undefined;\n\nexport const writePackageTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const ngPackage = ngPackageNode.data;\n const { destinationFiles } = entryPoint.data;\n\n if (!ngEntryPoint.isSecondaryEntryPoint) {\n spinner.start('Copying assets');\n try {\n await copyAssets(graph, entryPoint, ngPackageNode);\n } catch (error) {\n spinner.fail();\n throw error;\n }\n spinner.succeed();\n }\n\n // 6. WRITE PACKAGE.JSON\n // As of APF 14 only the primary entrypoint has a package.json\n if (!ngEntryPoint.isSecondaryEntryPoint) {\n try {\n spinner.start('Writing package manifest');\n const relativeUnixFromDestPath = (filePath: string) =>\n ensureUnixPath(path.relative(ngEntryPoint.destinationPath, filePath));\n\n const { compilationMode } = entryPoint.data.tsConfig.options;\n\n await writePackageJson(\n ngEntryPoint,\n ngPackage,\n {\n module: relativeUnixFromDestPath(destinationFiles.fesm2015),\n es2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n esm2020: relativeUnixFromDestPath(destinationFiles.esm2020),\n fesm2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n exports: generatePackageExports(ngEntryPoint, graph),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.packageJson.sideEffects ?? false,\n },\n !!options.watch,\n compilationMode as CompilationMode,\n spinner,\n );\n } catch (error) {\n spinner.fail();\n throw error;\n }\n spinner.succeed();\n } else if (options.watch) {\n // update the watch version of the primary entry point `package.json` file.\n // this is needed because of Webpack's 5 `cachemanagedpaths`\n // https://github.com/ng-packagr/ng-packagr/issues/2069\n const primary = ngPackageNode.data.primary;\n const packageJsonPath = path.join(primary.destinationPath, 'package.json');\n\n if (await exists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath, { encoding: 'utf8' }));\n packageJson.version = generateWatchVersion();\n await writeFile(path.join(primary.destinationPath, 'package.json'), JSON.stringify(packageJson, undefined, 2));\n }\n }\n\n spinner.succeed(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n });\n\ntype AssetEntry = Exclude<AssetPattern, string>;\n\nasync function copyAssets(\n graph: BuildGraph,\n entryPointNode: EntryPointNode,\n ngPackageNode: PackageNode,\n): Promise<void> {\n const ngPackage = ngPackageNode.data;\n\n const globsForceIgnored: string[] = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db', `${ngPackage.dest}/**`];\n const defaultAssets: AssetEntry[] = [\n { glob: 'LICENSE', input: '/', output: '/' },\n ...graph.filter(isEntryPoint).map(({ data }) => {\n const subpath = data.entryPoint.destinationFiles.directory;\n\n return {\n glob: 'README.md',\n input: subpath,\n output: subpath,\n };\n }),\n ];\n\n const assets: AssetEntry[] = [];\n\n for (const assetPath of [...ngPackage.assets, ...defaultAssets]) {\n let asset: AssetEntry;\n if (typeof assetPath === 'object') {\n asset = { ...assetPath };\n } else {\n const [isDir, isFile] = await stat(path.join(ngPackage.src, assetPath))\n .then(stats => [stats.isDirectory(), stats.isFile()])\n .catch(() => [false, false]);\n if (isDir) {\n asset = { glob: '**/*', input: assetPath, output: assetPath };\n } else if (isFile) {\n // filenames are their own glob\n asset = {\n glob: path.basename(assetPath),\n input: path.dirname(assetPath),\n output: path.dirname(assetPath),\n };\n } else {\n asset = { glob: assetPath, input: '/', output: '/' };\n }\n }\n\n asset.input = path.join(ngPackage.src, asset.input);\n asset.output = path.join(ngPackage.dest, asset.output);\n\n const isAncestorPath = (target: string, datum: string) => path.relative(datum, target).startsWith('..');\n if (isAncestorPath(asset.input, ngPackage.src)) {\n throw new Error('Cannot read assets from a location outside of the project root.');\n }\n if (isAncestorPath(asset.output, ngPackage.dest)) {\n throw new Error('Cannot write assets to a location outside of the output path.');\n }\n\n assets.push(asset);\n }\n\n for (const asset of assets) {\n const filePaths = await globFiles(asset.glob, {\n cwd: asset.input,\n ignore: [...(asset.ignore ?? []), ...globsForceIgnored],\n cache: ngPackageNode.cache.globCache,\n dot: true,\n nodir: true,\n follow: asset.followSymlinks,\n });\n for (const filePath of filePaths) {\n const fileSrcFullPath = path.join(asset.input, filePath);\n const fileDestFullPath = path.join(asset.output, filePath);\n const nodeUri = fileUrl(ensureUnixPath(fileSrcFullPath));\n let node = graph.get(nodeUri);\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n entryPointNode.dependsOn(node);\n await copyFile(fileSrcFullPath, fileDestFullPath);\n }\n }\n}\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the entry point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The properties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param additionalProperties Additional properties, e.g. binary artefacts (bundle files), to merge into `package.json`\n */\nasync function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] | ConditionalExport },\n isWatchMode: boolean,\n compilationMode: CompilationMode,\n spinner: ora.Ora,\n): Promise<void> {\n log.debug('Writing package.json');\n\n // set additional properties\n const packageJson = { ...entryPoint.packageJson, ...additionalProperties };\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n // this is only required for primary\n if (isWatchMode) {\n // Needed because of Webpack's 5 `cachemanagedpaths`\n // https://github.com/angular/angular-cli/issues/20962\n packageJson.version = generateWatchVersion();\n }\n\n if (!packageJson.peerDependencies?.tslib && !packageJson.dependencies?.tslib) {\n const {\n peerDependencies: angularPeerDependencies = {},\n dependencies: angularDependencies = {},\n } = require('@angular/compiler/package.json');\n const tsLibVersion = angularPeerDependencies.tslib || angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion,\n };\n }\n } else if (packageJson.peerDependencies?.tslib) {\n spinner.warn(\n colors.yellow(\n `'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.`,\n ),\n );\n packageJson.dependencies = {\n ...(packageJson.dependencies || {}),\n tslib: packageJson.peerDependencies.tslib,\n };\n\n delete packageJson.peerDependencies.tslib;\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicate installs or version conflicts\n // in the node_modules folder of an application\n const allowedList = pkg.allowedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', allowedList, spinner);\n } catch (e) {\n await rmdir(entryPoint.destinationPath, { recursive: true });\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (packageJson.scripts) {\n if (pkg.keepLifecycleScripts !== true) {\n spinner.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n spinner.warn(\n colors.yellow(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`,\n ),\n );\n }\n }\n\n if (compilationMode !== 'partial') {\n const scripts = packageJson.scripts || (packageJson.scripts = {});\n scripts.prepublishOnly =\n 'node --eval \"console.error(\\'' +\n 'ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\\\n' +\n 'Please delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\\\n' +\n '\\')\" ' +\n '&& exit 1';\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n\n const packageJsonPropertiesToDelete = [\n 'stylelint',\n 'prettier',\n 'browserslist',\n 'devDependencies',\n 'jest',\n 'workspaces',\n 'husky',\n ];\n\n for (const prop of packageJsonPropertiesToDelete) {\n if (prop in packageJson) {\n delete packageJson[prop];\n spinner.info(`Removing ${prop} section in package.json.`);\n }\n }\n\n packageJson.name = entryPoint.moduleId;\n await writeFile(path.join(entryPoint.destinationPath, 'package.json'), JSON.stringify(packageJson, undefined, 2));\n}\n\nfunction checkNonPeerDependencies(\n packageJson: Record<string, unknown>,\n property: string,\n allowed: RegExp[],\n spinner: ora.Ora,\n) {\n if (!packageJson[property]) {\n return;\n }\n\n for (const dep of Object.keys(packageJson[property])) {\n if (allowed.some(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is allowed in '${property}'`);\n } else {\n spinner.warn(\n colors.yellow(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} ` +\n `to 'peerDependencies' or remove it from '${property}'.`,\n ),\n );\n throw new Error(`Dependency ${dep} must be explicitly allowed using the \"allowedNonPeerDependencies\" option.`);\n }\n }\n}\n\ntype PackageExports = Record<string, ConditionalExport>;\n\n/**\n * Type describing the conditional exports descriptor for an entry-point.\n * https://nodejs.org/api/packages.html#packages_conditional_exports\n */\ntype ConditionalExport = {\n node?: string;\n types?: string;\n esm2020?: string;\n es2020?: string;\n es2015?: string;\n default?: string;\n};\n\n/**\n * Generates the `package.json` package exports following APF v13.\n * This is supposed to match with: https://github.com/angular/angular/blob/e0667efa6eada64d1fb8b143840689090fc82e52/packages/bazel/src/ng_package/packager.ts#L415.\n */\nfunction generatePackageExports({ destinationPath, packageJson }: NgEntryPoint, graph: BuildGraph): PackageExports {\n const exports: PackageExports = packageJson.exports ? JSON.parse(JSON.stringify(packageJson.exports)) : {};\n\n const insertMappingOrError = (subpath: string, mapping: ConditionalExport) => {\n if (exports[subpath] === undefined) {\n exports[subpath] = {};\n }\n\n const subpathExport = exports[subpath];\n\n // Go through all conditions that should be inserted. If the condition is already\n // manually set of the subpath export, we throw an error. In general, we allow for\n // additional conditions to be set. These will always precede the generated ones.\n for (const conditionName of Object.keys(mapping) as [keyof ConditionalExport]) {\n if (subpathExport[conditionName] !== undefined) {\n throw Error(\n `Found a conflicting export condition for \"${subpath}\". The \"${conditionName}\" ` +\n `condition would be overridden by ng-packagr. Please unset it.`,\n );\n }\n\n // **Note**: The order of the conditions is preserved even though we are setting\n // the conditions once at a time (the latest assignment will be at the end).\n subpathExport[conditionName] = mapping[conditionName];\n }\n };\n\n const relativeUnixFromDestPath = (filePath: string) =>\n './' + ensureUnixPath(path.relative(destinationPath, filePath));\n\n insertMappingOrError('./package.json', { default: './package.json' });\n\n const entryPoints = graph.filter(isEntryPoint);\n for (const entryPoint of entryPoints) {\n const { destinationFiles, isSecondaryEntryPoint } = entryPoint.data.entryPoint;\n const subpath = isSecondaryEntryPoint ? `./${destinationFiles.directory}` : '.';\n\n insertMappingOrError(subpath, {\n types: relativeUnixFromDestPath(destinationFiles.declarations),\n esm2020: relativeUnixFromDestPath(destinationFiles.esm2020),\n es2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n node: relativeUnixFromDestPath(destinationFiles.fesm2015),\n default: relativeUnixFromDestPath(destinationFiles.fesm2020),\n });\n }\n\n return exports;\n}\n\n/**\n * Generates a new version for the package `package.json` when runing in watch mode.\n */\nfunction generateWatchVersion() {\n return `0.0.0-watch+${Date.now()}`;\n}\n"]}
1
+ {"version":3,"file":"write-package.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/write-package.transform.ts"],"names":[],"m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KAAK,CAAC,MAAM,CAAC,oBAAY,CAAC,CAAC;IAC/C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;QACpC,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;QAC/E,MAAM,OAAO,GAAG,qBAAqB,CAAC,CAAC,CAAC,KAAK,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAEhF,oBAAoB,CAAC,OAAO,EAAE;YAC5B,KAAK,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,YAAY,CAAC;YAC9D,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAC3D,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YAC3D,MAAM,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YAC3D,IAAI,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;YACzD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,QAAQ,CAAC;SAC7D,CAAC,CAAC;KACJ;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,SAAS,oBAAoB;IAC3B,OAAO,eAAe,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACrC,CAAC","sourcesContent":["import ora from 'ora';\nimport * as path from 'path';\nimport { AssetPattern } from '../../../ng-package.schema';\nimport { BuildGraph } from '../../graph/build-graph';\nimport { Node } from '../../graph/node';\nimport { transformFromPromise } from '../../graph/transform';\nimport { colors } from '../../utils/color';\nimport { copyFile, exists, readFile, rmdir, stat, writeFile } from '../../utils/fs';\nimport { globFiles } from '../../utils/glob';\nimport * as log from '../../utils/log';\nimport { ensureUnixPath } from '../../utils/path';\nimport { EntryPointNode, PackageNode, fileUrl, isEntryPoint, isEntryPointInProgress, isPackage } from '../nodes';\nimport { NgPackagrOptions } from '../options.di';\nimport { NgPackage } from '../package';\nimport { NgEntryPoint } from './entry-point';\n\ntype CompilationMode = 'partial' | 'full' | undefined;\n\nexport const writePackageTransform = (options: NgPackagrOptions) =>\n transformFromPromise(async graph => {\n const spinner = ora({\n hideCursor: false,\n discardStdin: false,\n });\n const entryPoint: EntryPointNode = graph.find(isEntryPointInProgress());\n const ngEntryPoint: NgEntryPoint = entryPoint.data.entryPoint;\n const ngPackageNode: PackageNode = graph.find(isPackage);\n const ngPackage = ngPackageNode.data;\n const { destinationFiles } = entryPoint.data;\n\n if (!ngEntryPoint.isSecondaryEntryPoint) {\n spinner.start('Copying assets');\n try {\n await copyAssets(graph, entryPoint, ngPackageNode);\n } catch (error) {\n spinner.fail();\n throw error;\n }\n spinner.succeed();\n }\n\n // 6. WRITE PACKAGE.JSON\n // As of APF 14 only the primary entrypoint has a package.json\n if (!ngEntryPoint.isSecondaryEntryPoint) {\n try {\n spinner.start('Writing package manifest');\n const relativeUnixFromDestPath = (filePath: string) =>\n ensureUnixPath(path.relative(ngEntryPoint.destinationPath, filePath));\n\n const { compilationMode } = entryPoint.data.tsConfig.options;\n\n await writePackageJson(\n ngEntryPoint,\n ngPackage,\n {\n module: relativeUnixFromDestPath(destinationFiles.fesm2015),\n es2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n esm2020: relativeUnixFromDestPath(destinationFiles.esm2020),\n fesm2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n fesm2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n typings: relativeUnixFromDestPath(destinationFiles.declarations),\n exports: generatePackageExports(ngEntryPoint, graph),\n // webpack v4+ specific flag to enable advanced optimizations and code splitting\n sideEffects: ngEntryPoint.packageJson.sideEffects ?? false,\n },\n !!options.watch,\n compilationMode as CompilationMode,\n spinner,\n );\n } catch (error) {\n spinner.fail();\n throw error;\n }\n spinner.succeed();\n } else if (options.watch) {\n // update the watch version of the primary entry point `package.json` file.\n // this is needed because of Webpack's 5 `cachemanagedpaths`\n // https://github.com/ng-packagr/ng-packagr/issues/2069\n const primary = ngPackageNode.data.primary;\n const packageJsonPath = path.join(primary.destinationPath, 'package.json');\n\n if (await exists(packageJsonPath)) {\n const packageJson = JSON.parse(await readFile(packageJsonPath, { encoding: 'utf8' }));\n packageJson.version = generateWatchVersion();\n await writeFile(path.join(primary.destinationPath, 'package.json'), JSON.stringify(packageJson, undefined, 2));\n }\n }\n\n spinner.succeed(`Built ${ngEntryPoint.moduleId}`);\n\n return graph;\n });\n\ntype AssetEntry = Exclude<AssetPattern, string>;\n\nasync function copyAssets(\n graph: BuildGraph,\n entryPointNode: EntryPointNode,\n ngPackageNode: PackageNode,\n): Promise<void> {\n const ngPackage = ngPackageNode.data;\n\n const globsForceIgnored: string[] = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db', `${ngPackage.dest}/**`];\n const defaultAssets: AssetEntry[] = [\n { glob: 'LICENSE', input: '/', output: '/' },\n ...graph.filter(isEntryPoint).map(({ data }) => {\n const subpath = data.entryPoint.destinationFiles.directory || '/';\n\n return {\n glob: 'README.md',\n input: subpath,\n output: subpath,\n };\n }),\n ];\n\n const assets: AssetEntry[] = [];\n\n for (const assetPath of [...ngPackage.assets, ...defaultAssets]) {\n let asset: AssetEntry;\n if (typeof assetPath === 'object') {\n asset = { ...assetPath };\n } else {\n const [isDir, isFile] = await stat(path.join(ngPackage.src, assetPath))\n .then(stats => [stats.isDirectory(), stats.isFile()])\n .catch(() => [false, false]);\n if (isDir) {\n asset = { glob: '**/*', input: assetPath, output: assetPath };\n } else if (isFile) {\n // filenames are their own glob\n asset = {\n glob: path.basename(assetPath),\n input: path.dirname(assetPath),\n output: path.dirname(assetPath),\n };\n } else {\n asset = { glob: assetPath, input: '/', output: '/' };\n }\n }\n\n asset.input = path.join(ngPackage.src, asset.input);\n asset.output = path.join(ngPackage.dest, asset.output);\n\n const isAncestorPath = (target: string, datum: string) => path.relative(datum, target).startsWith('..');\n if (isAncestorPath(asset.input, ngPackage.src)) {\n throw new Error('Cannot read assets from a location outside of the project root.');\n }\n if (isAncestorPath(asset.output, ngPackage.dest)) {\n throw new Error('Cannot write assets to a location outside of the output path.');\n }\n\n assets.push(asset);\n }\n\n for (const asset of assets) {\n const filePaths = await globFiles(asset.glob, {\n cwd: asset.input,\n ignore: [...(asset.ignore ?? []), ...globsForceIgnored],\n cache: ngPackageNode.cache.globCache,\n dot: true,\n nodir: true,\n follow: asset.followSymlinks,\n });\n for (const filePath of filePaths) {\n const fileSrcFullPath = path.join(asset.input, filePath);\n const fileDestFullPath = path.join(asset.output, filePath);\n const nodeUri = fileUrl(ensureUnixPath(fileSrcFullPath));\n let node = graph.get(nodeUri);\n if (!node) {\n node = new Node(nodeUri);\n graph.put(node);\n }\n entryPointNode.dependsOn(node);\n await copyFile(fileSrcFullPath, fileDestFullPath);\n }\n }\n}\n\n/**\n * Creates and writes a `package.json` file of the entry point used by the `node_module`\n * resolution strategies.\n *\n * #### Example\n *\n * A consumer of the entry point depends on it by `import {..} from '@my/module/id';`.\n * The module id `@my/module/id` will be resolved to the `package.json` file that is written by\n * this build step.\n * The properties `main`, `module`, `typings` (and so on) in the `package.json` point to the\n * flattened JavaScript bundles, type definitions, (...).\n *\n * @param entryPoint An entry point of an Angular package / library\n * @param additionalProperties Additional properties, e.g. binary artefacts (bundle files), to merge into `package.json`\n */\nasync function writePackageJson(\n entryPoint: NgEntryPoint,\n pkg: NgPackage,\n additionalProperties: { [key: string]: string | boolean | string[] | ConditionalExport },\n isWatchMode: boolean,\n compilationMode: CompilationMode,\n spinner: ora.Ora,\n): Promise<void> {\n log.debug('Writing package.json');\n\n // set additional properties\n const packageJson = { ...entryPoint.packageJson, ...additionalProperties };\n\n // read tslib version from `@angular/compiler` so that our tslib\n // version at least matches that of angular if we use require('tslib').version\n // it will get what installed and not the minimum version nor if it is a `~` or `^`\n // this is only required for primary\n if (isWatchMode) {\n // Needed because of Webpack's 5 `cachemanagedpaths`\n // https://github.com/angular/angular-cli/issues/20962\n packageJson.version = generateWatchVersion();\n }\n\n if (!packageJson.peerDependencies?.tslib && !packageJson.dependencies?.tslib) {\n const {\n peerDependencies: angularPeerDependencies = {},\n dependencies: angularDependencies = {},\n } = require('@angular/compiler/package.json');\n const tsLibVersion = angularPeerDependencies.tslib || angularDependencies.tslib;\n\n if (tsLibVersion) {\n packageJson.dependencies = {\n ...packageJson.dependencies,\n tslib: tsLibVersion,\n };\n }\n } else if (packageJson.peerDependencies?.tslib) {\n spinner.warn(\n colors.yellow(\n `'tslib' is no longer recommended to be used as a 'peerDependencies'. Moving it to 'dependencies'.`,\n ),\n );\n packageJson.dependencies = {\n ...(packageJson.dependencies || {}),\n tslib: packageJson.peerDependencies.tslib,\n };\n\n delete packageJson.peerDependencies.tslib;\n }\n\n // Verify non-peerDependencies as they can easily lead to duplicate installs or version conflicts\n // in the node_modules folder of an application\n const allowedList = pkg.allowedNonPeerDependencies.map(value => new RegExp(value));\n try {\n checkNonPeerDependencies(packageJson, 'dependencies', allowedList, spinner);\n } catch (e) {\n await rmdir(entryPoint.destinationPath, { recursive: true });\n throw e;\n }\n\n // Removes scripts from package.json after build\n if (packageJson.scripts) {\n if (pkg.keepLifecycleScripts !== true) {\n spinner.info(`Removing scripts section in package.json as it's considered a potential security vulnerability.`);\n delete packageJson.scripts;\n } else {\n spinner.warn(\n colors.yellow(\n `You enabled keepLifecycleScripts explicitly. The scripts section in package.json will be published to npm.`,\n ),\n );\n }\n }\n\n if (compilationMode !== 'partial') {\n const scripts = packageJson.scripts || (packageJson.scripts = {});\n scripts.prepublishOnly =\n 'node --eval \"console.error(\\'' +\n 'ERROR: Trying to publish a package that has been compiled by Ivy in full compilation mode. This is not allowed.\\\\n' +\n 'Please delete and rebuild the package with Ivy partial compilation mode, before attempting to publish.\\\\n' +\n '\\')\" ' +\n '&& exit 1';\n }\n\n // keep the dist package.json clean\n // this will not throw if ngPackage field does not exist\n delete packageJson.ngPackage;\n\n const packageJsonPropertiesToDelete = [\n 'stylelint',\n 'prettier',\n 'browserslist',\n 'devDependencies',\n 'jest',\n 'workspaces',\n 'husky',\n ];\n\n for (const prop of packageJsonPropertiesToDelete) {\n if (prop in packageJson) {\n delete packageJson[prop];\n spinner.info(`Removing ${prop} section in package.json.`);\n }\n }\n\n packageJson.name = entryPoint.moduleId;\n await writeFile(path.join(entryPoint.destinationPath, 'package.json'), JSON.stringify(packageJson, undefined, 2));\n}\n\nfunction checkNonPeerDependencies(\n packageJson: Record<string, unknown>,\n property: string,\n allowed: RegExp[],\n spinner: ora.Ora,\n) {\n if (!packageJson[property]) {\n return;\n }\n\n for (const dep of Object.keys(packageJson[property])) {\n if (allowed.some(regex => regex.test(dep))) {\n log.debug(`Dependency ${dep} is allowed in '${property}'`);\n } else {\n spinner.warn(\n colors.yellow(\n `Distributing npm packages with '${property}' is not recommended. Please consider adding ${dep} ` +\n `to 'peerDependencies' or remove it from '${property}'.`,\n ),\n );\n throw new Error(`Dependency ${dep} must be explicitly allowed using the \"allowedNonPeerDependencies\" option.`);\n }\n }\n}\n\ntype PackageExports = Record<string, ConditionalExport>;\n\n/**\n * Type describing the conditional exports descriptor for an entry-point.\n * https://nodejs.org/api/packages.html#packages_conditional_exports\n */\ntype ConditionalExport = {\n node?: string;\n types?: string;\n esm2020?: string;\n es2020?: string;\n es2015?: string;\n default?: string;\n};\n\n/**\n * Generates the `package.json` package exports following APF v13.\n * This is supposed to match with: https://github.com/angular/angular/blob/e0667efa6eada64d1fb8b143840689090fc82e52/packages/bazel/src/ng_package/packager.ts#L415.\n */\nfunction generatePackageExports({ destinationPath, packageJson }: NgEntryPoint, graph: BuildGraph): PackageExports {\n const exports: PackageExports = packageJson.exports ? JSON.parse(JSON.stringify(packageJson.exports)) : {};\n\n const insertMappingOrError = (subpath: string, mapping: ConditionalExport) => {\n if (exports[subpath] === undefined) {\n exports[subpath] = {};\n }\n\n const subpathExport = exports[subpath];\n\n // Go through all conditions that should be inserted. If the condition is already\n // manually set of the subpath export, we throw an error. In general, we allow for\n // additional conditions to be set. These will always precede the generated ones.\n for (const conditionName of Object.keys(mapping) as [keyof ConditionalExport]) {\n if (subpathExport[conditionName] !== undefined) {\n throw Error(\n `Found a conflicting export condition for \"${subpath}\". The \"${conditionName}\" ` +\n `condition would be overridden by ng-packagr. Please unset it.`,\n );\n }\n\n // **Note**: The order of the conditions is preserved even though we are setting\n // the conditions once at a time (the latest assignment will be at the end).\n subpathExport[conditionName] = mapping[conditionName];\n }\n };\n\n const relativeUnixFromDestPath = (filePath: string) =>\n './' + ensureUnixPath(path.relative(destinationPath, filePath));\n\n insertMappingOrError('./package.json', { default: './package.json' });\n\n const entryPoints = graph.filter(isEntryPoint);\n for (const entryPoint of entryPoints) {\n const { destinationFiles, isSecondaryEntryPoint } = entryPoint.data.entryPoint;\n const subpath = isSecondaryEntryPoint ? `./${destinationFiles.directory}` : '.';\n\n insertMappingOrError(subpath, {\n types: relativeUnixFromDestPath(destinationFiles.declarations),\n esm2020: relativeUnixFromDestPath(destinationFiles.esm2020),\n es2020: relativeUnixFromDestPath(destinationFiles.fesm2020),\n es2015: relativeUnixFromDestPath(destinationFiles.fesm2015),\n node: relativeUnixFromDestPath(destinationFiles.fesm2015),\n default: relativeUnixFromDestPath(destinationFiles.fesm2020),\n });\n }\n\n return exports;\n}\n\n/**\n * Generates a new version for the package `package.json` when runing in watch mode.\n */\nfunction generateWatchVersion() {\n return `0.0.0-watch+${Date.now()}`;\n}\n"]}
@@ -6,7 +6,6 @@ import { ComplexPredicate } from '../graph/build-graph';
6
6
  import { Node } from '../graph/node';
7
7
  import { StylesheetProcessor } from '../styles/stylesheet-processor';
8
8
  import { DestinationFiles, NgEntryPoint } from './entry-point/entry-point';
9
- import { NgccProcessingCache } from './ngcc-cache';
10
9
  import { NgPackage } from './package';
11
10
  export declare const TYPE_NG_PACKAGE = "application/ng-package";
12
11
  export declare const TYPE_NG_ENTRY_POINT = "application/ng-entry-point";
@@ -32,12 +31,11 @@ export type OutputFileCache = Map<string, {
32
31
  export declare class EntryPointNode extends Node {
33
32
  readonly url: string;
34
33
  readonly type = "application/ng-entry-point";
35
- constructor(url: string, sourcesFileCache: FileCache, ngccProcessingCache: NgccProcessingCache, moduleResolutionCache: ts.ModuleResolutionCache);
34
+ constructor(url: string, sourcesFileCache: FileCache, moduleResolutionCache: ts.ModuleResolutionCache);
36
35
  cache: {
37
36
  outputCache: OutputFileCache;
38
37
  oldPrograms?: Record<ts.ScriptTarget | 'analysis', Program | ts.Program>;
39
38
  sourcesFileCache: FileCache;
40
- ngccProcessingCache: NgccProcessingCache;
41
39
  analysesSourcesFileCache: FileCache;
42
40
  moduleResolutionCache: ts.ModuleResolutionCache;
43
41
  rollupFESM2020Cache?: RollupCache;
@@ -58,7 +56,6 @@ export declare class PackageNode extends Node {
58
56
  cache: {
59
57
  globCache: GlobCache;
60
58
  sourcesFileCache: FileCache;
61
- ngccProcessingCache: NgccProcessingCache;
62
59
  moduleResolutionCache: ts.ModuleResolutionCache;
63
60
  };
64
61
  }
@@ -8,7 +8,6 @@ const typescript_1 = __importDefault(require("typescript"));
8
8
  const file_cache_1 = require("../file-system/file-cache");
9
9
  const node_1 = require("../graph/node");
10
10
  const select_1 = require("../graph/select");
11
- const ngcc_cache_1 = require("./ngcc-cache");
12
11
  exports.TYPE_NG_PACKAGE = 'application/ng-package';
13
12
  exports.TYPE_NG_ENTRY_POINT = 'application/ng-entry-point';
14
13
  /** A node that can be read through the `fs` api. */
@@ -54,13 +53,12 @@ function ngUrl(path) {
54
53
  }
55
54
  exports.ngUrl = ngUrl;
56
55
  class EntryPointNode extends node_1.Node {
57
- constructor(url, sourcesFileCache, ngccProcessingCache, moduleResolutionCache) {
56
+ constructor(url, sourcesFileCache, moduleResolutionCache) {
58
57
  super(url);
59
58
  this.url = url;
60
59
  this.type = exports.TYPE_NG_ENTRY_POINT;
61
60
  this.cache = {
62
61
  sourcesFileCache,
63
- ngccProcessingCache,
64
62
  analysesSourcesFileCache: new file_cache_1.FileCache(),
65
63
  moduleResolutionCache,
66
64
  outputCache: new Map(),
@@ -75,7 +73,6 @@ class PackageNode extends node_1.Node {
75
73
  this.cache = {
76
74
  globCache: {},
77
75
  sourcesFileCache: new file_cache_1.FileCache(),
78
- ngccProcessingCache: new ngcc_cache_1.NgccProcessingCache(),
79
76
  moduleResolutionCache: typescript_1.default.createModuleResolutionCache(process.cwd(), s => s),
80
77
  };
81
78
  }
@@ -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;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,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"]}
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;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,IAA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AAI,GAAG,EAAE;SACvB,CAAC;IACJ,CAAC;CAoBF;AApCD,wCAoCC;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,qBAAqB,EAAE,oBAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7E,CAAC;IACJ,CAAC;CAAA;AATD,kCASC","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\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 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 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 moduleResolutionCache: ts.createModuleResolutionCache(process.cwd(), s => s),\n };\n}\n"]}
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.packageTransformFactory = void 0;
27
27
  const dependency_graph_1 = require("dependency-graph");
28
28
  const rxjs_1 = require("rxjs");
29
- const operators_1 = require("rxjs/operators");
30
29
  const file_watcher_1 = require("../file-system/file-watcher");
31
30
  const node_1 = require("../graph/node");
32
31
  const color_1 = require("../utils/color");
@@ -61,7 +60,7 @@ const packageTransformFactory = (project, options, initTsConfigTransform, analys
61
60
  return source$.pipe(
62
61
  // Discover packages and entry points
63
62
  // Clean the primary dest folder (should clean all secondary sub-directory, as well)
64
- (0, operators_1.switchMap)(async (graph) => {
63
+ (0, rxjs_1.switchMap)(async (graph) => {
65
64
  ngPkg.data = await (0, discover_packages_1.discoverPackages)({ project });
66
65
  graph.put(ngPkg);
67
66
  const { dest, deleteDestPath } = ngPkg.data;
@@ -73,7 +72,7 @@ const packageTransformFactory = (project, options, initTsConfigTransform, analys
73
72
  }
74
73
  const entryPoints = [ngPkg.data.primary, ...ngPkg.data.secondaries].map(entryPoint => {
75
74
  const { destinationFiles, moduleId } = entryPoint;
76
- const node = new nodes_1.EntryPointNode((0, nodes_1.ngUrl)(moduleId), ngPkg.cache.sourcesFileCache, ngPkg.cache.ngccProcessingCache, ngPkg.cache.moduleResolutionCache);
75
+ const node = new nodes_1.EntryPointNode((0, nodes_1.ngUrl)(moduleId), ngPkg.cache.sourcesFileCache, ngPkg.cache.moduleResolutionCache);
77
76
  node.data = { entryPoint, destinationFiles };
78
77
  node.state = 'dirty';
79
78
  ngPkg.dependsOn(node);
@@ -99,11 +98,11 @@ const watchTransformFactory = (project, _options, analyseSourcesTransform, entry
99
98
  const CompleteWaitingForFileChange = '\nCompilation complete. Watching for file changes...';
100
99
  const FileChangeDetected = '\nFile change detected. Starting incremental compilation...';
101
100
  const FailedWaitingForFileChange = '\nCompilation failed. Watching for file changes...';
102
- return source$.pipe((0, operators_1.switchMap)(graph => {
101
+ return source$.pipe((0, rxjs_1.switchMap)(graph => {
103
102
  const { data, cache } = graph.find(nodes_1.isPackage);
104
103
  const { onFileChange, watcher } = (0, file_watcher_1.createFileWatch)([], [data.dest]);
105
104
  graph.watcher = watcher;
106
- return onFileChange.pipe((0, operators_1.tap)(fileChange => {
105
+ return onFileChange.pipe((0, rxjs_1.tap)(fileChange => {
107
106
  const { filePath, event } = fileChange;
108
107
  const { sourcesFileCache } = cache;
109
108
  const cachedSourceFile = sourcesFileCache.get(filePath);
@@ -141,9 +140,9 @@ const watchTransformFactory = (project, _options, analyseSourcesTransform, entry
141
140
  if (event === 'unlink' || event === 'add') {
142
141
  cache.globCache = regenerateGlobCache(sourcesFileCache);
143
142
  }
144
- }), (0, operators_1.debounceTime)(200), (0, operators_1.tap)(() => log.msg(FileChangeDetected)), (0, operators_1.startWith)(undefined), (0, operators_1.map)(() => graph));
145
- }), (0, operators_1.switchMap)(graph => {
146
- return (0, rxjs_1.of)(graph).pipe(buildTransformFactory(project, analyseSourcesTransform, entryPointTransform), (0, operators_1.tap)(() => log.msg(CompleteWaitingForFileChange)), (0, operators_1.catchError)(error => {
143
+ }), (0, rxjs_1.debounceTime)(200), (0, rxjs_1.tap)(() => log.msg(FileChangeDetected)), (0, rxjs_1.startWith)(undefined), (0, rxjs_1.map)(() => graph));
144
+ }), (0, rxjs_1.switchMap)(graph => {
145
+ return (0, rxjs_1.of)(graph).pipe(buildTransformFactory(project, analyseSourcesTransform, entryPointTransform), (0, rxjs_1.tap)(() => log.msg(CompleteWaitingForFileChange)), (0, rxjs_1.catchError)(error => {
147
146
  log.error(error);
148
147
  log.msg(FailedWaitingForFileChange);
149
148
  return rxjs_1.NEVER;
@@ -157,7 +156,7 @@ const buildTransformFactory = (project, analyseSourcesTransform, entryPointTrans
157
156
  // Analyse dependencies and external resources for each entry point
158
157
  analyseSourcesTransform,
159
158
  // Next, run through the entry point transformation (assets rendering, code compilation)
160
- scheduleEntryPoints(entryPointTransform), (0, operators_1.tap)(graph => {
159
+ scheduleEntryPoints(entryPointTransform), (0, rxjs_1.tap)(graph => {
161
160
  const ngPkg = graph.get(pkgUri);
162
161
  log.success('\n------------------------------------------------------------------------------');
163
162
  log.success(`Built Angular Package
@@ -169,7 +168,7 @@ const buildTransformFactory = (project, analyseSourcesTransform, entryPointTrans
169
168
  log.msg(w(`\nBuild at: ${b(new Date().toISOString())} - Time: ${b('' + (Date.now() - startTime))}ms\n`));
170
169
  }));
171
170
  };
172
- const scheduleEntryPoints = (epTransform) => (0, rxjs_1.pipe)((0, operators_1.concatMap)(graph => {
171
+ const scheduleEntryPoints = (epTransform) => (0, rxjs_1.pipe)((0, rxjs_1.concatMap)(graph => {
173
172
  // Calculate node/dependency depth and determine build order
174
173
  const depGraph = new dependency_graph_1.DepGraph({ circular: false });
175
174
  const entryPoints = graph.filter(nodes_1.isEntryPoint);
@@ -186,10 +185,10 @@ const scheduleEntryPoints = (epTransform) => (0, rxjs_1.pipe)((0, operators_1.co
186
185
  // The array index is the depth.
187
186
  const groups = depGraph.overallOrder().map(nodes_1.ngUrl);
188
187
  // Build entry points with lower depth values first.
189
- return (0, rxjs_1.from)(groups).pipe((0, operators_1.map)((epUrl) => graph.find((0, nodes_1.byEntryPoint)().and(ep => ep.url === epUrl))), (0, operators_1.filter)((entryPoint) => entryPoint.state !== 'done'), (0, operators_1.concatMap)(ep => (0, rxjs_1.of)(ep).pipe(
188
+ return (0, rxjs_1.from)(groups).pipe((0, rxjs_1.map)((epUrl) => graph.find((0, nodes_1.byEntryPoint)().and(ep => ep.url === epUrl))), (0, rxjs_1.filter)((entryPoint) => entryPoint.state !== 'done'), (0, rxjs_1.concatMap)(ep => (0, rxjs_1.of)(ep).pipe(
190
189
  // Mark the entry point as 'in-progress'
191
- (0, operators_1.tap)(entryPoint => (entryPoint.state = node_1.STATE_IN_PROGRESS)), (0, operators_1.map)(() => graph), epTransform)), (0, operators_1.takeLast)(1), // don't use last as sometimes it this will cause 'no elements in sequence',
192
- (0, operators_1.defaultIfEmpty)(graph));
190
+ (0, rxjs_1.tap)(entryPoint => (entryPoint.state = node_1.STATE_IN_PROGRESS)), (0, rxjs_1.map)(() => graph), epTransform)), (0, rxjs_1.takeLast)(1), // don't use last as sometimes it this will cause 'no elements in sequence',
191
+ (0, rxjs_1.defaultIfEmpty)(graph));
193
192
  }));
194
193
  function regenerateGlobCache(sourcesFileCache) {
195
194
  const cache = {};