@angular/ssr 20.0.4 → 20.1.0-next.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.
package/index.d.ts CHANGED
@@ -537,16 +537,22 @@ interface AngularAppManifest {
537
537
  * Maps entry-point names to their corresponding browser bundles and loading strategies.
538
538
  *
539
539
  * - **Key**: The entry-point name, typically the value of `ɵentryName`.
540
- * - **Value**: A readonly array of JavaScript bundle paths or `undefined` if no bundles are associated.
540
+ * - **Value**: An array of objects, each representing a browser bundle with:
541
+ * - `path`: The filename or URL of the associated JavaScript bundle to preload.
542
+ * - `dynamicImport`: A boolean indicating whether the bundle is loaded via a dynamic `import()`.
543
+ * If `true`, the bundle is lazily loaded, impacting its preloading behavior.
541
544
  *
542
545
  * ### Example
543
546
  * ```ts
544
547
  * {
545
- * 'src/app/lazy/lazy.ts': ['src/app/lazy/lazy.js']
548
+ * 'src/app/lazy/lazy.ts': [{ path: 'src/app/lazy/lazy.js', dynamicImport: true }]
546
549
  * }
547
550
  * ```
548
551
  */
549
- readonly entryPointToBrowserMapping?: Readonly<Record<string, readonly string[] | undefined>>;
552
+ readonly entryPointToBrowserMapping?: Readonly<Record<string, ReadonlyArray<{
553
+ path: string;
554
+ dynamicImport: boolean;
555
+ }> | undefined>>;
550
556
  }
