@angular/compiler-cli 14.0.0-next.15 → 14.0.0-next.16

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/bundles/{chunk-ZNTB6B4W.js → chunk-36EOQKNZ.js} +3 -3
  2. package/bundles/{chunk-ZNTB6B4W.js.map → chunk-36EOQKNZ.js.map} +0 -0
  3. package/bundles/{chunk-PR5JCXGL.js → chunk-4TK5AAQK.js} +2 -2
  4. package/bundles/{chunk-PR5JCXGL.js.map → chunk-4TK5AAQK.js.map} +0 -0
  5. package/bundles/{chunk-RJMU2IDU.js → chunk-6E6DHHHX.js} +16 -12
  6. package/bundles/chunk-6E6DHHHX.js.map +6 -0
  7. package/bundles/{chunk-CPLZ6CTJ.js → chunk-7XY4OMWJ.js} +4 -4
  8. package/bundles/{chunk-CPLZ6CTJ.js.map → chunk-7XY4OMWJ.js.map} +0 -0
  9. package/bundles/{chunk-2ZVQLOCC.js → chunk-HZUCTYDG.js} +39 -19
  10. package/bundles/{chunk-2ZVQLOCC.js.map → chunk-HZUCTYDG.js.map} +1 -1
  11. package/bundles/{chunk-UMDDHI5B.js → chunk-JDKMNZ6O.js} +2 -1
  12. package/bundles/chunk-JDKMNZ6O.js.map +6 -0
  13. package/bundles/{chunk-7464WID2.js → chunk-OGPZOZRU.js} +4 -4
  14. package/bundles/{chunk-7464WID2.js.map → chunk-OGPZOZRU.js.map} +0 -0
  15. package/bundles/index.js +4 -4
  16. package/bundles/linker/babel/index.js +2 -2
  17. package/bundles/linker/index.js +2 -2
  18. package/bundles/ngcc/index.js +5 -5
  19. package/bundles/ngcc/main-ngcc.js +5 -5
  20. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +4 -4
  21. package/bundles/private/migrations.js +2 -2
  22. package/bundles/src/bin/ng_xi18n.js +4 -4
  23. package/bundles/src/bin/ngc.js +4 -4
  24. package/bundles_metadata.json +1 -1
  25. package/ngcc/src/packages/build_marker.d.ts +1 -1
  26. package/package.json +3 -3
  27. package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
  28. package/src/ngtsc/core/src/host.d.ts +2 -2
  29. package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
  30. package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
  31. package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
  32. package/bundles/chunk-RJMU2IDU.js.map +0 -6
  33. package/bundles/chunk-UMDDHI5B.js.map +0 -6
