Updated the project.

This commit is contained in:
Batuhan Berk Başoğlu 2024-06-03 15:44:25 -04:00
parent 5dfe9f128d
commit 7919556077
1550 changed files with 17063 additions and 40183 deletions

2
.vscode/launch.json vendored
View file

@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net8.0/TodoApi.dll",
"program": "${workspaceFolder}/bin/Debug/net8.0/Api.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,

6
.vscode/tasks.json vendored
View file

@ -7,7 +7,7 @@
"type": "process",
"args": [
"build",
"${workspaceFolder}/TodoApi.csproj",
"${workspaceFolder}/Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
@ -19,7 +19,7 @@
"type": "process",
"args": [
"publish",
"${workspaceFolder}/TodoApi.csproj",
"${workspaceFolder}/Api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary;ForceNoAlign"
],
@ -33,7 +33,7 @@
"watch",
"run",
"--project",
"${workspaceFolder}/TodoApi.csproj"
"${workspaceFolder}/Api.csproj"
],
"problemMatcher": "$msCompile"
}

6
Api.http Executable file
View file

@ -0,0 +1,6 @@
@Api_HostAddress = http://localhost:5070
GET {{Api_HostAddress}}/weatherforecast/
Accept: application/json
###

View file

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TodoApi", "TodoApi.csproj", "{E0F02F24-09D8-4595-B3E6-76EE507D2BEF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Api", "Api.csproj", "{E0F02F24-09D8-4595-B3E6-76EE507D2BEF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

107
Controllers/ItemsController.cs Executable file
View file

@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Api.Models;
namespace Api.Controllers
{
[Route("api/[controller]/posts")]
[ApiController]
public class ItemsController : ControllerBase
{
private readonly Context _context;
public ItemsController(Context context)
{
_context = context;
}
// GET: api/Items
[HttpGet]
public async Task<ActionResult<IEnumerable<Item>>> GetItems()
{
return await _context.Items.ToListAsync();
}
// GET: api/Items/5
[HttpGet("{id}")]
public async Task<ActionResult<Item>> GetItem(long id)
{
var item = await _context.Items.FindAsync(id);
if (item == null)
{
return NotFound();
}
return item;
}
// PUT: api/Items/5
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPut("{id}")]
public async Task<IActionResult> PutItem(long id, Item item)
{
if (id != item.Id)
{
return BadRequest();
}
_context.Entry(item).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!ItemExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/Items
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPost]
public async Task<ActionResult<Item>> PostItem(Item item)
{
_context.Items.Add(item);
await _context.SaveChangesAsync();
return CreatedAtAction("GetItem", new { id = item.Id }, item);
}
// DELETE: api/Items/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteItem(long id)
{
var item = await _context.Items.FindAsync(id);
if (item == null)
{
return NotFound();
}
_context.Items.Remove(item);
await _context.SaveChangesAsync();
return NoContent();
}
private bool ItemExists(long id)
{
return _context.Items.Any(e => e.Id == id);
}
}
}

View file

@ -1,107 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TodoApi.Models;
namespace TodoApi.Controllers
{
[Route("api/[controller]/posts")]
[ApiController]
public class TodoItemsController : ControllerBase
{
private readonly TodoContext _context;
public TodoItemsController(TodoContext context)
{
_context = context;
}
// GET: api/TodoItems
[HttpGet]
public async Task<ActionResult<IEnumerable<TodoItem>>> GetTodoItems()
{
return await _context.TodoItems.ToListAsync();
}
// GET: api/TodoItems/5
[HttpGet("{id}")]
public async Task<ActionResult<TodoItem>> GetTodoItem(long id)
{
var todoItem = await _context.TodoItems.FindAsync(id);
if (todoItem == null)
{
return NotFound();
}
return todoItem;
}
// PUT: api/TodoItems/5
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPut("{id}")]
public async Task<IActionResult> PutTodoItem(long id, TodoItem todoItem)
{
if (id != todoItem.Id)
{
return BadRequest();
}
_context.Entry(todoItem).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!TodoItemExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/TodoItems
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPost]
public async Task<ActionResult<TodoItem>> PostTodoItem(TodoItem todoItem)
{
_context.TodoItems.Add(todoItem);
await _context.SaveChangesAsync();
return CreatedAtAction("GetTodoItem", new { id = todoItem.Id }, todoItem);
}
// DELETE: api/TodoItems/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteTodoItem(long id)
{
var todoItem = await _context.TodoItems.FindAsync(id);
if (todoItem == null)
{
return NotFound();
}
_context.TodoItems.Remove(todoItem);
await _context.SaveChangesAsync();
return NoContent();
}
private bool TodoItemExists(long id)
{
return _context.TodoItems.Any(e => e.Id == id);
}
}
}

13
Models/Context.cs Executable file
View file

@ -0,0 +1,13 @@
using Microsoft.EntityFrameworkCore;
namespace Api.Models;
public class Context : DbContext
{
public Context(DbContextOptions<Context> options)
: base(options)
{
}
public DbSet<Item> Items { get; set; } = null!;
}

View file

@ -1,6 +1,6 @@
namespace TodoApi.Models;
namespace Api.Models;
public class TodoItem
public class Item
{
public string? Author { get; set; }
public string? AuthorId { get; set; }

View file

@ -1,13 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace TodoApi.Models;
public class TodoContext : DbContext
{
public TodoContext(DbContextOptions<TodoContext> options)
: base(options)
{
}
public DbSet<TodoItem> TodoItems { get; set; } = null!;
}

View file

@ -1,11 +1,11 @@
using Microsoft.EntityFrameworkCore;
using TodoApi.Models;
using Api.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddDbContext<TodoContext>(opt =>
opt.UseInMemoryDatabase("TodoList"));
builder.Services.AddDbContext<Context>(opt =>
opt.UseInMemoryDatabase("List"));
var app = builder.Build();

View file

@ -1,6 +0,0 @@
@TodoApi_HostAddress = http://localhost:5070
GET {{TodoApi_HostAddress}}/weatherforecast/
Accept: application/json
###

BIN
bin/Debug/net8.0/Api Executable file

Binary file not shown.

File diff suppressed because it is too large Load diff

BIN
bin/Debug/net8.0/Api.dll Normal file

Binary file not shown.

BIN
bin/Debug/net8.0/Api.pdb Normal file

Binary file not shown.

View file

@ -0,0 +1,22 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Globalization.Invariant": true,
"System.Globalization.PredefinedCulturesOnly": true,
"System.Reflection.NullabilityInfoContext.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View file

@ -0,0 +1 @@
{"ContentRoots":["/home/arctichawk1/Desktop/Projects/Public/NET-Web-API-w-Angular/wwwroot/"],"Root":{"Children":{"favicon.ico":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"favicon.ico"},"Patterns":null},"index.html":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"index.html"},"Patterns":null},"main-YSBCHBTB.js":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"main-YSBCHBTB.js"},"Patterns":null},"polyfills-RX4V3J3S.js":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"polyfills-RX4V3J3S.js"},"Patterns":null},"styles-5INURTSO.css":{"Children":null,"Asset":{"ContentRootIndex":0,"SubPath":"styles-5INURTSO.css"},"Patterns":null}},"Asset":null,"Patterns":[{"ContentRootIndex":0,"Pattern":"**","Depth":0}]}}

