@smapiot/pilet-template-angular 1.0.16 → 1.0.18-beta.8445c7e

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019 - 2025 smapiot
3
+ Copyright (c) 2019 - 2026 smapiot
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/lib/index.js CHANGED
@@ -542,9 +542,9 @@ var require_parent = __commonJS({
542
542
  }
543
543
  });
544
544
 
545
- // ../../node_modules/ejs/lib/utils.js
545
+ // ../../packages/template-utils/node_modules/ejs/lib/utils.js
546
546
  var require_utils2 = __commonJS({
547
- "../../node_modules/ejs/lib/utils.js"(exports2) {
547
+ "../../packages/template-utils/node_modules/ejs/lib/utils.js"(exports2) {
548
548
  "use strict";
549
549
  var regExpChars = /[|\\{}()[\]^$+*?.]/g;
550
550
  exports2.escapeRegExpChars = function(string) {
@@ -616,9 +616,9 @@ function encode_char(c) {
616
616
  }
617
617
  });
618
618
 
619
- // ../../node_modules/ejs/package.json
619
+ // ../../packages/template-utils/node_modules/ejs/package.json
620
620
  var require_package = __commonJS({
621
- "../../node_modules/ejs/package.json"(exports2, module2) {
621
+ "../../packages/template-utils/node_modules/ejs/package.json"(exports2, module2) {
622
622
  module2.exports = {
623
623
  name: "ejs",
624
624
  description: "Embedded JavaScript templates",
@@ -659,9 +659,9 @@ var require_package = __commonJS({
659
659
  }
660
660
  });
661
661
 
662
- // ../../node_modules/ejs/lib/ejs.js
662
+ // ../../packages/template-utils/node_modules/ejs/lib/ejs.js
663
663
  var require_ejs = __commonJS({
664
- "../../node_modules/ejs/lib/ejs.js"(exports2) {
664
+ "../../packages/template-utils/node_modules/ejs/lib/ejs.js"(exports2) {
665
665
  "use strict";
666
666
  var fs = require("fs");
667
667
  var path = require("path");
@@ -1430,7 +1430,7 @@ var require_types = __commonJS({
1430
1430
  var require_lib = __commonJS({
1431
1431
  "../../packages/template-utils/lib/index.js"(exports2) {
1432
1432
  "use strict";
1433
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
1433
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
1434
1434
  if (k2 === void 0) k2 = k;
1435
1435
  var desc = Object.getOwnPropertyDescriptor(m, k);
1436
1436
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
@@ -1439,10 +1439,10 @@ var require_lib = __commonJS({
1439
1439
  } };
1440
1440
  }
1441
1441
  Object.defineProperty(o, k2, desc);
1442
- } : function(o, m, k, k2) {
1442
+ }) : (function(o, m, k, k2) {
1443
1443
  if (k2 === void 0) k2 = k;
1444
1444
  o[k2] = m[k];
1445
- });
1445
+ }));
1446
1446
  var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
1447
1447
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
1448
1448
  };
@@ -1484,7 +1484,9 @@ var tsVersions = {
1484
1484
  17: "~5.2",
1485
1485
  18: "~5.5",
1486
1486
  19: "~5.7",
1487
- 20: "~5.8"
1487
+ 20: "~5.8",
1488
+ 21: "~5.9",
1489
+ 22: "~6.0"
1488
1490
  };
1489
1491
  var rxjsVersions = {
1490
1492
  2: "^5.0",
@@ -1504,7 +1506,9 @@ var rxjsVersions = {
1504
1506
  17: "^7.4",
1505
1507
  18: "^7.4",
1506
1508
  19: "^7.4",
1507
- 20: "^7.4"
1509
+ 20: "^7.4",
1510
+ 21: "^7.4",
1511
+ 22: "^7.4"
1508
1512
  };
1509
1513
  var zoneVersions = {
1510
1514
  2: "~0.9",
@@ -1524,7 +1528,9 @@ var zoneVersions = {
1524
1528
  17: "~0.14",
1525
1529
  18: "~0.14",
1526
1530
  19: "~0.15",
1527
- 20: "~0.15"
1531
+ 20: "~0.15",
1532
+ 21: false,
1533
+ 22: false
1528
1534
  };
1529
1535
 
1530
1536
  // src/helpers.ts
@@ -1538,7 +1544,7 @@ function detectNgVersion(piralInstance) {
1538
1544
  const dependencies = piralInstance?.details?.dependencies || {};
1539
1545
  const devDependencies = piralInstance?.details?.devDependencies || {};
1540
1546
  const allDependencies = { ...devDependencies, ...dependencies };
1541
- const version = allDependencies["@angular/core"] || "18.0.0";
1547
+ const version = allDependencies["@angular/core"] || "20.0.0";
1542
1548
  if (typeof version === "string") {
1543
1549
  const result = /\d+/.exec(version);
1544
1550
  if (result) {
@@ -1551,6 +1557,8 @@ function isKnownVersion(majorNgVersion) {
1551
1557
  return typeof zoneVersions[majorNgVersion] !== "undefined";
1552
1558
  }
1553
1559
  function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1560
+ const zoneVersion = zoneVersions[majorNgVersion];
1561
+ const extraDeps = typeof zoneVersion === "string" ? { "zone.js": zoneVersion } : {};
1554
1562
  return {
1555
1563
  importmap: {
1556
1564
  imports: {
@@ -1574,7 +1582,7 @@ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1574
1582
  "piral-ng-common": ngVersion,
1575
1583
  "core-js": "^3",
1576
1584
  rxjs: rxjsVersions[majorNgVersion] || "^7.4",
1577
- "zone.js": zoneVersions[majorNgVersion] || "^0.14"
1585
+ ...extraDeps
1578
1586
  },
1579
1587
  devDependencies: {
1580
1588
  "@angular/compiler-cli": ngVersion,
@@ -1589,6 +1597,7 @@ function getStandalonePackageJson(cliVersion, ngVersion, majorNgVersion) {
1589
1597
  }
1590
1598
  function getStandardPackageJson(cliVersion, ngVersion, majorNgVersion) {
1591
1599
  return {
1600
+ dependencies: {},
1592
1601
  devDependencies: {
1593
1602
  "@angular/compiler-cli": ngVersion,
1594
1603
  "@angular/cli": ngVersion,
@@ -1631,6 +1640,7 @@ var index_default = (0, import_template_utils.createPiletTemplateFactory)(root,
1631
1640
  }
1632
1641
  const ngVersion = `^${args.ngVersion}`;
1633
1642
  const packageJson = args.standalone ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion) : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
1643
+ args.withZone = "zone.js" in packageJson.dependencies;
1634
1644
  const templates = [
1635
1645
  {
1636
1646
  languages: ["ts", "js"],
@@ -1685,13 +1695,11 @@ var index_default = (0, import_template_utils.createPiletTemplateFactory)(root,
1685
1695
  }
1686
1696
  ];
1687
1697
  if (args.ngStandalone) {
1688
- templates.push(
1689
- {
1690
- languages: ["ts"],
1691
- name: "index.standalone.tsx",
1692
- target: "<src>/index.tsx"
1693
- }
1694
- );
1698
+ templates.push({
1699
+ languages: ["ts"],
1700
+ name: "index.standalone.tsx",
1701
+ target: "<src>/index.tsx"
1702
+ });
1695
1703
  } else {
1696
1704
  templates.push(
1697
1705
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/pilet-template-angular",
3
- "version": "1.0.16",
3
+ "version": "1.0.18-beta.8445c7e",
4
4
  "description": "Official scaffolding template for pilets: 'angular'.",
5
5
  "keywords": [
6
6
  "piral-cli",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "ngVersion": {
31
31
  "description": "Defines the (major) version of Angular to use in case of a standalone pilet.",
32
- "default": 18,
32
+ "default": 20,
33
33
  "type": "number"
34
34
  }
35
35
  },
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "repository": {
50
50
  "type": "git",
51
- "url": "git+https://github.com/smapiot/piral-templates.git"
51
+ "url": "https://github.com/smapiot/piral-templates.git"
52
52
  },
53
53
  "bugs": {
54
54
  "url": "https://github.com/smapiot/piral-templates/issues"
@@ -59,7 +59,7 @@
59
59
  "test": "echo \"Error: run tests from root\" && exit 1"
60
60
  },
61
61
  "devDependencies": {
62
- "@smapiot/template-utils": "^1.0.16"
62
+ "@smapiot/template-utils": "1.0.18-beta.8445c7e"
63
63
  },
64
- "gitHead": "6241747ac7619263aeeb7eaadd89f37bfc7379d6"
64
+ "gitHead": "8445c7e2d3e950ebf24f5cd90c9b521dff4174fd"
65
65
  }
package/src/helpers.ts CHANGED
@@ -11,7 +11,7 @@ export function detectNgVersion(piralInstance: { details: any }) {
11
11
  const dependencies = piralInstance?.details?.dependencies || {};
12
12
  const devDependencies = piralInstance?.details?.devDependencies || {};
13
13
  const allDependencies = { ...devDependencies, ...dependencies };
14
- const version = allDependencies['@angular/core'] || '18.0.0';
14
+ const version = allDependencies['@angular/core'] || '20.0.0';
15
15
 
16
16
  if (typeof version === 'string') {
17
17
  const result = /\d+/.exec(version);
@@ -30,6 +30,9 @@ export function isKnownVersion(majorNgVersion: number) {
30
30
  }
31
31
 
32
32
  export function getStandalonePackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
33
+ const zoneVersion = zoneVersions[majorNgVersion];
34
+ const extraDeps = typeof zoneVersion === 'string' ? { 'zone.js': zoneVersion } : {};
35
+
33
36
  return {
34
37
  importmap: {
35
38
  imports: {
@@ -53,7 +56,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string,
53
56
  'piral-ng-common': ngVersion,
54
57
  'core-js': '^3',
55
58
  rxjs: rxjsVersions[majorNgVersion] || '^7.4',
56
- 'zone.js': zoneVersions[majorNgVersion] || '^0.14',
59
+ ...extraDeps,
57
60
  },
58
61
  devDependencies: {
59
62
  '@angular/compiler-cli': ngVersion,
@@ -69,6 +72,7 @@ export function getStandalonePackageJson(cliVersion: string, ngVersion: string,
69
72
 
70
73
  export function getStandardPackageJson(cliVersion: string, ngVersion: string, majorNgVersion: number) {
71
74
  return {
75
+ dependencies: {},
72
76
  devDependencies: {
73
77
  '@angular/compiler-cli': ngVersion,
74
78
  '@angular/cli': ngVersion,
package/src/index.ts CHANGED
@@ -14,6 +14,7 @@ interface AngularPiletArgs {
14
14
  standalone: boolean;
15
15
  ngVersion: number;
16
16
  ngStandalone: boolean;
17
+ withZone?: boolean;
17
18
  }
18
19
 
19
20
  export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot, args, details) => {
@@ -52,6 +53,8 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
52
53
  ? getStandalonePackageJson(details.cliVersion, ngVersion, args.ngVersion)
53
54
  : getStandardPackageJson(details.cliVersion, ngVersion, args.ngVersion);
54
55
 
56
+ args.withZone = 'zone.js' in packageJson.dependencies;
57
+
55
58
  const templates: Array<PiletTemplateSource> = [
56
59
  {
57
60
  languages: ['ts', 'js'],
@@ -107,13 +110,11 @@ export default createPiletTemplateFactory<AngularPiletArgs>(root, (projectRoot,
107
110
  ];
108
111
 
109
112
  if (args.ngStandalone) {
110
- templates.push(
111
- {
112
- languages: ['ts'],
113
- name: 'index.standalone.tsx',
114
- target: '<src>/index.tsx',
115
- },
116
- );
113
+ templates.push({
114
+ languages: ['ts'],
115
+ name: 'index.standalone.tsx',
116
+ target: '<src>/index.tsx',
117
+ });
117
118
  } else {
118
119
  templates.push(
119
120
  {
package/src/versions.ts CHANGED
@@ -20,6 +20,8 @@ export const tsVersions = {
20
20
  18: '~5.5',
21
21
  19: '~5.7',
22
22
  20: '~5.8',
23
+ 21: '~5.9',
24
+ 22: '~6.0',
23
25
  };
24
26
 
25
27
  // Mapping of Angular to RxJs versions
@@ -42,6 +44,8 @@ export const rxjsVersions = {
42
44
  18: '^7.4',
43
45
  19: '^7.4',
44
46
  20: '^7.4',
47
+ 21: '^7.4',
48
+ 22: '^7.4',
45
49
  };
46
50
 
47
51
  // Mapping of Angular to Zone.js versions
@@ -64,4 +68,6 @@ export const zoneVersions = {
64
68
  18: '~0.14',
65
69
  19: '~0.15',
66
70
  20: '~0.15',
71
+ 21: false,
72
+ 22: false,
67
73
  };
@@ -1,5 +1,7 @@
1
1
  import 'core-js/proposals/reflect-metadata';
2
+ <% if (withZone) { -%>
2
3
  import 'zone.js';
4
+ <% } -%>
3
5
  import { createConverter } from 'piral-ng/standalone';
4
6
  import { provideRouter } from '@angular/router';
5
7
  import type { ApplicationConfig } from '@angular/core';
@@ -15,6 +15,7 @@
15
15
  "moduleResolution": "Bundler",
16
16
  "module": "esnext",
17
17
  "jsx": "react",
18
+ "rootDir": ".",
18
19
  "importHelpers": true
19
20
  },
20
21
  "include": [