@@ -35,7 +35,7 @@ import {
35
35
  translateExpression,
36
36
  translateStatement,
37
37
  translateType
38
- } from "./chunk-UMDDHI5B.js";
38
+ } from "./chunk-JDKMNZ6O.js";
39
39
  import {
40
40
  absoluteFrom,
41
41
  absoluteFromSourceFile,
@@ -2621,7 +2621,7 @@ function getDiagnosticNode(ref, rawExpr) {
2621
2621
  }
2622
2622
  function makeNotStandaloneDiagnostic(scopeReader, ref, rawExpr, kind) {
2623
2623
  const scope = scopeReader.getScopeForComponent(ref.node);
2624
- let message = `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly`;
2624
+ let message = `The ${kind} '${ref.node.name.text}' appears in 'imports', but is not standalone and cannot be imported directly.`;
2625
2625
  let relatedInformation = void 0;
2626
2626
  if (scope !== null && scope.kind === ComponentScopeKind.NgModule) {
2627
2627
  const isExported3 = scope.exported.dependencies.some((dep) => dep.ref.node === ref.node);
@@ -5100,6 +5100,12 @@ var NgModuleDecoratorHandler = class {
5100
5100
  const expr = ngModule.get("bootstrap");
5101
5101
  const bootstrapMeta = this.evaluator.evaluate(expr, forwardRefResolver);
5102
5102
  bootstrapRefs = this.resolveTypeList(expr, bootstrapMeta, name, "bootstrap", 0).references;
5103
+ for (const ref of bootstrapRefs) {
5104
+ const dirMeta = this.metaReader.getDirectiveMetadata(ref);
5105
+ if (dirMeta == null ? void 0 : dirMeta.isStandalone) {
5106
+ diagnostics.push(makeStandaloneBootstrapDiagnostic(node, ref, expr));
5107
+ }
5108
+ }
5103
5109
  }
5104
5110
  const schemas = ngModule.has("schemas") ? extractSchemas(ngModule.get("schemas"), this.evaluator, "NgModule") : [];
5105
5111
  let id = null;
@@ -5488,6 +5494,12 @@ function isModuleIdExpression(expr) {
5488
5494
  function isResolvedModuleWithProviders(sv) {
5489
5495
  return typeof sv.value === "object" && sv.value != null && sv.value.hasOwnProperty("ngModule") && sv.value.hasOwnProperty("mwpCall");
5490
5496
  }
5497
+ function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef, rawBootstrapExpr) {
5498
+ const componentClassName = bootstrappedClassRef.node.name.text;
5499
+ const message = `The \`${componentClassName}\` class is a standalone component, which can not be used in the \`@NgModule.bootstrap\` array. Use the \`bootstrapApplication\` function for bootstrap instead.`;
5500
+ const relatedInformation = [makeRelatedInformation(ngModuleClass, `The 'bootstrap' array is present on this NgModule.`)];
5501
+ return makeDiagnostic(ErrorCode.NGMODULE_BOOTSTRAP_IS_STANDALONE, getDiagnosticNode(bootstrappedClassRef, rawBootstrapExpr), message, relatedInformation);
5502
+ }
5491
5503
 
5492
5504
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/diagnostics.mjs
5493
5505
  function makeCyclicImportInfo(ref, type, cycle) {
@@ -5712,11 +5724,11 @@ function makeResourceNotFoundError(file, nodeForError, resourceType) {
5712
5724
  }
5713
5725
  return new FatalDiagnosticError(ErrorCode.COMPONENT_RESOURCE_NOT_FOUND, nodeForError, errorText);
5714
5726
  }
5715
- function transformDecoratorToInlineResources(dec, component, styles, template) {
5727
+ function transformDecoratorResources(dec, component, styles, template) {
5716
5728
  if (dec.name !== "Component") {
5717
5729
  return dec;
5718
5730
  }
5719
- if (!component.has("templateUrl") && !component.has("styleUrls")) {
5731
+ if (!component.has("templateUrl") && !component.has("styleUrls") && !component.has("styles")) {
5720
5732
  return dec;
5721
5733
  }
5722
5734
  const metadata = new Map(component);
@@ -5724,9 +5736,20 @@ function transformDecoratorToInlineResources(dec, component, styles, template) {
5724
5736
  metadata.delete("templateUrl");
5725
5737
  metadata.set("template", ts25.factory.createStringLiteral(template.content));
5726
5738
  }
5727
- if (metadata.has("styleUrls")) {
5739
+ if (metadata.has("styleUrls") || metadata.has("styles")) {
5740
+ metadata.delete("styles");
5728
5741
  metadata.delete("styleUrls");
5729
- metadata.set("styles", ts25.factory.createArrayLiteralExpression(styles.map((s) => ts25.factory.createStringLiteral(s))));
5742
+ if (styles.length > 0) {
5743
+ const styleNodes = styles.reduce((result, style) => {
5744
+ if (style.trim().length > 0) {
5745
+ result.push(ts25.factory.createStringLiteral(style));
5746
+ }
5747
+ return result;
5748
+ }, []);
5749
+ if (styleNodes.length > 0) {
5750
+ metadata.set("styles", ts25.factory.createArrayLiteralExpression(styleNodes));
5751
+ }
5752
+ }
5730
5753
  }
5731
5754
  const newMetadataFields = [];
5732
5755
  for (const [name, value] of metadata.entries()) {
@@ -6046,10 +6069,11 @@ var ComponentDecoratorHandler = class {
6046
6069
  if (diagnostics === void 0) {
6047
6070
  diagnostics = [];
6048
6071
  }
6049
- diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`));
6072
+ diagnostics.push(makeDiagnostic(ErrorCode.COMPONENT_NOT_STANDALONE, component.get("imports"), `'imports' is only valid on a component that is standalone.`, [makeRelatedInformation(node.name, `Did you forget to add 'standalone: true' to this @Component?`)]));
6073
+ isPoisoned = true;
6050
6074
  } else if (component.has("imports")) {
6051
6075
  const expr = component.get("imports");
6052
- const imported = this.evaluator.evaluate(expr);
6076
+ const imported = this.evaluator.evaluate(expr, forwardRefResolver);
6053
6077
  const { imports: flattened, diagnostics: importDiagnostics } = validateAndFlattenComponentImports(imported, expr);
6054
6078
  resolvedImports = flattened;
6055
6079
  rawImports = expr;
@@ -6060,14 +6084,6 @@ var ComponentDecoratorHandler = class {
6060
6084
  }
6061
6085
  diagnostics.push(...importDiagnostics);
6062
6086
  }
6063
- const validationDiagnostics = validateStandaloneImports(resolvedImports, rawImports, this.metaReader, this.scopeReader);
6064
- if (validationDiagnostics.length > 0) {
6065
- isPoisoned = true;
6066
- if (diagnostics === void 0) {
6067
- diagnostics = [];
6068
- }
6069
- diagnostics.push(...validationDiagnostics);
6070
- }
6071
6087
  }
6072
6088
  let schemas = null;
6073
6089
  if (component.has("schemas") && !metadata.isStandalone) {
@@ -6169,7 +6185,7 @@ var ComponentDecoratorHandler = class {
6169
6185
  relativeContextFilePath
6170
6186
  }),
6171
6187
  typeCheckMeta: extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
6172
- classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorToInlineResources(dec, component, styles, template)),
6188
+ classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template)),
6173
6189
  template,
6174
6190
  providersRequiringFactory,
6175
6191
  viewProvidersRequiringFactory,
@@ -6409,6 +6425,10 @@ var ComponentDecoratorHandler = class {
6409
6425
  }
6410
6426
  }
6411
6427
  }
6428
+ if (analysis.resolvedImports !== null && analysis.rawImports !== null) {
6429
+ const standaloneDiagnostics = validateStandaloneImports(analysis.resolvedImports, analysis.rawImports, this.metaReader, this.scopeReader);
6430
+ diagnostics.push(...standaloneDiagnostics);
6431
+ }
6412
6432
  if (analysis.providersRequiringFactory !== null && analysis.meta.providers instanceof WrappedNodeExpr7) {
6413
6433
  const providerDiagnostics = getProviderDiagnostics(analysis.providersRequiringFactory, analysis.meta.providers.node, this.injectableRegistry);
6414
6434
  diagnostics.push(...providerDiagnostics);
@@ -6455,7 +6475,7 @@ var ComponentDecoratorHandler = class {
6455
6475
  for (const styleText of analysis.template.styles) {
6456
6476
  styles.push(styleText);
6457
6477
  }
6458
- analysis.meta.styles = styles;
6478
+ analysis.meta.styles = styles.filter((s) => s.trim().length > 0);
6459
6479
  }
6460
6480
  compileFull(node, analysis, resolution, pool) {
6461
6481
  if (analysis.template.errors !== null && analysis.template.errors.length > 0) {
@@ -6916,4 +6936,4 @@ export {
6916
6936
  * found in the LICENSE file at https://angular.io/license
6917
6937
  */
6918
6938
  // Closure Compiler ignores @suppress and similar if the comment contains @license.
6919
- //# sourceMappingURL=chunk-2ZVQLOCC.js.map
6939
+ //# sourceMappingURL=chunk-HZUCTYDG.js.map