View file

@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"TodoApi/1.0.0": {
"Api/1.0.0": {
"dependencies": {
"Microsoft.EntityFrameworkCore.Design": "8.0.1",
"Microsoft.EntityFrameworkCore.InMemory": "8.0.1",
@ -16,7 +16,7 @@
"Swashbuckle.AspNetCore": "6.4.0"
},
"runtime": {
"TodoApi.dll": {}
"Api.dll": {}
}
},
"Azure.Core/1.25.0": {
@ -1922,7 +1922,7 @@
}
},
"libraries": {
"TodoApi/1.0.0": {
"Api/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""

Binary file not shown.

Binary file not shown.

0
bin/Debug/net8.0/my-app/dist/my-app/prerendered-routes.json vendored Executable file → Normal file
View file

File diff suppressed because it is too large Load diff

View file

@ -28,7 +28,7 @@
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.1.3",
"@angular/cli": "^17.1.3",
"@angular/cli": "^17.3.8",
"@angular/compiler-cli": "^17.1.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~5.1.0",
@ -41,4 +41,4 @@
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.3.2"
}
}
}

View file

@ -1,5 +1,5 @@
{
"name": "TodoApi",
"name": "Api",
"lockfileVersion": 3,
"requires": true,
"packages": {}

View file

@ -1,6 +1,6 @@
# MyApp
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.1.3.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 17.3.8.
## Development server

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,12 +0,0 @@
<!DOCTYPE html><html lang="en" data-critters-container><head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles-5INURTSO.css"></head>
<body><!--nghm-->
<app-root _nghost-ng-c3526056911 ng-version="17.1.3" ngh="0" ng-server-context="ssg"><main _ngcontent-ng-c3526056911 class="main"><h1 _ngcontent-ng-c3526056911>Calling the API using Angular</h1><h3 _ngcontent-ng-c3526056911>Get the Posts</h3><p _ngcontent-ng-c3526056911>Click to this button to receive all the API data.</p><a _ngcontent-ng-c3526056911 href="javascript:void(0)" role="button" class="btn btn-lg btn-primary"> Get the Posts </a></main><router-outlet _ngcontent-ng-c3526056911></router-outlet><!----></app-root>
<script src="polyfills-RX4V3J3S.js" type="module"></script><script src="main-DASB26HH.js" type="module"></script>
<script id="ng-state" type="application/json">{"__nghData__":[{"c":{"9":[]}}]}</script></body></html>

File diff suppressed because one or more lines are too long

View file

@ -1,5 +0,0 @@
{
"routes": [
"/"
]
}

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
import './polyfills.server.mjs';
var v=Object.create;var n=Object.defineProperty,w=Object.defineProperties,x=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,m=Object.getOwnPropertySymbols,A=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;var l=(b,a)=>(a=Symbol[b])?a:Symbol.for("Symbol."+b);var r=(b,a,c)=>a in b?n(b,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):b[a]=c,C=(b,a)=>{for(var c in a||={})o.call(a,c)&&r(b,c,a[c]);if(m)for(var c of m(a))s.call(a,c)&&r(b,c,a[c]);return b},D=(b,a)=>w(b,y(a));var E=(b=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(b,{get:(a,c)=>(typeof require<"u"?require:a)[c]}):b)(function(b){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+b+'" is not supported')});var F=(b,a)=>{var c={};for(var d in b)o.call(b,d)&&a.indexOf(d)<0&&(c[d]=b[d]);if(b!=null&&m)for(var d of m(b))a.indexOf(d)<0&&s.call(b,d)&&(c[d]=b[d]);return c};var G=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports),H=(b,a)=>{for(var c in a)n(b,c,{get:a[c],enumerable:!0})},B=(b,a,c,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let e of z(a))!o.call(b,e)&&e!==c&&n(b,e,{get:()=>a[e],enumerable:!(d=x(a,e))||d.enumerable});return b};var I=(b,a,c)=>(c=b!=null?v(A(b)):{},B(a||!b||!b.__esModule?n(c,"default",{value:b,enumerable:!0}):c,b));var J=(b,a,c)=>new Promise((d,e)=>{var g=f=>{try{i(c.next(f))}catch(j){e(j)}},h=f=>{try{i(c.throw(f))}catch(j){e(j)}},i=f=>f.done?d(f.value):Promise.resolve(f.value).then(g,h);i((c=c.apply(b,a)).next())}),t=function(b,a){this[0]=b,this[1]=a},K=(b,a,c)=>{var d=(h,i,f,j)=>{try{var p=c[h](i),q=(i=p.value)instanceof t,u=p.done;Promise.resolve(q?i[0]:i).then(k=>q?d(h==="return"?h:"next",i[1]?{done:k.done,value:k.value}:k,f,j):f({value:k,done:u})).catch(k=>d("throw",k,f,j))}catch(k){j(k)}},e=h=>g[h]=i=>new Promise((f,j)=>d(h,i,f,j)),g={};return c=c.apply(b,a),g[l("asyncIterator")]=()=>g,e("next"),e("throw"),e("return"),g},L=b=>{var a=b[l("asyncIterator")],c=!1,d,e={};return a==null?(a=b[l("iterator")](),d=g=>e[g]=h=>a[g](h)):(a=a.call(b),d=g=>e[g]=h=>{if(c){if(c=!1,g==="throw")throw h;return h}return c=!0,{done:!1,value:new t(new Promise(i=>{var f=a[g](h);if(!(f instanceof Object))throw TypeError("Object expected");i(f)}),1)}}),e[l("iterator")]=()=>e,d("next"),"throw"in a?d("throw"):e.throw=g=>{throw g},"return"in a&&d("return"),e};export{C as a,D as b,E as c,F as d,G as e,H as f,I as g,J as h,t as i,K as j,L as k};