551
557
  /**
552
558
  * Sets the Angular app manifest.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/ssr",
3
- "version": "20.0.4",
3
+ "version": "20.1.0-next.1",
4
4
  "description": "Angular server side rendering utilities",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -17,10 +17,10 @@
17
17
  "tslib": "^2.3.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "@angular/common": "^20.0.0",
21
- "@angular/core": "^20.0.0",
22
- "@angular/platform-server": "^20.0.0",
23
- "@angular/router": "^20.0.0"
20
+ "@angular/common": "^20.0.0 || ^20.1.0-next.0",
21
+ "@angular/core": "^20.0.0 || ^20.1.0-next.0",
22
+ "@angular/platform-server": "^20.0.0 || ^20.1.0-next.0",
23
+ "@angular/router": "^20.0.0 || ^20.1.0-next.0"
24
24
  },
25
25
  "peerDependenciesMeta": {
26
26
  "@angular/platform-server": {
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@angular-devkit/schematics": "workspace:*",
32
- "@angular/common": "20.0.0",
33
- "@angular/compiler": "20.0.0",
34
- "@angular/core": "20.0.0",
35
- "@angular/platform-browser": "20.0.0",
36
- "@angular/platform-server": "20.0.0",
37
- "@angular/router": "20.0.0",
32
+ "@angular/common": "20.1.0-next.1",
33
+ "@angular/compiler": "20.1.0-next.1",
34
+ "@angular/core": "20.1.0-next.1",
35
+ "@angular/platform-browser": "20.1.0-next.1",
36
+ "@angular/platform-server": "20.1.0-next.1",
37
+ "@angular/router": "20.1.0-next.1",
38
38
  "@schematics/angular": "workspace:*"
39
39
  },
40
40
  "sideEffects": false,
@@ -1023,11 +1023,8 @@ function requireNode$1 () {
1023
1023
 
1024
1024
  function sourceOffset(inputCSS, position) {
1025
1025
  // Not all custom syntaxes support `offset` in `source.start` and `source.end`
1026
- if (
1027
- position &&
1028
- typeof position.offset !== 'undefined'
1029
- ) {
1030
- return position.offset;
1026
+ if (position && typeof position.offset !== 'undefined') {
1027
+ return position.offset
1031
1028
  }
1032
1029
 
1033
1030
  let column = 1;
@@ -1197,14 +1194,15 @@ function requireNode$1 () {
1197
1194
  return this.parent.nodes[index + 1]
1198
1195
  }
1199
1196
 
1200
- positionBy(opts) {
1197
+ positionBy(opts = {}) {
1201
1198
  let pos = this.source.start;
1202
1199
  if (opts.index) {
1203
1200
  pos = this.positionInside(opts.index);
1204
1201
  } else if (opts.word) {
1205
- let inputString = ('document' in this.source.input)
1206
- ? this.source.input.document
1207
- : this.source.input.css;
1202
+ let inputString =
1203
+ 'document' in this.source.input
1204
+ ? this.source.input.document
1205
+ : this.source.input.css;
1208
1206
  let stringRepresentation = inputString.slice(
1209
1207
  sourceOffset(inputString, this.source.start),
1210
1208
  sourceOffset(inputString, this.source.end)
@@ -1218,9 +1216,10 @@ function requireNode$1 () {
1218
1216
  positionInside(index) {
1219
1217
  let column = this.source.start.column;
1220
1218
  let line = this.source.start.line;
1221
- let inputString = ('document' in this.source.input)
1222
- ? this.source.input.document
1223
- : this.source.input.css;
1219
+ let inputString =
1220
+ 'document' in this.source.input
1221
+ ? this.source.input.document
1222
+ : this.source.input.css;
1224
1223
  let offset = sourceOffset(inputString, this.source.start);
1225
1224
  let end = offset + index;
1226
1225
 
@@ -1233,7 +1232,7 @@ function requireNode$1 () {
1233
1232
  }
1234
1233
  }
1235
1234
 
1236
- return { column, line }
1235
+ return { column, line, offset: end }
1237
1236
  }
1238
1237
 
1239
1238
  prev() {
@@ -1242,25 +1241,36 @@ function requireNode$1 () {
1242
1241
  return this.parent.nodes[index - 1]
1243
1242
  }
1244
1243
 
1245
- rangeBy(opts) {
1244
+ rangeBy(opts = {}) {
1245
+ let inputString =
1246
+ 'document' in this.source.input
1247
+ ? this.source.input.document
1248
+ : this.source.input.css;
1246
1249
  let start = {
1247
1250
  column: this.source.start.column,
1248
- line: this.source.start.line
1251
+ line: this.source.start.line,
1252
+ offset: sourceOffset(inputString, this.source.start)
1249
1253
  };
1250
1254
  let end = this.source.end
1251
1255
  ? {
1252
1256
  column: this.source.end.column + 1,
1253
- line: this.source.end.line
1257
+ line: this.source.end.line,
1258
+ offset:
1259
+ typeof this.source.end.offset === 'number'
1260
+ ? // `source.end.offset` is exclusive, so we don't need to add 1
1261
+ this.source.end.offset
1262
+ : // Since line/column in this.source.end is inclusive,
1263
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
1264
+ // So, we add 1 to convert it to exclusive.
1265
+ sourceOffset(inputString, this.source.end) + 1
1254
1266
  }
1255
1267
  : {
1256
1268
  column: start.column + 1,
1257
- line: start.line
1269
+ line: start.line,
1270
+ offset: start.offset + 1
1258
1271
  };
1259
1272
 
1260
1273
  if (opts.word) {
1261
- let inputString = ('document' in this.source.input)
1262
- ? this.source.input.document
1263
- : this.source.input.css;
1264
1274
  let stringRepresentation = inputString.slice(
1265
1275
  sourceOffset(inputString, this.source.start),
1266
1276
  sourceOffset(inputString, this.source.end)
@@ -1268,15 +1278,14 @@ function requireNode$1 () {
1268
1278
  let index = stringRepresentation.indexOf(opts.word);
1269
1279
  if (index !== -1) {
1270
1280
  start = this.positionInside(index);
1271
- end = this.positionInside(
1272
- index + opts.word.length,
1273
- );
1281
+ end = this.positionInside(index + opts.word.length);
1274
1282
  }
1275
1283
  } else {
1276
1284
  if (opts.start) {
1277
1285
  start = {
1278
1286
  column: opts.start.column,
1279
- line: opts.start.line
1287
+ line: opts.start.line,
1288
+ offset: sourceOffset(inputString, opts.start)
1280
1289
  };
1281
1290
  } else if (opts.index) {
1282
1291
  start = this.positionInside(opts.index);
@@ -1285,7 +1294,8 @@ function requireNode$1 () {
1285
1294
  if (opts.end) {
1286
1295
  end = {
1287
1296
  column: opts.end.column,
1288
- line: opts.end.line
1297
+ line: opts.end.line,
1298
+ offset: sourceOffset(inputString, opts.end)
1289
1299
  };
1290
1300
  } else if (typeof opts.endIndex === 'number') {
1291
1301
  end = this.positionInside(opts.endIndex);
@@ -1298,7 +1308,11 @@ function requireNode$1 () {
1298
1308
  end.line < start.line ||
1299
1309
  (end.line === start.line && end.column <= start.column)
1300
1310
  ) {
1301
- end = { column: start.column + 1, line: start.line };
1311
+ end = {
1312
+ column: start.column + 1,
1313
+ line: start.line,
1314
+ offset: start.offset + 1
1315
+ };
1302
1316
  }
1303
1317
 
1304
1318
  return { end, start }
@@ -1373,6 +1387,7 @@ function requireNode$1 () {
1373
1387
  } else if (typeof value === 'object' && value.toJSON) {
1374
1388
  fixed[name] = value.toJSON(null, inputs);
1375
1389
  } else if (name === 'source') {
1390
+ if (value == null) continue
1376
1391
  let inputId = inputs.get(value.input);
1377
1392
  if (inputId == null) {
1378
1393
  inputId = inputsNextIndex;
@@ -1412,7 +1427,7 @@ function requireNode$1 () {
1412
1427
  return result
1413
1428
  }
1414
1429
 
1415
- warn(result, text, opts) {
1430
+ warn(result, text, opts = {}) {
1416
1431
  let data = { node: this };
1417
1432
  for (let i in opts) data[i] = opts[i];
1418
1433
  return result.warn(text, data)
@@ -2217,11 +2232,26 @@ function requireInput () {
2217
2232
  let PreviousMap = requirePreviousMap();
2218
2233
  let terminalHighlight = require$$2;
2219
2234
 
2220
- let fromOffsetCache = Symbol('fromOffsetCache');
2235
+ let lineToIndexCache = Symbol('lineToIndexCache');
2221
2236
 
2222
2237
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2223
2238
  let pathAvailable = Boolean(resolve && isAbsolute);
2224
2239
 
2240
+ function getLineToIndex(input) {
2241
+ if (input[lineToIndexCache]) return input[lineToIndexCache]
2242
+ let lines = input.css.split('\n');
2243
+ let lineToIndex = new Array(lines.length);
2244
+ let prevIndex = 0;
2245
+
2246
+ for (let i = 0, l = lines.length; i < l; i++) {
2247
+ lineToIndex[i] = prevIndex;
2248
+ prevIndex += lines[i].length + 1;
2249
+ }
2250
+
2251
+ input[lineToIndexCache] = lineToIndex;
2252
+ return lineToIndex
2253
+ }
2254
+
2225
2255
  class Input {
2226
2256
  get from() {
2227
2257
  return this.file || this.id
@@ -2276,31 +2306,38 @@ function requireInput () {
2276
2306
  }
2277
2307
 
2278
2308
  error(message, line, column, opts = {}) {
2279
- let endColumn, endLine, result;
2309
+ let endColumn, endLine, endOffset, offset, result;
2280
2310
 
2281
2311
  if (line && typeof line === 'object') {
2282
2312
  let start = line;
2283
2313
  let end = column;
2284
2314
  if (typeof start.offset === 'number') {
2285
- let pos = this.fromOffset(start.offset);
2315
+ offset = start.offset;
2316
+ let pos = this.fromOffset(offset);
2286
2317
  line = pos.line;
2287
2318
  column = pos.col;
2288
2319
  } else {
2289
2320
  line = start.line;
2290
2321
  column = start.column;
2322
+ offset = this.fromLineAndColumn(line, column);
2291
2323
  }
2292
2324
  if (typeof end.offset === 'number') {
2293
- let pos = this.fromOffset(end.offset);
2325
+ endOffset = end.offset;
2326
+ let pos = this.fromOffset(endOffset);
2294
2327
  endLine = pos.line;
2295
2328
  endColumn = pos.col;
2296
2329
  } else {
2297
2330
  endLine = end.line;
2298
2331
  endColumn = end.column;
2332
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2299
2333
  }
2300
2334
  } else if (!column) {
2301
- let pos = this.fromOffset(line);
2335
+ offset = line;
2336
+ let pos = this.fromOffset(offset);
2302
2337
  line = pos.line;
2303
2338
  column = pos.col;
2339
+ } else {
2340
+ offset = this.fromLineAndColumn(line, column);
2304
2341
  }
2305
2342
 
2306
2343
  let origin = this.origin(line, column, endLine, endColumn);
@@ -2328,7 +2365,7 @@ function requireInput () {
2328
2365
  );
2329
2366
  }
2330
2367
 
2331
- result.input = { column, endColumn, endLine, line, source: this.css };
2368
+ result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2332
2369
  if (this.file) {
2333
2370
  if (pathToFileURL) {
2334
2371
  result.input.url = pathToFileURL(this.file).toString();
@@ -2339,23 +2376,15 @@ function requireInput () {
2339
2376
  return result
2340
2377
  }
2341
2378
 
2342
- fromOffset(offset) {
2343
- let lastLine, lineToIndex;
2344
- if (!this[fromOffsetCache]) {
2345
- let lines = this.css.split('\n');
2346
- lineToIndex = new Array(lines.length);
2347
- let prevIndex = 0;
2348
-
2349
- for (let i = 0, l = lines.length; i < l; i++) {
2350
- lineToIndex[i] = prevIndex;
2351
- prevIndex += lines[i].length + 1;
2352
- }
2379
+ fromLineAndColumn(line, column) {
2380
+ let lineToIndex = getLineToIndex(this);
2381
+ let index = lineToIndex[line - 1];
2382
+ return index + column - 1
2383
+ }
2353
2384
 
2354
- this[fromOffsetCache] = lineToIndex;
2355
- } else {
2356
- lineToIndex = this[fromOffsetCache];
2357
- }
2358
- lastLine = lineToIndex[lineToIndex.length - 1];
2385
+ fromOffset(offset) {
2386
+ let lineToIndex = getLineToIndex(this);
2387
+ let lastLine = lineToIndex[lineToIndex.length - 1];
2359
2388
 
2360
2389
  let min = 0;
2361
2390
  if (offset >= lastLine) {
@@ -4075,7 +4104,7 @@ function requireResult () {
4075
4104
  this.messages = [];
4076
4105
  this.root = root;
4077
4106
  this.opts = opts;
4078
- this.css = undefined;
4107
+ this.css = '';
4079
4108
  this.map = undefined;
4080
4109
  }
4081
4110
 
@@ -4846,7 +4875,7 @@ function requireProcessor () {
4846
4875
 
4847
4876
  class Processor {
4848
4877
  constructor(plugins = []) {
4849
- this.version = '8.5.3';
4878
+ this.version = '8.5.4';
4850
4879
  this.plugins = this.normalize(plugins);
4851
4880
  }
4852
4881