ng-packagr 13.1.1 → 13.2.1

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.
@@ -81,6 +81,8 @@ async function rollupBundleFile(opts) {
81
81
  await (0, cache_1.saveCacheEntry)(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));
82
82
  }
83
83
  const { code, map } = output.output[0];
84
+ // Close the bundle to let plugins clean up their external processes or services
85
+ await bundle.close();
84
86
  return {
85
87
  code: code + '//# sourceMapping' + `URL=${path.basename(opts.dest)}.map\n`,
86
88
  map,
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src/lib/flatten/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAA6C;AAC7C,sFAAsD;AACtD,2CAA6B;AAC7B,+CAAiC;AAEjC,wFAAkD;AAElD,0CAAgE;AAChE,kDAAoC;AACpC,wCAA+C;AAmB/C,mEAAmE;AAC5D,KAAK,UAAU,gBAAgB,CACpC,IAAmB;;IAEnB,GAAG,CAAC,KAAK,CAAC,YAAY,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAEvE,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;IAE3C,oBAAoB;IACpB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;QACjC,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,QAAQ,CAAC,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC;QACpD,oBAAoB,EAAE,KAAK;QAC3B,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,mCAAI,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,IAAA,sBAAc,EAAC,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACvG,KAAK,EAAE,IAAI,CAAC,KAAK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CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;KACnF;IAED,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvC,OAAO;QACL,IAAI,EAAE,IAAI,GAAG,mBAAmB,GAAG,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ;QAC1E,GAAG;QACH,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AA9DD,4CA8DC;AAED,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,oEAAoE;IACpE,yFAAyF;IACzF,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACrF,yGAAyG;QACzG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import rollupJson from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport * as path from 'path';\nimport * as rollup from 'rollup';\nimport { TransformHook } from 'rollup';\nimport sourcemaps from 'rollup-plugin-sourcemaps';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface RollupOptions {\n moduleName: string;\n entry: string;\n dest: string;\n sourceRoot: string;\n transform?: TransformHook;\n cache?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; code: string; map: rollup.SourceMap }> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n const cacheDirectory = opts.cacheDirectory;\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [\n nodeResolve(),\n sourcemaps({\n readFile: (path: string, callback: (error: Error | null, data: Buffer | string) => void) => {\n const fileData = opts.fileCache.get(ensureUnixPath(path));\n callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData?.content);\n },\n }),\n rollupJson(),\n opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,\n ],\n onwarn: warning => {\n switch (warning.code) {\n case 'UNUSED_EXTERNAL_IMPORT':\n case 'THIS_IS_UNDEFINED':\n break;\n\n default:\n log.warn(warning.message);\n break;\n }\n },\n preserveSymlinks: true,\n // Disable treeshaking when generating bundles\n // see: https://github.com/angular/angular/pull/32069\n treeshake: false,\n });\n\n // Output the bundle to disk\n const output = await bundle.write({\n name: opts.moduleName,\n format: 'es',\n file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n const { code, map } = output.output[0];\n\n return {\n code: code + '//# sourceMapping' + `URL=${path.basename(opts.dest)}.map\\n`,\n map,\n cache: bundle.cache,\n };\n}\n\nfunction isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n return true;\n}\n"]}
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../src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AAjED,4CAiEC;AAED,SAAS,oBAAoB,CAAC,QAAgB;IAC5C,oEAAoE;IACpE,yFAAyF;IACzF,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACrF,yGAAyG;QACzG,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import rollupJson from '@rollup/plugin-json';\nimport nodeResolve from '@rollup/plugin-node-resolve';\nimport * as path from 'path';\nimport * as rollup from 'rollup';\nimport { TransformHook } from 'rollup';\nimport sourcemaps from 'rollup-plugin-sourcemaps';\nimport { OutputFileCache } from '../ng-package/nodes';\nimport { readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\nimport { ensureUnixPath } from '../utils/path';\n\n/**\n * Options used in `ng-packagr` for writing flat bundle files.\n *\n * These options are passed through to rollup.\n */\nexport interface RollupOptions {\n moduleName: string;\n entry: string;\n dest: string;\n sourceRoot: string;\n transform?: TransformHook;\n cache?: rollup.RollupCache;\n cacheDirectory?: string | false;\n fileCache: OutputFileCache;\n cacheKey: string;\n}\n\n/** Runs rollup over the given entry file, writes a bundle file. */\nexport async function rollupBundleFile(\n opts: RollupOptions,\n): Promise<{ cache: rollup.RollupCache; code: string; map: rollup.SourceMap }> {\n log.debug(`rollup (v${rollup.VERSION}) ${opts.entry} to ${opts.dest}`);\n\n const cacheDirectory = opts.cacheDirectory;\n\n // Create the bundle\n const bundle = await rollup.rollup({\n context: 'this',\n external: moduleId => isExternalDependency(moduleId),\n inlineDynamicImports: false,\n cache: opts.cache ?? (cacheDirectory ? await readCacheEntry(cacheDirectory, opts.cacheKey) : undefined),\n input: opts.entry,\n plugins: [\n nodeResolve(),\n sourcemaps({\n readFile: (path: string, callback: (error: Error | null, data: Buffer | string) => void) => {\n const fileData = opts.fileCache.get(ensureUnixPath(path));\n callback(fileData ? null : new Error(`Could not load '${path}' from memory.`), fileData?.content);\n },\n }),\n rollupJson(),\n opts.transform ? { transform: opts.transform, name: 'downlevel-ts' } : undefined,\n ],\n onwarn: warning => {\n switch (warning.code) {\n case 'UNUSED_EXTERNAL_IMPORT':\n case 'THIS_IS_UNDEFINED':\n break;\n\n default:\n log.warn(warning.message);\n break;\n }\n },\n preserveSymlinks: true,\n // Disable treeshaking when generating bundles\n // see: https://github.com/angular/angular/pull/32069\n treeshake: false,\n });\n\n // Output the bundle to disk\n const output = await bundle.write({\n name: opts.moduleName,\n format: 'es',\n file: opts.dest,\n banner: '',\n sourcemap: true,\n });\n\n if (cacheDirectory) {\n await saveCacheEntry(cacheDirectory, opts.cacheKey, JSON.stringify(bundle.cache));\n }\n\n const { code, map } = output.output[0];\n\n // Close the bundle to let plugins clean up their external processes or services\n await bundle.close();\n\n return {\n code: code + '//# sourceMapping' + `URL=${path.basename(opts.dest)}.map\\n`,\n map,\n cache: bundle.cache,\n };\n}\n\nfunction isExternalDependency(moduleId: string): boolean {\n // more information about why we don't check for 'node_modules' path\n // https://github.com/rollup/rollup-plugin-node-resolve/issues/110#issuecomment-350353632\n if (moduleId.startsWith('.') || moduleId.startsWith('/') || path.isAbsolute(moduleId)) {\n // if it's either 'absolute', marked to embed, starts with a '.' or '/' or is the umd bundle and is tslib\n return false;\n }\n\n return true;\n}\n"]}
@@ -34,6 +34,7 @@ function analyseEntryPoint(graph, entryPoint, entryPoints) {
34
34
  const primaryModuleId = packageNode.data.primary.moduleId;
35
35
  (0, log_1.debug)(`Analysing sources for ${moduleId}`);
36
36
  const tsConfigOptions = {
37
+ // Needed because of `Property 'extendedDiagnostics' is incompatible with index signature.`
37
38
  ...entryPoint.data.tsConfig.options,
38
39
  skipLibCheck: true,
39
40
  noLib: true,
@@ -1 +1 @@
1
- {"version":3,"file":"analyse-sources.transform.js","sourceRoot":"","sources":["../../../../src/lib/ng-package/entry-point/analyse-sources.transform.ts"],"names":[],"mappings":";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,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,kBAAkB,CAAC,CAAC;SAC/F;KACF;AACH,CAAC","sourcesContent":["import { 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 ...entryPoint.data.tsConfig.options,\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[],\n containingFile: string,\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 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 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 exists.`);\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,+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,WAAW,IAAK,WAAW,CAAC,UAAU,CAA4B,CAAC;IACtF,MAAM,EAAE,Q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AE;QAC7B,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC;KACvD;IAED,KAAK,MAAM,UAAU,IAAI,qBAAqB,EAAE;QAC9C,MAAM,GAAG,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAE1C,IAAI,GAAG,EAAE;YACP,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,kBAAkB,CAAC,CAAC;SAC/F;KACF;AACH,CAAC","sourcesContent":["import { 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[],\n containingFile: string,\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 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 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 exists.`);\n }\n }\n}\n"]}
@@ -193,14 +193,11 @@ function transformSupportedBrowsersToTargets(supportedBrowsers) {
193
193
  // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`
194
194
  if (browserName === 'ios_saf') {
195
195
  browserName = 'ios';
196
- // browserslist also uses ranges for iOS Safari versions but only the lowest is required
197
- // to perform minimum supported feature checks. esbuild also expects a single version.
198
- [version] = version.split('-');
199
196
  }
200
- if (browserName === 'ie') {
201
- transformed.push('edge12');
202
- }
203
- else if (esBuildSupportedBrowsers.has(browserName)) {
197
+ // browserslist uses ranges `15.2-15.3` versions but only the lowest is required
198
+ // to perform minimum supported feature checks. esbuild also expects a single version.
199
+ [version] = version.split('-');
200
+ if (esBuildSupportedBrowsers.has(browserName)) {
204
201
  if (browserName === 'safari' && version === 'TP') {
205
202
  // esbuild only supports numeric versions so `TP` is converted to a high number (999) since
206
203
  // a Technology Preview (TP) of Safari is assumed to support all currently known features.
@@ -1 +1 @@
1
- {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAwC;AACxC,2BAAgC;AAChC,+BAA8C;AAC9C,sDAA8B;AAC9B,4EAAkD;AAClD,8DAAqC;AACrC,kEAA8D;AAC9D,0CAA6E;AAC7E,kDAAoC;AAEpC,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACf,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB;AAED,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAOD,MAAa,mBAAmB;IAO9B,YACmB,QAAgB,EAChB,MAAe,EACf,YAAuB,EACvB,cAA+B;QAH/B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAS;QACf,iBAAY,GAAZ,YAAY,CAAW;QACvB,mBAAc,GAAd,cAAc,CAAiB;QAP1C,YAAO,GAAG,IAAI,kCAAe,EAAE,CAAC;QAStC,GAAG,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzD,sDAAsD;QACtD,gHAAgH;QAEhH,gEAAgE;QAChE,2CAA2C;QAC1C,sBAAY,CAAC,QAAqB,GAAG;YACpC,uBAAuB;YACvB,wBAAwB;YACxB,4BAA4B;YAC5B,8BAA8B;Y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ACL,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACnB,IAAI;KACL,CAAC;AACJ,CAAC","sourcesContent":["import browserslist from 'browserslist';\nimport { existsSync } from 'fs';\nimport { dirname, extname, join } from 'path';\nimport postcss from 'postcss';\nimport postcssPresetEnv from 'postcss-preset-env';\nimport postcssUrl from 'postcss-url';\nimport { EsbuildExecutor } from '../esbuild/esbuild-executor';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\n\nexport enum CssUrl {\n inline = 'inline',\n none = 'none',\n}\n\nexport enum InlineStyleLanguage {\n sass = 'sass',\n scss = 'scss',\n css = 'css',\n less = 'less',\n}\n\nexport interface Result {\n css: string;\n warnings: string[];\n error?: string;\n}\nexport class StylesheetProcessor {\n private browserslistData: string[];\n private targets: string[];\n private postCssProcessor: ReturnType<typeof postcss>;\n private esbuild = new EsbuildExecutor();\n private styleIncludePaths: string[];\n\n constructor(\n private readonly basePath: string,\n private readonly cssUrl?: CssUrl,\n private readonly includePaths?: string[],\n private readonly cacheDirectory?: string | false,\n ) {\n log.debug(`determine browserslist for ${this.basePath}`);\n // By default, browserslist defaults are too inclusive\n // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522\n\n // We change the default query to browsers that Angular support.\n // https://angular.io/guide/browser-support\n (browserslist.defaults as string[]) = [\n 'last 1 Chrome version',\n 'last 1 Firefox version',\n 'last 2 Edge major versions',\n 'last 2 Safari major versions',\n 'last 2 iOS major versions',\n 'Firefox ESR',\n ];\n\n this.styleIncludePaths = [...this.includePaths];\n let prevDir = null;\n let currentDir = this.basePath;\n\n while (currentDir !== prevDir) {\n const p = join(currentDir, 'node_modules');\n if (existsSync(p)) {\n this.styleIncludePaths.push(p);\n }\n\n prevDir = currentDir;\n currentDir = dirname(prevDir);\n }\n\n this.browserslistData = browserslist(undefined, { path: this.basePath });\n this.targets = transformSupportedBrowsersToTargets(this.browserslistData);\n this.postCssProcessor = this.createPostCssPlugins();\n }\n\n async process({ filePath, content }: { filePath: string; content: string }): Promise<string> {\n let key: string | undefined;\n\n if (!content.includes('@import') && !content.includes('@use') && this.cacheDirectory) {\n // No transitive deps, we can cache more aggressively.\n key = await generateKey(content, ...this.browserslistData);\n const result = await readCacheEntry(this.cacheDirectory, key);\n if (result) {\n result.warnings.forEach(msg => log.warn(msg));\n\n return result.css;\n }\n }\n\n // Render pre-processor language (sass, styl, less)\n const renderedCss = await this.renderCss(filePath, content);\n\n // We cannot cache CSS re-rendering phase, because a transitive dependency via (@import) can case different CSS output.\n // Example a change in a mixin or SCSS variable.\n if (!key) {\n key = await generateKey(renderedCss, ...this.browserslistData);\n }\n\n if (this.cacheDirectory) {\n const cachedResult = await readCacheEntry(this.cacheDirectory, key);\n if (cachedResult) {\n cachedResult.warnings.forEach(msg => log.warn(msg));\n\n return cachedResult.css;\n }\n }\n // Render postcss (autoprefixing and friends)\n const result = await this.postCssProcessor.process(renderedCss, {\n from: filePath,\n to: filePath.replace(extname(filePath), '.css'),\n });\n\n const warnings = result.warnings().map(w => w.toString());\n const { code, warnings: esBuildWarnings } = await this.esbuild.transform(result.css, {\n loader: 'css',\n minify: true,\n target: this.targets,\n sourcefile: filePath,\n });\n\n if (esBuildWarnings.length > 0) {\n warnings.push(...(await this.esbuild.formatMessages(esBuildWarnings, { kind: 'warning' })));\n }\n\n if (this.cacheDirectory) {\n await saveCacheEntry(\n this.cacheDirectory,\n key,\n JSON.stringify({\n css: code,\n warnings,\n }),\n );\n }\n warnings.forEach(msg => log.warn(msg));\n\n return code;\n }\n\n private createPostCssPlugins(): ReturnType<typeof postcss> {\n const postCssPlugins = [];\n if (this.cssUrl !== CssUrl.none) {\n postCssPlugins.push(postcssUrl({ url: this.cssUrl }));\n }\n\n postCssPlugins.push(\n postcssPresetEnv({\n browsers: this.browserslistData,\n autoprefixer: true,\n stage: 3,\n }),\n );\n\n return postcss(postCssPlugins);\n }\n\n private async renderCss(filePath: string, css: string): Promise<string> {\n const ext = extname(filePath);\n\n switch (ext) {\n case '.sass':\n case '.scss': {\n return (await import('sass'))\n .renderSync({\n file: filePath,\n data: css,\n indentedSyntax: '.sass' === ext,\n importer: customSassImporter,\n includePaths: this.styleIncludePaths,\n })\n .css.toString();\n }\n case '.less': {\n const { css: content } = await (\n await import('less')\n ).default.render(css, {\n filename: filePath,\n math: 'always',\n javascriptEnabled: true,\n paths: this.styleIncludePaths,\n });\n\n return content;\n }\n case '.styl':\n case '.stylus': {\n const stylus = (await import('stylus')).default;\n\n return (\n stylus(css)\n // add paths for resolve\n .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])\n // add support for resolving plugins from node_modules\n .set('filename', filePath)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver(undefined))\n .render()\n );\n }\n case '.css':\n default:\n return css;\n }\n }\n}\n\nfunction transformSupportedBrowsersToTargets(supportedBrowsers: string[]): string[] {\n const transformed: string[] = [];\n\n // https://esbuild.github.io/api/#target\n const esBuildSupportedBrowsers = new Set(['safari', 'firefox', 'edge', 'chrome', 'ios']);\n\n for (const browser of supportedBrowsers) {\n let [browserName, version] = browser.split(' ');\n\n // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`\n if (browserName === 'ios_saf') {\n browserName = 'ios';\n // browserslist also uses ranges for iOS Safari versions but only the lowest is required\n // to perform minimum supported feature checks. esbuild also expects a single version.\n [version] = version.split('-');\n }\n\n if (browserName === 'ie') {\n transformed.push('edge12');\n } else if (esBuildSupportedBrowsers.has(browserName)) {\n if (browserName === 'safari' && version === 'TP') {\n // esbuild only supports numeric versions so `TP` is converted to a high number (999) since\n // a Technology Preview (TP) of Safari is assumed to support all currently known features.\n version = '999';\n }\n\n transformed.push(browserName + version);\n }\n }\n\n return transformed.length ? transformed : undefined;\n}\n\nfunction customSassImporter(url: string, prev: string): { file: string; prev: string } | undefined {\n // NB: Sass importer should always be sync as otherwise it will cause\n // sass to go in the async path which is slower.\n if (url[0] !== '~') {\n return undefined;\n }\n\n return {\n file: url.substr(1),\n prev,\n };\n}\n"]}
1
+ {"version":3,"file":"stylesheet-processor.js","sourceRoot":"","sources":["../../../src/lib/styles/stylesheet-processor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gEAAwC;AACxC,2BAAgC;AAChC,+BAA8C;AAC9C,sDAA8B;AAC9B,4EAAkD;AAClD,8DAAqC;AACrC,kEAA8D;AAC9D,0CAA6E;AAC7E,kDAAoC;AAEpC,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACf,CAAC,EAHW,MAAM,GAAN,cAAM,KAAN,cAAM,QAGjB;AAED,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAOD,MAAa,mBAAmB;IAO9B,YACmB,QAAgB,EAChB,MAAe,EACf,YAAuB,EACvB,cAA+B;QAH/B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAS;QACf,iBAAY,GAAZ,YAAY,CAAW;QACvB,mBAAc,GAAd,cAAc,CAAiB;QAP1C,YAAO,GAAG,IAAI,kCAAe,EAAE,CAAC;QAStC,GAAG,CAAC,KAAK,CAAC,8BAA8B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACzD,sDAAsD;QACtD,gHAAgH;QAEhH,gEAAgE;QAChE,2CAA2C;QAC1C,sBAAY,CAAC,QAAqB,GAAG;YACpC,uBAAuB;YACvB,wBAAwB;YACxB,4BAA4B;YAC5B,8BAA8B;YAC9B,2BAA2B;YAC3B,aAAa;SACd,CAAC;QAEF,IAAI,CAAC,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,C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AAC,iBAA2B;IACtE,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,wCAAwC;IACxC,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAEzF,KAAK,MAAM,OAAO,IAAI,iBAAiB,EAAE;QACvC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEhD,iFAAiF;QACjF,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,WAAW,GAAG,KAAK,CAAC;SACrB;QAED,gFAAgF;QAChF,sFAAsF;QACtF,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE/B,IAAI,wBAAwB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;YAC7C,IAAI,WAAW,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,EAAE;gBAChD,2FAA2F;gBAC3F,0FAA0F;gBAC1F,OAAO,GAAG,KAAK,CAAC;aACjB;YAED,WAAW,CAAC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,CAAC;SACzC;KACF;IAED,OAAO,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,kBAAkB,CAAC,GAAW,EAAE,IAAY;IACnD,qEAAqE;IACrE,gDAAgD;IAChD,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;QAClB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACnB,IAAI;KACL,CAAC;AACJ,CAAC","sourcesContent":["import browserslist from 'browserslist';\nimport { existsSync } from 'fs';\nimport { dirname, extname, join } from 'path';\nimport postcss from 'postcss';\nimport postcssPresetEnv from 'postcss-preset-env';\nimport postcssUrl from 'postcss-url';\nimport { EsbuildExecutor } from '../esbuild/esbuild-executor';\nimport { generateKey, readCacheEntry, saveCacheEntry } from '../utils/cache';\nimport * as log from '../utils/log';\n\nexport enum CssUrl {\n inline = 'inline',\n none = 'none',\n}\n\nexport enum InlineStyleLanguage {\n sass = 'sass',\n scss = 'scss',\n css = 'css',\n less = 'less',\n}\n\nexport interface Result {\n css: string;\n warnings: string[];\n error?: string;\n}\nexport class StylesheetProcessor {\n private browserslistData: string[];\n private targets: string[];\n private postCssProcessor: ReturnType<typeof postcss>;\n private esbuild = new EsbuildExecutor();\n private styleIncludePaths: string[];\n\n constructor(\n private readonly basePath: string,\n private readonly cssUrl?: CssUrl,\n private readonly includePaths?: string[],\n private readonly cacheDirectory?: string | false,\n ) {\n log.debug(`determine browserslist for ${this.basePath}`);\n // By default, browserslist defaults are too inclusive\n // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522\n\n // We change the default query to browsers that Angular support.\n // https://angular.io/guide/browser-support\n (browserslist.defaults as string[]) = [\n 'last 1 Chrome version',\n 'last 1 Firefox version',\n 'last 2 Edge major versions',\n 'last 2 Safari major versions',\n 'last 2 iOS major versions',\n 'Firefox ESR',\n ];\n\n this.styleIncludePaths = [...this.includePaths];\n let prevDir = null;\n let currentDir = this.basePath;\n\n while (currentDir !== prevDir) {\n const p = join(currentDir, 'node_modules');\n if (existsSync(p)) {\n this.styleIncludePaths.push(p);\n }\n\n prevDir = currentDir;\n currentDir = dirname(prevDir);\n }\n\n this.browserslistData = browserslist(undefined, { path: this.basePath });\n this.targets = transformSupportedBrowsersToTargets(this.browserslistData);\n this.postCssProcessor = this.createPostCssPlugins();\n }\n\n async process({ filePath, content }: { filePath: string; content: string }): Promise<string> {\n let key: string | undefined;\n\n if (!content.includes('@import') && !content.includes('@use') && this.cacheDirectory) {\n // No transitive deps, we can cache more aggressively.\n key = await generateKey(content, ...this.browserslistData);\n const result = await readCacheEntry(this.cacheDirectory, key);\n if (result) {\n result.warnings.forEach(msg => log.warn(msg));\n\n return result.css;\n }\n }\n\n // Render pre-processor language (sass, styl, less)\n const renderedCss = await this.renderCss(filePath, content);\n\n // We cannot cache CSS re-rendering phase, because a transitive dependency via (@import) can case different CSS output.\n // Example a change in a mixin or SCSS variable.\n if (!key) {\n key = await generateKey(renderedCss, ...this.browserslistData);\n }\n\n if (this.cacheDirectory) {\n const cachedResult = await readCacheEntry(this.cacheDirectory, key);\n if (cachedResult) {\n cachedResult.warnings.forEach(msg => log.warn(msg));\n\n return cachedResult.css;\n }\n }\n // Render postcss (autoprefixing and friends)\n const result = await this.postCssProcessor.process(renderedCss, {\n from: filePath,\n to: filePath.replace(extname(filePath), '.css'),\n });\n\n const warnings = result.warnings().map(w => w.toString());\n const { code, warnings: esBuildWarnings } = await this.esbuild.transform(result.css, {\n loader: 'css',\n minify: true,\n target: this.targets,\n sourcefile: filePath,\n });\n\n if (esBuildWarnings.length > 0) {\n warnings.push(...(await this.esbuild.formatMessages(esBuildWarnings, { kind: 'warning' })));\n }\n\n if (this.cacheDirectory) {\n await saveCacheEntry(\n this.cacheDirectory,\n key,\n JSON.stringify({\n css: code,\n warnings,\n }),\n );\n }\n warnings.forEach(msg => log.warn(msg));\n\n return code;\n }\n\n private createPostCssPlugins(): ReturnType<typeof postcss> {\n const postCssPlugins = [];\n if (this.cssUrl !== CssUrl.none) {\n postCssPlugins.push(postcssUrl({ url: this.cssUrl }));\n }\n\n postCssPlugins.push(\n postcssPresetEnv({\n browsers: this.browserslistData,\n autoprefixer: true,\n stage: 3,\n }),\n );\n\n return postcss(postCssPlugins);\n }\n\n private async renderCss(filePath: string, css: string): Promise<string> {\n const ext = extname(filePath);\n\n switch (ext) {\n case '.sass':\n case '.scss': {\n return (await import('sass'))\n .renderSync({\n file: filePath,\n data: css,\n indentedSyntax: '.sass' === ext,\n importer: customSassImporter,\n includePaths: this.styleIncludePaths,\n })\n .css.toString();\n }\n case '.less': {\n const { css: content } = await (\n await import('less')\n ).default.render(css, {\n filename: filePath,\n math: 'always',\n javascriptEnabled: true,\n paths: this.styleIncludePaths,\n });\n\n return content;\n }\n case '.styl':\n case '.stylus': {\n const stylus = (await import('stylus')).default;\n\n return (\n stylus(css)\n // add paths for resolve\n .set('paths', [this.basePath, '.', ...this.styleIncludePaths, 'node_modules'])\n // add support for resolving plugins from node_modules\n .set('filename', filePath)\n // turn on url resolver in stylus, same as flag --resolve-url\n .set('resolve url', true)\n .define('url', stylus.resolver(undefined))\n .render()\n );\n }\n case '.css':\n default:\n return css;\n }\n }\n}\n\nfunction transformSupportedBrowsersToTargets(supportedBrowsers: string[]): string[] {\n const transformed: string[] = [];\n\n // https://esbuild.github.io/api/#target\n const esBuildSupportedBrowsers = new Set(['safari', 'firefox', 'edge', 'chrome', 'ios']);\n\n for (const browser of supportedBrowsers) {\n let [browserName, version] = browser.split(' ');\n\n // browserslist uses the name `ios_saf` for iOS Safari whereas esbuild uses `ios`\n if (browserName === 'ios_saf') {\n browserName = 'ios';\n }\n\n // browserslist uses ranges `15.2-15.3` versions but only the lowest is required\n // to perform minimum supported feature checks. esbuild also expects a single version.\n [version] = version.split('-');\n\n if (esBuildSupportedBrowsers.has(browserName)) {\n if (browserName === 'safari' && version === 'TP') {\n // esbuild only supports numeric versions so `TP` is converted to a high number (999) since\n // a Technology Preview (TP) of Safari is assumed to support all currently known features.\n version = '999';\n }\n\n transformed.push(browserName + version);\n }\n }\n\n return transformed.length ? transformed : undefined;\n}\n\nfunction customSassImporter(url: string, prev: string): { file: string; prev: string } | undefined {\n // NB: Sass importer should always be sync as otherwise it will cause\n // sass to go in the async path which is slower.\n if (url[0] !== '~') {\n return undefined;\n }\n\n return {\n file: url.substr(1),\n prev,\n };\n}\n"]}
@@ -83,7 +83,7 @@ async function initializeTsConfig(defaultTsConfig, entryPoints) {
83
83
  (0, log_1.warn)('Project is attempting to disable the Ivy compiler. ' +
84
84
  'Angular versions 13 and higher do not support View Engine compiler for libraries. ' +
85
85
  'The Ivy compiler will be used to build this project. ' +
86
- '\nFor additional information or if the build fails, please see https://angular.io/guide/ivy');
86
+ '\nFor additional information or if the build fails, please see https://v12.angular.io/guide/ivy');
87
87
  defaultTsConfigParsed.options.enableIvy = true;
88
88
  defaultTsConfigParsed.options.compilationMode = 'partial';
89
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,4DAA4B;AAE5B,kDAAoC;AACpC,sCAAoC;AACpC,8DAAyD;AAE5C,QAAA,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;AACrF;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,QAAQ,GAAG,2BAAmB;IAC/D,8BAA8B;IAC9B,MAAM,YAAY,GAAoB;QACpC,gBAAgB,EAAE,oBAAE,CAAC,oBAAoB,CAAC,MAAM;QAChD,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,sBAAsB,EAAE,IAAI;QAE5B,aAAa;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QAErB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,IAAI;QAEjB,yBAAyB;QACzB,sBAAsB,EAAE,IAAI;QAE5B,sDAAsD;QACtD,YAAY,EAAE,eAAe;QAC7B,iBAAiB,EAAE,eAAe;KACnC,CAAC;IAEF,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,+BAAa,GAAE,CAAC;IAEpD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,qBAAqB,CAAC,MAAqC;IACxE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,m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CAAC,OAAO,CAAC,GAAG,UAAU,CAAC,CAAC;SACzD;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAzBD,oEAyBC","sourcesContent":["import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport * as log from '../utils/log';\nimport { warn } from '../utils/log';\nimport { ngCompilerCli } from '../utils/ng-compiler-cli';\n\nexport const defaultTsConfigPath = path.join(__dirname, 'conf', 'tsconfig.ngc.json');\n/**\n * Reads the default TypeScript configuration.\n */\nasync function readDefaultTsConfig(fileName = defaultTsConfigPath): Promise<ParsedConfiguration> {\n // these options are mandatory\n const extraOptions: CompilerOptions = {\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n target: ts.ScriptTarget.ES2020,\n experimentalDecorators: true,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler to options\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const { readConfiguration } = await ngCompilerCli();\n\n return readConfiguration(fileName, extraOptions);\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nasync function createDefaultTsConfig(values?: ParsedConfiguration | string): Promise<ParsedConfiguration> {\n if (!values) {\n return readDefaultTsConfig();\n } else if (typeof values === 'string') {\n return readDefaultTsConfig(values);\n } else {\n return values;\n }\n}\n\n/**\n * Initializes TypeScript Compiler options and Angular Compiler options by overriding the\n * default config with entry point-specific values.\n */\nexport async function initializeTsConfig(\n defaultTsConfig: ParsedConfiguration | string | undefined,\n entryPoints: EntryPointNode[],\n): Promise<void> {\n const defaultTsConfigParsed = await createDefaultTsConfig(defaultTsConfig);\n if (defaultTsConfigParsed.errors.length > 0) {\n const { formatDiagnostics } = await ngCompilerCli();\n throw new Error(formatDiagnostics(defaultTsConfigParsed.errors));\n }\n\n if (defaultTsConfigParsed.options.enableIvy === false) {\n warn(\n 'Project is attempting to disable the Ivy compiler. ' +\n 'Angular versions 13 and higher do not support View Engine compiler for libraries. ' +\n 'The Ivy compiler will be used to build this project. ' +\n '\\nFor additional information or if the build fails, please see https://angular.io/guide/ivy',\n );\n\n defaultTsConfigParsed.options.enableIvy = true;\n defaultTsConfigParsed.options.compilationMode = 'partial';\n }\n\n entryPoints.forEach(currentEntryPoint => {\n const { entryPoint } = currentEntryPoint.data;\n log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);\n const basePath = path.dirname(entryPoint.entryFilePath);\n\n // Resolve defaults from DI token and create a deep copy of the defaults\n const tsConfig: ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfigParsed));\n const overrideOptions: CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: '',\n };\n\n tsConfig.rootNames = [entryPoint.entryFilePath];\n tsConfig.options = { ...tsConfig.options, ...overrideOptions };\n currentEntryPoint.data.tsConfig = tsConfig;\n });\n}\n\n/**\n * Set the paths for entrypoint dependencies.\n *\n * This doesn't mutate the object.\n *\n * @param parsedTsConfig - A parsed tsconfig\n * @param entryPoints - A list of entryPoints\n * @param pointToSource Point the path mapping to either the source code or emitted declarations.\n * Typically for analysis one should point to the source files while for a compilation once should use the emitted declarations\n */\nexport function setDependenciesTsConfigPaths(\n parsedTsConfig: ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): ParsedConfiguration {\n const tsConfig = JSON.parse(JSON.stringify(parsedTsConfig));\n\n // Add paths mappings for dependencies\n if (!tsConfig.options.paths) {\n tsConfig.options.paths = {};\n }\n\n for (const dep of entryPoints) {\n const { entryPoint } = dep.data;\n const { moduleId, destinationFiles, entryFilePath } = entryPoint;\n const mappedPath = [pointToSource ? entryFilePath : destinationFiles.declarations];\n\n if (!tsConfig.options.paths[moduleId]) {\n tsConfig.options.paths[moduleId] = mappedPath;\n } else {\n tsConfig.options.paths[moduleId].unshift(...mappedPath);\n }\n }\n\n return tsConfig;\n}\n"]}
1
+ {"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../../src/lib/ts/tsconfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAA6B;AAC7B,4DAA4B;AAE5B,kDAAoC;AACpC,sCAAoC;AACpC,8DAAyD;AAE5C,QAAA,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;AACrF;;GAEG;AACH,KAAK,UAAU,mBAAmB,CAAC,QAAQ,GAAG,2BAAmB;IAC/D,8BAA8B;IAC9B,MAAM,YAAY,GAAoB;QACpC,gBAAgB,EAAE,oBAAE,CAAC,oBAAoB,CAAC,MAAM;QAChD,MAAM,EAAE,oBAAE,CAAC,YAAY,CAAC,MAAM;QAC9B,sBAAsB,EAAE,IAAI;QAE5B,aAAa;QACb,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,IAAI;QAErB,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,IAAI;QAEjB,yBAAyB;QACzB,sBAAsB,EAAE,IAAI;QAE5B,sDAAsD;QACtD,YAAY,EAAE,eAAe;QAC7B,iBAAiB,EAAE,eAAe;KACnC,CAAC;IAEF,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,+BAAa,GAAE,CAAC;IAEpD,OAAO,iBAAiB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,qBAAqB,CAAC,MAAqC;IACxE,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,mBAAmB,EAAE,CAAC;KAC9B;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACrC,OAAO,mBA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AC;AAzBD,oEAyBC","sourcesContent":["import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';\nimport * as path from 'path';\nimport ts from 'typescript';\nimport { EntryPointNode } from '../ng-package/nodes';\nimport * as log from '../utils/log';\nimport { warn } from '../utils/log';\nimport { ngCompilerCli } from '../utils/ng-compiler-cli';\n\nexport const defaultTsConfigPath = path.join(__dirname, 'conf', 'tsconfig.ngc.json');\n/**\n * Reads the default TypeScript configuration.\n */\nasync function readDefaultTsConfig(fileName = defaultTsConfigPath): Promise<ParsedConfiguration> {\n // these options are mandatory\n const extraOptions: CompilerOptions = {\n moduleResolution: ts.ModuleResolutionKind.NodeJs,\n target: ts.ScriptTarget.ES2020,\n experimentalDecorators: true,\n\n // sourcemaps\n sourceMap: false,\n inlineSources: true,\n inlineSourceMap: true,\n\n outDir: '',\n declaration: true,\n\n // ng compiler to options\n enableResourceInlining: true,\n\n // these are required to set the appropriate EmitFlags\n flatModuleId: 'AUTOGENERATED',\n flatModuleOutFile: 'AUTOGENERATED',\n };\n\n const { readConfiguration } = await ngCompilerCli();\n\n return readConfiguration(fileName, extraOptions);\n}\n\n/**\n * Creates a parsed TypeScript configuration object.\n *\n * @param values File path or parsed configuration.\n */\nasync function createDefaultTsConfig(values?: ParsedConfiguration | string): Promise<ParsedConfiguration> {\n if (!values) {\n return readDefaultTsConfig();\n } else if (typeof values === 'string') {\n return readDefaultTsConfig(values);\n } else {\n return values;\n }\n}\n\n/**\n * Initializes TypeScript Compiler options and Angular Compiler options by overriding the\n * default config with entry point-specific values.\n */\nexport async function initializeTsConfig(\n defaultTsConfig: ParsedConfiguration | string | undefined,\n entryPoints: EntryPointNode[],\n): Promise<void> {\n const defaultTsConfigParsed = await createDefaultTsConfig(defaultTsConfig);\n if (defaultTsConfigParsed.errors.length > 0) {\n const { formatDiagnostics } = await ngCompilerCli();\n throw new Error(formatDiagnostics(defaultTsConfigParsed.errors));\n }\n\n if (defaultTsConfigParsed.options.enableIvy === false) {\n warn(\n 'Project is attempting to disable the Ivy compiler. ' +\n 'Angular versions 13 and higher do not support View Engine compiler for libraries. ' +\n 'The Ivy compiler will be used to build this project. ' +\n '\\nFor additional information or if the build fails, please see https://v12.angular.io/guide/ivy',\n );\n\n defaultTsConfigParsed.options.enableIvy = true;\n defaultTsConfigParsed.options.compilationMode = 'partial';\n }\n\n entryPoints.forEach(currentEntryPoint => {\n const { entryPoint } = currentEntryPoint.data;\n log.debug(`Initializing tsconfig for ${entryPoint.moduleId}`);\n const basePath = path.dirname(entryPoint.entryFilePath);\n\n // Resolve defaults from DI token and create a deep copy of the defaults\n const tsConfig: ParsedConfiguration = JSON.parse(JSON.stringify(defaultTsConfigParsed));\n const overrideOptions: CompilerOptions = {\n flatModuleId: entryPoint.moduleId,\n flatModuleOutFile: `${entryPoint.flatModuleFile}.js`,\n basePath,\n rootDir: basePath,\n sourceRoot: '',\n };\n\n tsConfig.rootNames = [entryPoint.entryFilePath];\n tsConfig.options = { ...tsConfig.options, ...overrideOptions };\n currentEntryPoint.data.tsConfig = tsConfig;\n });\n}\n\n/**\n * Set the paths for entrypoint dependencies.\n *\n * This doesn't mutate the object.\n *\n * @param parsedTsConfig - A parsed tsconfig\n * @param entryPoints - A list of entryPoints\n * @param pointToSource Point the path mapping to either the source code or emitted declarations.\n * Typically for analysis one should point to the source files while for a compilation once should use the emitted declarations\n */\nexport function setDependenciesTsConfigPaths(\n parsedTsConfig: ParsedConfiguration,\n entryPoints: EntryPointNode[],\n pointToSource = false,\n): ParsedConfiguration {\n const tsConfig = JSON.parse(JSON.stringify(parsedTsConfig));\n\n // Add paths mappings for dependencies\n if (!tsConfig.options.paths) {\n tsConfig.options.paths = {};\n }\n\n for (const dep of entryPoints) {\n const { entryPoint } = dep.data;\n const { moduleId, destinationFiles, entryFilePath } = entryPoint;\n const mappedPath = [pointToSource ? entryFilePath : destinationFiles.declarations];\n\n if (!tsConfig.options.paths[moduleId]) {\n tsConfig.options.paths[moduleId] = mappedPath;\n } else {\n tsConfig.options.paths[moduleId].unshift(...mappedPath);\n }\n }\n\n return tsConfig;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ng-packagr",
3
- "version": "13.1.1",
3
+ "version": "13.2.1",
4
4
  "description": "Compile and package Angular libraries in Angular Package Format (APF)",
5
5
  "keywords": [
6
6
  "apf",
@@ -18,7 +18,10 @@
18
18
  },
19
19
  "author": "David Herges <david@spektrakel.de>",
20
20
  "license": "MIT",
21
- "repository": "https://github.com/ng-packagr/ng-packagr.git",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/ng-packagr/ng-packagr.git"
24
+ },
22
25
  "homepage": "https://github.com/ng-packagr/ng-packagr",
23
26
  "bugs": {
24
27
  "url": "https://github.com/ng-packagr/ng-packagr/issues"
@@ -46,13 +49,13 @@
46
49
  "less": "^4.1.0",
47
50
  "ora": "^5.1.0",
48
51
  "postcss": "^8.2.4",
49
- "postcss-preset-env": "^6.7.0",
52
+ "postcss-preset-env": "^7.0.0",
50
53
  "postcss-url": "^10.1.1",
51
54
  "rollup": "^2.45.1",
52
55
  "rollup-plugin-sourcemaps": "^0.6.3",
53
- "rxjs": "^6.5.0",
56
+ "rxjs": "^7.0.0",
54
57
  "sass": "^1.32.8",
55
- "stylus": "^0.55.0"
58
+ "stylus": "^0.56.0"
56
59
  },
57
60
  "optionalDependencies": {
58
61
  "esbuild": "^0.14.0"