View file

@ -1,13 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyApp</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="styles-5INURTSO.css"></head>
<body>
<app-root></app-root>
<script src="polyfills-RX4V3J3S.js" type="module"></script><script src="main-DASB26HH.js" type="module"></script></body>
</html>

View file

@ -1,2 +0,0 @@
import './polyfills.server.mjs';
import{a}from"./chunk-PZASK5JP.mjs";import"./chunk-4R55AP5V.mjs";import"./chunk-VVCT4QZE.mjs";export{a as default};

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
import './polyfills.server.mjs';
import{B as P,C as S,i as f,j as g,k as h,l as p,m as y,n as C,u as E,v as w,x as N,y as A,z as I}from"./chunk-4R55AP5V.mjs";import{i as l,j as d,k as u}from"./chunk-VVCT4QZE.mjs";function a(e,n,i,t=""){return d(this,null,function*(){for(let r of e){let{path:o,redirectTo:c,loadChildren:T,children:R}=r;if(o===void 0)continue;let s=x(t,o);if(c!==void 0){yield{route:s,success:!1,redirect:!0};continue}if(/[:*]/.test(o)){yield{route:s,success:!1,redirect:!1};continue}if(yield{route:s,success:!0,redirect:!1},R?.length&&(yield*u(a(R,n,i,s))),T){let m=yield new l(P(r,n,i).toPromise());if(m){let{routes:_,injector:L=i}=m;yield*u(a(_,n,L,s))}}}})}function v(e,n){return d(this,null,function*(){let i=y(C,"server",[{provide:E,useValue:{document:n,url:""}},{provide:f,useFactory:()=>{class t extends f{ignoredLogs=new Set(["Angular is running in development mode."]);log(o){this.ignoredLogs.has(o)||super.log(o)}}return new t}},...w])();try{let t;V(e)?t=yield new l(e()):t=(yield new l(i.bootstrapModule(e))).injector.get(h),yield new l(p(t));let r=t.injector,o=r.get(S);if(o.config.length===0)yield{route:"",success:!0,redirect:!1};else{let c=r.get(g);yield*u(a(o.config,c,r))}}finally{i.destroy()}})}function V(e){return typeof e=="function"&&!("\u0275mod"in e)}function x(...e){return e.filter(Boolean).join("/")}export{v as extractRoutes,I as renderApplication,A as renderModule,f as \u0275Console,N as \u0275SERVER_CONTEXT};

File diff suppressed because one or more lines are too long

Binary file not shown.

1
my-app/node_modules/.bin/installed-package-contents generated vendored Symbolic link
View file

@ -0,0 +1 @@
../@npmcli/installed-package-contents/bin/index.js

BIN
my-app/node_modules/.bin/ng generated vendored

Binary file not shown.

1
my-app/node_modules/.bin/ng generated vendored Symbolic link
View file

@ -0,0 +1 @@
../@angular/cli/bin/ng.js

BIN
my-app/node_modules/.bin/node-gyp generated vendored

Binary file not shown.

1
my-app/node_modules/.bin/node-gyp generated vendored Symbolic link
View file

@ -0,0 +1 @@
../node-gyp/bin/node-gyp.js

BIN
my-app/node_modules/.bin/nopt generated vendored

Binary file not shown.

1
my-app/node_modules/.bin/nopt generated vendored Symbolic link
View file

@ -0,0 +1 @@
../nopt/bin/nopt.js

BIN
my-app/node_modules/.bin/pacote generated vendored

Binary file not shown.

1
my-app/node_modules/.bin/pacote generated vendored Symbolic link
View file

@ -0,0 +1 @@
../pacote/lib/bin.js

1093
my-app/node_modules/.package-lock.json generated vendored

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "@angular-devkit/schematics",
"version": "17.1.3",
"version": "17.3.8",
"description": "Angular Schematics - Library",
"main": "src/index.js",
"typings": "src/index.d.ts",
@ -18,9 +18,9 @@
"tooling"
],
"dependencies": {
"@angular-devkit/core": "17.1.3",
"jsonc-parser": "3.2.0",
"magic-string": "0.30.5",
"@angular-devkit/core": "17.3.8",
"jsonc-parser": "3.2.1",
"magic-string": "0.30.8",
"ora": "5.4.1",
"rxjs": "7.8.1"
},

View file

@ -42,7 +42,10 @@ function applyContentTemplate(options) {
};
}
catch (e) {
if (e.code === 'ERR_ENCODING_INVALID_ENCODED_DATA') {
// The second part should not be needed. But Jest does not support instanceof correctly.
// See: https://github.com/jestjs/jest/issues/2549
if (e instanceof TypeError ||
e.code === 'ERR_ENCODING_INVALID_ENCODED_DATA') {
return entry;
}
throw e;

View file

@ -227,7 +227,10 @@ class HostTree {
return decoder.decode(data);
}
catch (e) {
if (e instanceof TypeError) {
// The second part should not be needed. But Jest does not support instanceof correctly.
// See: https://github.com/jestjs/jest/issues/2549
if (e instanceof TypeError ||
e.code === 'ERR_ENCODING_INVALID_ENCODED_DATA') {
throw new Error(`Failed to decode "${path}" as UTF-8 text.`);
}
throw e;

View file

@ -75,6 +75,10 @@ export interface Tree {
apply(action: Action, strategy?: MergeStrategy): void;
readonly actions: Action[];
}
export interface TreeConstructor {
isTree(maybeTree: object): maybeTree is Tree;
}
export declare const Tree: TreeConstructor;
export interface UpdateRecorder {
insertLeft(index: number, content: Buffer | string): UpdateRecorder;
insertRight(index: number, content: Buffer | string): UpdateRecorder;

View file

@ -7,7 +7,7 @@
* found in the LICENSE file at https://angular.io/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeSymbol = exports.FileVisitorCancelToken = exports.MergeStrategy = void 0;
exports.Tree = exports.TreeSymbol = exports.FileVisitorCancelToken = exports.MergeStrategy = void 0;
var MergeStrategy;
(function (MergeStrategy) {
MergeStrategy[MergeStrategy["AllowOverwriteConflict"] = 2] = "AllowOverwriteConflict";
@ -37,11 +37,8 @@ exports.TreeSymbol = (function () {
}
return globalSymbol.schematicTree;
})();
// eslint-disable-next-line @typescript-eslint/no-namespace
var Tree;
(function (Tree) {
function isTree(maybeTree) {
exports.Tree = Object.freeze({
isTree(maybeTree) {
return exports.TreeSymbol in maybeTree;
}
Tree.isTree = isTree;
})(Tree || (Tree = {}));
},
});

View file

@ -5,24 +5,23 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { UpdateBufferBase } from '../utility/update-buffer';
import { BaseException } from '@angular-devkit/core';
import MagicString from 'magic-string';
import { FileEntry, UpdateRecorder } from './interface';
export declare class IndexOutOfBoundException extends BaseException {
constructor(index: number, min: number, max?: number);
}
export declare class UpdateRecorderBase implements UpdateRecorder {
private readonly data;
private readonly bom;
protected _path: string;
protected _original: Buffer;
protected _content: UpdateBufferBase;
constructor(entry: FileEntry);
protected content: MagicString;
constructor(data: Uint8Array, path: string, encoding?: string, bom?: boolean);
static createFromFileEntry(entry: FileEntry): UpdateRecorderBase;
get path(): string;
protected _assertIndex(index: number): void;
insertLeft(index: number, content: Buffer | string): UpdateRecorder;
insertRight(index: number, content: Buffer | string): UpdateRecorder;
remove(index: number, length: number): UpdateRecorder;
apply(content: Buffer): Buffer;
}
export declare class UpdateRecorderBom extends UpdateRecorderBase {
private _delta;
constructor(entry: FileEntry, _delta?: number);
insertLeft(index: number, content: Buffer | string): UpdateRecorder;
insertRight(index: number, content: Buffer | string): UpdateRecorder;
remove(index: number, length: number): UpdateRecorder;
}

View file

@ -6,18 +6,40 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateRecorderBom = exports.UpdateRecorderBase = void 0;
exports.UpdateRecorderBase = exports.IndexOutOfBoundException = void 0;
const core_1 = require("@angular-devkit/core");
const magic_string_1 = __importDefault(require("magic-string"));
const exception_1 = require("../exception/exception");
const update_buffer_1 = require("../utility/update-buffer");
class IndexOutOfBoundException extends core_1.BaseException {
constructor(index, min, max = Infinity) {
super(`Index ${index} outside of range [${min}, ${max}].`);
}
}
exports.IndexOutOfBoundException = IndexOutOfBoundException;
class UpdateRecorderBase {
data;
bom;
_path;
_original;
_content;
constructor(entry) {
this._original = Buffer.from(entry.content);
this._content = update_buffer_1.UpdateBufferBase.create(entry.path, entry.content);
this._path = entry.path;
content;
constructor(data, path, encoding = 'utf-8', bom = false) {
this.data = data;
this.bom = bom;
let text;
try {
text = new TextDecoder(encoding, { fatal: true, ignoreBOM: false }).decode(data);
}
catch (e) {
if (e instanceof TypeError) {
throw new Error(`Failed to decode "${path}" as ${encoding} text.`);
}
throw e;
}
this._path = path;
this.content = new magic_string_1.default(text);
}
static createFromFileEntry(entry) {
const c0 = entry.content.byteLength > 0 && entry.content.readUInt8(0);
@ -25,54 +47,47 @@ class UpdateRecorderBase {
const c2 = entry.content.byteLength > 2 && entry.content.readUInt8(2);
// Check if we're BOM.
if (c0 == 0xef && c1 == 0xbb && c2 == 0xbf) {
return new UpdateRecorderBom(entry);
return new UpdateRecorderBase(entry.content, entry.path, 'utf-8', true);
}
else if (c0 === 0xff && c1 == 0xfe) {
return new UpdateRecorderBom(entry);
return new UpdateRecorderBase(entry.content, entry.path, 'utf-16le', true);
}
else if (c0 === 0xfe && c1 == 0xff) {
return new UpdateRecorderBom(entry);
return new UpdateRecorderBase(entry.content, entry.path, 'utf-16be', true);
}
return new UpdateRecorderBase(entry);
return new UpdateRecorderBase(entry.content, entry.path);
}
get path() {
return this._path;
}
_assertIndex(index) {
if (index < 0 || index > this.content.original.length) {
throw new IndexOutOfBoundException(index, 0, this.content.original.length);
}
}
// These just record changes.
insertLeft(index, content) {
this._content.insertLeft(index, typeof content == 'string' ? Buffer.from(content) : content);
this._assertIndex(index);
this.content.appendLeft(index, content.toString());
return this;
}
insertRight(index, content) {
this._content.insertRight(index, typeof content == 'string' ? Buffer.from(content) : content);
this._assertIndex(index);
this.content.appendRight(index, content.toString());
return this;
}
remove(index, length) {
this._content.remove(index, length);
this._assertIndex(index);
this.content.remove(index, index + length);
return this;
}
apply(content) {
if (!content.equals(this._content.original)) {
if (!content.equals(this.data)) {
throw new exception_1.ContentHasMutatedException(this.path);
}
return this._content.generate();
// Schematics only support writing UTF-8 text
const result = Buffer.from((this.bom ? '\uFEFF' : '') + this.content.toString(), 'utf-8');
return result;
}
}
exports.UpdateRecorderBase = UpdateRecorderBase;
class UpdateRecorderBom extends UpdateRecorderBase {
_delta;
constructor(entry, _delta = 1) {
super(entry);
this._delta = _delta;
}
insertLeft(index, content) {
return super.insertLeft(index + this._delta, content);
}
insertRight(index, content) {
return super.insertRight(index + this._delta, content);
}
remove(index, length) {
return super.remove(index + this._delta, length);
}
}
exports.UpdateRecorderBom = UpdateRecorderBom;

View file

@ -1,50 +0,0 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { BaseException } from '@angular-devkit/core';
import MagicString from 'magic-string';
export declare class IndexOutOfBoundException extends BaseException {
constructor(index: number, min: number, max?: number);
}
/**
* Base class for an update buffer implementation that allows buffers to be inserted to the _right
* or _left, or deleted, while keeping indices to the original buffer.
*/
export declare abstract class UpdateBufferBase {
protected _originalContent: Buffer;
constructor(_originalContent: Buffer);
abstract get length(): number;
abstract get original(): Buffer;
abstract toString(encoding?: string): string;
abstract generate(): Buffer;
abstract insertLeft(index: number, content: Buffer, assert?: boolean): void;
abstract insertRight(index: number, content: Buffer, assert?: boolean): void;
abstract remove(index: number, length: number): void;
/**
* Creates an UpdateBufferBase instance.
*
* @param contentPath The path of the update buffer instance.
* @param originalContent The original content of the update buffer instance.
* @returns An UpdateBufferBase instance.
*/
static create(contentPath: string, originalContent: Buffer): UpdateBufferBase;
}
/**
* An utility class that allows buffers to be inserted to the _right or _left, or deleted, while
* keeping indices to the original buffer.
*/
export declare class UpdateBuffer extends UpdateBufferBase {
protected _mutatableContent: MagicString;
protected _assertIndex(index: number): void;
get length(): number;
get original(): Buffer;
toString(): string;
generate(): Buffer;
insertLeft(index: number, content: Buffer): void;
insertRight(index: number, content: Buffer): void;
remove(index: number, length: number): void;
}

View file

@ -1,90 +0,0 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateBuffer = exports.UpdateBufferBase = exports.IndexOutOfBoundException = void 0;
const core_1 = require("@angular-devkit/core");
const magic_string_1 = __importDefault(require("magic-string"));
const node_util_1 = require("node:util");
class IndexOutOfBoundException extends core_1.BaseException {
constructor(index, min, max = Infinity) {
super(`Index ${index} outside of range [${min}, ${max}].`);
}
}
exports.IndexOutOfBoundException = IndexOutOfBoundException;
/**
* Base class for an update buffer implementation that allows buffers to be inserted to the _right
* or _left, or deleted, while keeping indices to the original buffer.
*/
class UpdateBufferBase {
_originalContent;
constructor(_originalContent) {
this._originalContent = _originalContent;
}
/**
* Creates an UpdateBufferBase instance.
*
* @param contentPath The path of the update buffer instance.
* @param originalContent The original content of the update buffer instance.
* @returns An UpdateBufferBase instance.
*/
static create(contentPath, originalContent) {
try {
// We only support utf8 encoding.
new node_util_1.TextDecoder('utf8', { fatal: true }).decode(originalContent);
return new UpdateBuffer(originalContent);
}
catch (e) {
if (e instanceof TypeError) {
throw new Error(`Failed to decode "${contentPath}" as UTF-8 text.`);
}
throw e;
}
}
}
exports.UpdateBufferBase = UpdateBufferBase;
/**
* An utility class that allows buffers to be inserted to the _right or _left, or deleted, while
* keeping indices to the original buffer.
*/
class UpdateBuffer extends UpdateBufferBase {
_mutatableContent = new magic_string_1.default(this._originalContent.toString());
_assertIndex(index) {
if (index < 0 || index > this._originalContent.length) {
throw new IndexOutOfBoundException(index, 0, this._originalContent.length);
}
}
get length() {
return this._mutatableContent.length();
}
get original() {
return this._originalContent;
}
toString() {
return this._mutatableContent.toString();
}
generate() {
return Buffer.from(this.toString());
}
insertLeft(index, content) {
this._assertIndex(index);
this._mutatableContent.appendLeft(index, content.toString());
}
insertRight(index, content) {
this._assertIndex(index);
this._mutatableContent.appendRight(index, content.toString());
}
remove(index, length) {
this._assertIndex(index);
this._mutatableContent.remove(index, index + length);
}
}
exports.UpdateBuffer = UpdateBuffer;

View file

@ -55,6 +55,13 @@ const packageManagers = {
},
'yarn': {
commands: {
installAll: 'install',
installPackage: 'add',
},
},
'bun': {
commands: {
installAll: 'install',
installPackage: 'add',
},
},

View file

@ -53,7 +53,8 @@
"npm",
"cnpm",
"yarn",
"pnpm"
"pnpm",
"bun"
]
},
"warnings": {
@ -119,7 +120,8 @@
"npm",
"cnpm",
"yarn",
"pnpm"
"pnpm",
"bun"
]
},
"warnings": {
@ -1574,7 +1576,8 @@
"npm",
"yarn",
"pnpm",
"cnpm"
"cnpm",
"bun"
]
},
"standalone": {
@ -1747,6 +1750,10 @@
"type": "string",
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
},
"deployUrl": {
"type": "string",
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"scripts": {
"description": "Global scripts to be included in the build.",
"type": "array",
@ -1850,6 +1857,11 @@
},
"default": []
},
"clearScreen": {
"type": "boolean",
"default": false,
"description": "Automatically clear the terminal screen during rebuilds."
},
"optimization": {
"description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
"default": true,
@ -1934,6 +1946,13 @@
}
}
},
"define": {
"description": "Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced.",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"fileReplacements": {
"description": "Replace compilation source files with other compilation source files in the build.",
"type": "array",
@ -2295,11 +2314,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false
@ -2664,8 +2683,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"deprecated": true
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -2881,11 +2899,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false
@ -2895,11 +2913,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false
@ -3238,8 +3256,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"deprecated": true
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"verbose": {
"type": "boolean",
@ -3458,11 +3475,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false
@ -3534,7 +3551,7 @@
"buildTarget": {
"type": "string",
"description": "A build builder target to serve in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
"pattern": "^[^:\\s]*:[^:\\s]*(:[^\\s]+)?$"
},
"port": {
"type": "number",
@ -3590,11 +3607,11 @@
},
"publicHost": {
"type": "string",
"description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies."
"description": "The URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies. This option has no effect when using the 'application' or other esbuild-based builders."
},
"allowedHosts": {
"type": "array",
"description": "List of hosts that are allowed to access the dev server.",
"description": "List of hosts that are allowed to access the dev server. This option has no effect when using the 'application' or other esbuild-based builders.",
"default": [],
"items": {
"type": "string"
@ -3606,7 +3623,7 @@
},
"disableHostCheck": {
"type": "boolean",
"description": "Don't verify connected clients are part of allowed hosts.",
"description": "Don't verify connected clients are part of allowed hosts. This option has no effect when using the 'application' or other esbuild-based builders.",
"default": false
},
"hmr": {
@ -3627,6 +3644,27 @@
"type": "boolean",
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system.",
"default": false
},
"prebundle": {
"description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled. This option has no effect when using the 'browser' or other Webpack-based builders.",
"oneOf": [
{
"type": "boolean"
},
{
"type": "object",
"properties": {
"exclude": {
"description": "List of package imports that should not be prebundled by the development server. The packages will be bundled into the application code itself.",
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false
}
]
}
},
"additionalProperties": false,
@ -3649,7 +3687,7 @@
"buildTarget": {
"type": "string",
"description": "A builder target to extract i18n messages in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
"pattern": "^[^:\\s]*:[^:\\s]*(:[^\\s]+)?$"
},
"format": {
"type": "string",
@ -4623,8 +4661,7 @@
},
"deployUrl": {
"type": "string",
"description": "URL where files will be deployed.",
"deprecated": true
"description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations."
},
"vendorChunk": {
"type": "boolean",
@ -4783,11 +4820,11 @@
"properties": {
"src": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"replaceWith": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false
@ -4797,11 +4834,11 @@
"properties": {
"replace": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
},
"with": {
"type": "string",
"pattern": "\\.(([cm]?j|t)sx?|json)$"
"pattern": "\\.(([cm]?[jt])sx?|json)$"
}
},
"additionalProperties": false

View file

@ -66,6 +66,7 @@ export declare enum Environment {
* The package manager used to install dependencies.
*/
export declare enum PackageManager {
Bun = "bun",
Cnpm = "cnpm",
Npm = "npm",
Pnpm = "pnpm",

View file

@ -19,6 +19,7 @@ var Environment;
*/
var PackageManager;
(function (PackageManager) {
PackageManager["Bun"] = "bun";
PackageManager["Cnpm"] = "cnpm";
PackageManager["Npm"] = "npm";
PackageManager["Pnpm"] = "pnpm";

View file

@ -1,6 +1,6 @@
{
"name": "@angular/cli",
"version": "17.1.3",
"version": "17.3.8",
"description": "CLI tool for Angular",
"main": "lib/cli/index.js",
"bin": {
@ -25,35 +25,35 @@
},
"homepage": "https://github.com/angular/angular-cli",
"dependencies": {
"@angular-devkit/architect": "0.1701.3",
"@angular-devkit/core": "17.1.3",
"@angular-devkit/schematics": "17.1.3",
"@schematics/angular": "17.1.3",
"@angular-devkit/architect": "0.1703.8",
"@angular-devkit/core": "17.3.8",
"@angular-devkit/schematics": "17.3.8",
"@schematics/angular": "17.3.8",
"@yarnpkg/lockfile": "1.1.0",
"ansi-colors": "4.1.3",
"ini": "4.1.1",
"inquirer": "9.2.12",
"jsonc-parser": "3.2.0",
"ini": "4.1.2",
"inquirer": "9.2.15",
"jsonc-parser": "3.2.1",
"npm-package-arg": "11.0.1",
"npm-pick-manifest": "9.0.0",
"open": "8.4.2",
"ora": "5.4.1",
"pacote": "17.0.5",
"pacote": "17.0.6",
"resolve": "1.22.8",
"semver": "7.5.4",
"semver": "7.6.0",
"symbol-observable": "4.0.0",
"yargs": "17.7.2"
},
"ng-update": {
"migrations": "@schematics/angular/migrations/migration-collection.json",
"packageGroup": {
"@angular/cli": "17.1.3",
"@angular/ssr": "17.1.3",
"@angular-devkit/architect": "0.1701.3",
"@angular-devkit/build-angular": "17.1.3",
"@angular-devkit/build-webpack": "0.1701.3",
"@angular-devkit/core": "17.1.3",
"@angular-devkit/schematics": "17.1.3"
"@angular/cli": "17.3.8",
"@angular/ssr": "17.3.8",
"@angular-devkit/architect": "0.1703.8",
"@angular-devkit/build-angular": "17.3.8",
"@angular-devkit/build-webpack": "0.1703.8",
"@angular-devkit/core": "17.3.8",
"@angular-devkit/schematics": "17.3.8"
}
},
"engines": {

View file

@ -36,7 +36,7 @@ class ArchitectCommandModule extends architect_base_command_module_1.ArchitectBa
describe: `One or more named builder configurations as a comma-separated ` +
`list as specified in the "configurations" section in angular.json.\n` +
`The builder uses the named configurations to run the given target.\n` +
`For more information, see https://angular.io/guide/workspace-config#alternate-build-configurations.`,
`For more information, see https://angular.dev/reference/configs/workspace-config#alternate-build-configurations.`,
alias: 'c',
type: 'string',
// Show only in when using --help and auto completion because otherwise comma seperated configuration values will be invalid.

View file

@ -98,7 +98,7 @@ async function runCommand(args, logger) {
'deprecated: %s': color_1.colors.yellow('deprecated:') + ' %s',
'Did you mean %s?': 'Unknown command. Did you mean %s?',
})
.epilogue('For more information, see https://angular.io/cli/.\n')
.epilogue('For more information, see https://angular.dev/cli/.\n')
.demandCommand(1, command_1.demandCommandFailureMessage)
.recommendCommands()
.middleware(normalize_options_middleware_1.normalizeOptionsMiddleware)

View file

@ -15,4 +15,4 @@ either by direct editing or with the `ng config` command.
These include `assets`, `styles`, and `scripts` objects that provide runtime-global resources to include in the project.
Resources in CSS, such as images and fonts, are automatically written and fingerprinted at the root of the output folder.
For further details, see [Workspace Configuration](guide/workspace-config).
For further details, see [Workspace Configuration](reference/configs/workspace-config).

View file

@ -2,7 +2,7 @@ Angular CLI saves a number of cachable operations on disk by default.
When you re-run the same build, the build system restores the state of the previous build and re-uses previously performed operations, which decreases the time taken to build and test your applications and libraries.
To amend the default cache settings, add the `cli.cache` object to your [Workspace Configuration](guide/workspace-config).
To amend the default cache settings, add the `cli.cache` object to your [Workspace Configuration](reference/configs/workspace-config).
The object goes under `cli.cache` at the top level of the file, outside the `projects` sections.
```jsonc
@ -12,13 +12,13 @@ The object goes under `cli.cache` at the top level of the file, outside the `pro
"cli": {
"cache": {
// ...
}
},
},
"projects": {}
"projects": {},
}
```
For more information, see [cache options](guide/workspace-config#cache-options).
For more information, see [cache options](reference/configs/workspace-config#cache-options).
### Cache environments
@ -34,7 +34,7 @@ To change the environment setting to `all`, run the following command:
ng config cli.cache.environment all
```
For more information, see `environment` in [cache options](guide/workspace-config#cache-options).
For more information, see `environment` in [cache options](reference/configs/workspace-config#cache-options).
<div class="alert is-helpful">

View file

@ -44,7 +44,7 @@ Appended \`source <(ng completion script)\` to \`${rcFile}\`. Restart your termi
' Angular CLI. For autocompletion to work, the CLI will need to be on your `$PATH`, which' +
' is typically done with the `-g` flag in `npm install -g @angular/cli`.' +
'\n\n' +
'For more information, see https://angular.io/cli/completion#global-install');
'For more information, see https://angular.dev/cli/completion#global-install');
}
return 0;
}

View file

@ -8,6 +8,6 @@ The configurable property names match command option names,
except that in the configuration file, all names must use camelCase,
while on the command line options can be given dash-case.
For further details, see [Workspace Configuration](guide/workspace-config).
For further details, see [Workspace Configuration](reference/configs/workspace-config).
For configuration of CLI usage analytics, see [ng analytics](cli/analytics).

View file

@ -3,7 +3,7 @@ When a project name is not supplied, executes the `deploy` builder for the defau
To use the `ng deploy` command, use `ng add` to add a package that implements deployment capabilities to your favorite platform.
Adding the package automatically updates your workspace configuration, adding a deployment
[CLI builder](guide/cli-builder).
[CLI builder](tools/cli/cli-builder).
For example:
```json

View file

@ -1,7 +1,7 @@
The command takes an optional project name, as specified in the `projects` section of the `angular.json` workspace configuration file.
When a project name is not supplied, executes the `lint` builder for all projects.
To use the `ng lint` command, use `ng add` to add a package that implements linting capabilities. Adding the package automatically updates your workspace configuration, adding a lint [CLI builder](guide/cli-builder).
To use the `ng lint` command, use `ng add` to add a package that implements linting capabilities. Adding the package automatically updates your workspace configuration, adding a lint [CLI builder](tools/cli/cli-builder).
For example:
```json

View file

@ -785,6 +785,7 @@ class UpdateCommandModule extends command_module_1.CommandModule {
const { logger } = this.context;
const numberOfMigrations = optionalMigrations.length;
logger.info(`This package has ${numberOfMigrations} optional migration${numberOfMigrations > 1 ? 's' : ''} that can be executed.`);
logger.info('Optional migrations may be skipped and executed after the update process if preferred.');
logger.info(''); // Extra trailing newline.
if (!(0, tty_1.isTTY)()) {
for (const migration of optionalMigrations) {

View file

@ -35,7 +35,6 @@ const core_1 = require("@angular-devkit/core");
const schematics_1 = require("@angular-devkit/schematics");
const npa = __importStar(require("npm-package-arg"));
const semver = __importStar(require("semver"));
const error_1 = require("../../../utilities/error");
const package_metadata_1 = require("../../../utilities/package-metadata");
// Angular guarantees that a major is compatible with its following major (so packages that depend
// on Angular 5 are also compatible with Angular 6). This is, in code, represented by verifying
@ -196,14 +195,7 @@ function _performUpdate(tree, context, infoMap, logger, migrateOnly) {
if (!packageJsonContent) {
throw new schematics_1.SchematicsException('Could not find a package.json. Are you in a Node project?');
}
let packageJson;
try {
packageJson = JSON.parse(packageJsonContent.toString());
}
catch (e) {
(0, error_1.assertIsError)(e);
throw new schematics_1.SchematicsException('package.json could not be parsed: ' + e.message);
}
const packageJson = tree.readJson('/package.json');
const updateDependency = (deps, name, newVersion) => {
const oldVersion = deps[name];
// We only respect caret and tilde ranges on update.
@ -423,11 +415,12 @@ function _buildPackageInfo(tree, packages, allDependencies, npmPackageJson, logg
}
// Find out the currently installed version. Either from the package.json or the node_modules/
// TODO: figure out a way to read package-lock.json and/or yarn.lock.
const pkgJsonPath = `/node_modules/${name}/package.json`;
const pkgJsonExists = tree.exists(pkgJsonPath);
let installedVersion;
const packageContent = tree.read(`/node_modules/${name}/package.json`);
if (packageContent) {
const content = JSON.parse(packageContent.toString());
installedVersion = content.version;
if (pkgJsonExists) {
const { version } = tree.readJson(pkgJsonPath);
installedVersion = version;
}
const packageVersionsNonDeprecated = [];
const packageVersionsDeprecated = [];
@ -449,7 +442,7 @@ function _buildPackageInfo(tree, packages, allDependencies, npmPackageJson, logg
if (!installedVersion) {
throw new schematics_1.SchematicsException(`An unexpected error happened; could not determine version for package ${name}.`);
}
const installedPackageJson = npmPackageJson.versions[installedVersion] || packageContent;
const installedPackageJson = npmPackageJson.versions[installedVersion] || pkgJsonExists;
if (!installedPackageJson) {
throw new schematics_1.SchematicsException(`An unexpected error happened; package ${name} has no version ${installedVersion}.`);
}
@ -593,22 +586,11 @@ function _addPeerDependencies(tree, packages, allDependencies, npmPackageJson, n
}
}
function _getAllDependencies(tree) {
const packageJsonContent = tree.read('/package.json');
if (!packageJsonContent) {
throw new schematics_1.SchematicsException('Could not find a package.json. Are you in a Node project?');
}
let packageJson;
try {
packageJson = JSON.parse(packageJsonContent.toString());
}
catch (e) {
(0, error_1.assertIsError)(e);
throw new schematics_1.SchematicsException('package.json could not be parsed: ' + e.message);
}
const { dependencies, devDependencies, peerDependencies } = tree.readJson('/package.json');
return [
...Object.entries(packageJson.peerDependencies || {}),
...Object.entries(packageJson.devDependencies || {}),
...Object.entries(packageJson.dependencies || {}),
...Object.entries(peerDependencies || {}),
...Object.entries(devDependencies || {}),
...Object.entries(dependencies || {}),
];
}
function _formatVersion(version) {

View file

@ -44,6 +44,7 @@ export interface Schema {
* The preferred package manager configuration files to use for registry settings.
*/
export declare enum PackageManager {
Bun = "bun",
Cnpm = "cnpm",
Npm = "npm",
Pnpm = "pnpm",

View file

@ -8,6 +8,7 @@ exports.PackageManager = void 0;
*/
var PackageManager;
(function (PackageManager) {
PackageManager["Bun"] = "bun";
PackageManager["Cnpm"] = "cnpm";
PackageManager["Npm"] = "npm";
PackageManager["Pnpm"] = "pnpm";

View file

@ -57,7 +57,7 @@
"description": "The preferred package manager configuration files to use for registry settings.",
"type": "string",
"default": "npm",
"enum": ["npm", "yarn", "cnpm", "pnpm"]
"enum": ["npm", "yarn", "cnpm", "pnpm", "bun"]
}
},
"required": []

View file

@ -89,7 +89,7 @@ Appended \`source <(ng completion script)\` to \`${rcFile}\`. Restart your termi
' Angular CLI. For autocompletion to work, the CLI will need to be on your `$PATH`, which' +
' is typically done with the `-g` flag in `npm install -g @angular/cli`.' +
'\n\n' +
'For more information, see https://angular.io/cli/completion#global-install');
'For more information, see https://angular.dev/cli/completion#global-install');
}
// Save configuration to remember that the user was prompted.
await setCompletionConfig({ ...completionConfig, prompted: true });

View file

@ -113,6 +113,14 @@ class PackageManagerUtils {
prefix: '--prefix',
noLockfile: '--no-lockfile',
};
case workspace_schema_1.PackageManager.Bun:
return {
saveDev: '--development',
install: 'add',
installAll: 'install',
prefix: '--cwd',
noLockfile: '',
};
default:
return {
saveDev: '--save-dev',
@ -175,12 +183,13 @@ class PackageManagerUtils {
const hasNpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Npm);
const hasYarnLock = this.hasLockfile(workspace_schema_1.PackageManager.Yarn);
const hasPnpmLock = this.hasLockfile(workspace_schema_1.PackageManager.Pnpm);
const hasBunLock = this.hasLockfile(workspace_schema_1.PackageManager.Bun);
// PERF NOTE: `this.getVersion` spawns the package a the child_process which can take around ~300ms at times.
// Therefore, we should only call this method when needed. IE: don't call `this.getVersion(PackageManager.Pnpm)` unless truly needed.
// The result of this method is not stored in a variable because it's memoized.
if (hasNpmLock) {
// Has NPM lock file.
if (!hasYarnLock && !hasPnpmLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
if (!hasYarnLock && !hasPnpmLock && !hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Npm)) {
// Only NPM lock file and NPM binary is available.
return workspace_schema_1.PackageManager.Npm;
}
@ -195,17 +204,25 @@ class PackageManagerUtils {
// PNPM lock file and PNPM binary is available.
return workspace_schema_1.PackageManager.Pnpm;
}
else if (hasBunLock && this.getVersion(workspace_schema_1.PackageManager.Bun)) {
// Bun lock file and Bun binary is available.
return workspace_schema_1.PackageManager.Bun;
}
}
if (!this.getVersion(workspace_schema_1.PackageManager.Npm)) {
// Doesn't have NPM installed.
const hasYarn = !!this.getVersion(workspace_schema_1.PackageManager.Yarn);
const hasPnpm = !!this.getVersion(workspace_schema_1.PackageManager.Pnpm);
if (hasYarn && !hasPnpm) {
const hasBun = !!this.getVersion(workspace_schema_1.PackageManager.Bun);
if (hasYarn && !hasPnpm && !hasBun) {
return workspace_schema_1.PackageManager.Yarn;
}
else if (!hasYarn && hasPnpm) {
else if (hasPnpm && !hasYarn && !hasBun) {
return workspace_schema_1.PackageManager.Pnpm;
}
else if (hasBun && !hasYarn && !hasPnpm) {
return workspace_schema_1.PackageManager.Bun;
}
}
// TODO: This should eventually inform the user of ambiguous package manager usage.
// Potentially with a prompt to choose and optionally set as the default.
@ -220,6 +237,9 @@ class PackageManagerUtils {
case workspace_schema_1.PackageManager.Pnpm:
lockfileName = 'pnpm-lock.yaml';
break;
case workspace_schema_1.PackageManager.Bun:
lockfileName = 'bun.lockb';
break;
case workspace_schema_1.PackageManager.Npm:
default:
lockfileName = 'package-lock.json';

View file

@ -25,5 +25,5 @@ class Version {
}
}
// TODO(bazel): Convert this to use build-time version stamping after flipping the build script to use bazel
// export const VERSION = new Version('17.1.3');
// export const VERSION = new Version('17.3.8');
exports.VERSION = new Version(JSON.parse((0, fs_1.readFileSync)((0, path_1.resolve)(__dirname, '../../package.json'), 'utf-8')).version);

0
my-app/node_modules/@npmcli/agent/README.md generated vendored Executable file → Normal file
View file

5
my-app/node_modules/@npmcli/agent/lib/agents.js generated vendored Executable file → Normal file
View file

@ -65,7 +65,10 @@ module.exports = class Agent extends AgentBase {
ProxyAgent = this.isSecureEndpoint(options) ? ProxyAgent[1] : ProxyAgent[0]
}
const proxyAgent = new ProxyAgent(proxy, this.#options)
const proxyAgent = new ProxyAgent(proxy, {
...this.#options,
socketOptions: { family: this.#options.family },
})
proxyCache.set(cacheKey, proxyAgent)
return proxyAgent

0
my-app/node_modules/@npmcli/agent/lib/dns.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/lib/errors.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/lib/index.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/lib/options.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/lib/proxy.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/LICENSE generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/README.md generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/commonjs/index.d.ts generated vendored Executable file → Normal file
View file

View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/commonjs/index.js generated vendored Executable file → Normal file
View file

View file

View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/esm/index.d.ts generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/esm/index.d.ts.map generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/esm/index.js generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/esm/index.js.map generated vendored Executable file → Normal file
View file

0
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/dist/esm/package.json generated vendored Executable file → Normal file
View file

13
my-app/node_modules/@npmcli/agent/node_modules/lru-cache/package.json generated vendored Executable file → Normal file
View file

@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "10.2.0",
"version": "10.2.2",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
@ -11,8 +11,7 @@
"sideEffects": false,
"scripts": {
"build": "npm run prepare",
"prepare": "tshy",
"postprepare": "bash fixup.sh",
"prepare": "tshy && bash fixup.sh",
"pretest": "npm run prepare",
"presnap": "npm run prepare",
"test": "tap",
@ -35,8 +34,8 @@
".": "./src/index.ts",
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
@ -105,8 +104,8 @@
},
"./min": {
"import": {
"types": "./dist/mjs/index.d.ts",
"default": "./dist/mjs/index.min.js"
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.min.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",

4
my-app/node_modules/@npmcli/agent/package.json generated vendored Executable file → Normal file
View file

@ -1,6 +1,6 @@
{
"name": "@npmcli/agent",
"version": "2.2.1",
"version": "2.2.2",
"description": "the http/https agent used by the npm cli",
"main": "lib/index.js",
"scripts": {
@ -36,7 +36,7 @@
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.1",
"lru-cache": "^10.0.1",
"socks-proxy-agent": "^8.0.1"
"socks-proxy-agent": "^8.0.3"
},
"devDependencies": {
"@npmcli/eslint-config": "^4.0.0",

Some files were not shown because too many files have changed in this diff Show more