Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

21
my-app/node_modules/@angular-devkit/build-webpack/LICENSE generated vendored Executable file
View file

@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2017 Google, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

34
my-app/node_modules/@angular-devkit/build-webpack/README.md generated vendored Executable file
View file

@ -0,0 +1,34 @@
# Webpack Builder for Architect
This package allows you to run Webpack and Webpack Dev Server using Architect.
To use it on your Angular CLI app, follow these steps:
- run `npm install @angular-devkit/build-webpack`.
- create a webpack configuration.
- add the following targets inside `angular.json`.
```
"projects": {
"app": {
// ...
"architect": {
// ...
"build-webpack": {
"builder": "@angular-devkit/build-webpack:webpack",
"options": {
"webpackConfig": "webpack.config.js"
}
},
"serve-webpack": {
"builder": "@angular-devkit/build-webpack:webpack-dev-server",
"options": {
"webpackConfig": "webpack.config.js"
}
}
}
```
- run `ng run app:build-webpack` to build, and `ng run app:serve-webpack` to serve.
All options, including `watch` and `stats`, are looked up inside the webpack configuration.

View file

@ -0,0 +1,25 @@
{
"$schema": "../architect/src/builders-schema.json",
"builders": {
"build": {
"implementation": "./src/builders/webpack",
"schema": "./src/builders/webpack/schema.json",
"description": "Build a webpack app."
},
"webpack": {
"implementation": "./src/builders/webpack",
"schema": "./src/builders/webpack/schema.json",
"description": "Build a webpack app."
},
"dev-server": {
"implementation": "./src/builders/webpack-dev-server",
"schema": "./src/builders/webpack-dev-server/schema.json",
"description": "Serve a webpack app."
},
"webpack-dev-server": {
"implementation": "./src/builders/webpack-dev-server",
"schema": "./src/builders/webpack-dev-server/schema.json",
"description": "Serve a webpack app."
}
}
}

View file

@ -0,0 +1,48 @@
{
"name": "@angular-devkit/build-webpack",
"version": "0.1701.3",
"description": "Webpack Builder for Architect",
"experimental": true,
"main": "src/index.js",
"typings": "src/index.d.ts",
"builders": "builders.json",
"exports": {
".": {
"types": "./src/index.d.ts",
"default": "./src/index.js"
},
"./package.json": "./package.json",
"./*": "./*.js",
"./*.js": "./*.js"
},
"dependencies": {
"@angular-devkit/architect": "0.1701.3",
"rxjs": "7.8.1"
},
"peerDependencies": {
"webpack": "^5.30.0",
"webpack-dev-server": "^4.0.0"
},
"keywords": [
"Angular CLI",
"Angular DevKit",
"angular",
"devkit",
"sdk"
],
"repository": {
"type": "git",
"url": "https://github.com/angular/angular-cli.git"
},
"engines": {
"node": "^18.13.0 || >=20.9.0",
"npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
"yarn": ">= 1.13.0"
},
"author": "Angular Authors",
"license": "MIT",
"bugs": {
"url": "https://github.com/angular/angular-cli/issues"
},
"homepage": "https://github.com/angular/angular-cli"
}

View file

@ -0,0 +1,28 @@
/**
* @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 { BuilderContext } from '@angular-devkit/architect';
import { Observable } from 'rxjs';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';
import { BuildResult, WebpackFactory, WebpackLoggingCallback } from '../webpack';
import { Schema as WebpackDevServerBuilderSchema } from './schema';
export type WebpackDevServerFactory = typeof WebpackDevServer;
export type DevServerBuildOutput = BuildResult & {
port: number;
family: string;
address: string;
};
export declare function runWebpackDevServer(config: webpack.Configuration, context: BuilderContext, options?: {
shouldProvideStats?: boolean;
devServerConfig?: WebpackDevServer.Configuration;
logging?: WebpackLoggingCallback;
webpackFactory?: WebpackFactory;
webpackDevServerFactory?: WebpackDevServerFactory;
}): Observable<DevServerBuildOutput>;
declare const _default: import("../../../../architect/src/internal").Builder<WebpackDevServerBuilderSchema & import("../../../../core/src").JsonObject>;
export default _default;

View file

@ -0,0 +1,88 @@
"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.runWebpackDevServer = void 0;
const architect_1 = require("@angular-devkit/architect");
const path_1 = require("path");
const rxjs_1 = require("rxjs");
const webpack_1 = __importDefault(require("webpack"));
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
const utils_1 = require("../../utils");
function runWebpackDevServer(config, context, options = {}) {
const createWebpack = (c) => {
if (options.webpackFactory) {
const result = options.webpackFactory(c);
if ((0, rxjs_1.isObservable)(result)) {
return result;
}
else {
return (0, rxjs_1.of)(result);
}
}
else {
return (0, rxjs_1.of)((0, webpack_1.default)(c));
}
};
const createWebpackDevServer = (webpack, config) => {
if (options.webpackDevServerFactory) {
return new options.webpackDevServerFactory(config, webpack);
}
return new webpack_dev_server_1.default(config, webpack);
};
const log = options.logging || ((stats, config) => context.logger.info(stats.toString(config.stats)));
const shouldProvideStats = options.shouldProvideStats ?? true;
return createWebpack({ ...config, watch: false }).pipe((0, rxjs_1.switchMap)((webpackCompiler) => new rxjs_1.Observable((obs) => {
const devServerConfig = options.devServerConfig || config.devServer || {};
devServerConfig.host ??= 'localhost';
let result;
const statsOptions = typeof config.stats === 'boolean' ? undefined : config.stats;
webpackCompiler.hooks.done.tap('build-webpack', (stats) => {
// Log stats.
log(stats, config);
obs.next({
...result,
webpackStats: shouldProvideStats ? stats.toJson(statsOptions) : undefined,
emittedFiles: (0, utils_1.getEmittedFiles)(stats.compilation),
success: !stats.hasErrors(),
outputPath: stats.compilation.outputOptions.path,
});
});
const devServer = createWebpackDevServer(webpackCompiler, devServerConfig);
devServer.startCallback((err) => {
if (err) {
obs.error(err);
return;
}
const address = devServer.server?.address();
if (!address) {
obs.error(new Error(`Dev-server address info is not defined.`));
return;
}
result = {
success: true,
port: typeof address === 'string' ? 0 : address.port,
family: typeof address === 'string' ? '' : address.family,
address: typeof address === 'string' ? address : address.address,
};
});
// Teardown logic. Close the server when unsubscribed from.
return () => {
devServer.stopCallback(() => { });
webpackCompiler.close(() => { });
};
})));
}
exports.runWebpackDevServer = runWebpackDevServer;
exports.default = (0, architect_1.createBuilder)((options, context) => {
const configPath = (0, path_1.resolve)(context.workspaceRoot, options.webpackConfig);
return (0, rxjs_1.from)((0, utils_1.getWebpackConfig)(configPath)).pipe((0, rxjs_1.switchMap)((config) => runWebpackDevServer(config, context)));
});

View file

@ -0,0 +1,9 @@
/**
* Webpack Dev-Server Builder schema for Architect.
*/
export interface Schema {
/**
* The path to the Webpack configuration file.
*/
webpackConfig: string;
}

View file

@ -0,0 +1,4 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Webpack Dev-Server Builder",
"description": "Webpack Dev-Server Builder schema for Architect.",
"type": "object",
"properties": {
"webpackConfig": {
"type": "string",
"description": "The path to the Webpack configuration file."
}
},
"additionalProperties": false,
"required": ["webpackConfig"]
}

View file

@ -0,0 +1,31 @@
/**
* @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 { BuilderContext, BuilderOutput } from '@angular-devkit/architect';
import { Observable } from 'rxjs';
import webpack from 'webpack';
import { EmittedFiles } from '../../utils';
import { Schema as RealWebpackBuilderSchema } from './schema';
export type WebpackBuilderSchema = RealWebpackBuilderSchema;
export interface WebpackLoggingCallback {
(stats: webpack.Stats, config: webpack.Configuration): void;
}
export interface WebpackFactory {
(config: webpack.Configuration): Observable<webpack.Compiler> | webpack.Compiler;
}
export type BuildResult = BuilderOutput & {
emittedFiles?: EmittedFiles[];
webpackStats?: webpack.StatsCompilation;
outputPath: string;
};
export declare function runWebpack(config: webpack.Configuration, context: BuilderContext, options?: {
logging?: WebpackLoggingCallback;
webpackFactory?: WebpackFactory;
shouldProvideStats?: boolean;
}): Observable<BuildResult>;
declare const _default: import("../../../../architect/src/internal").Builder<RealWebpackBuilderSchema & import("../../../../core/src").JsonObject>;
export default _default;

View file

@ -0,0 +1,88 @@
"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.runWebpack = void 0;
const architect_1 = require("@angular-devkit/architect");
const path_1 = require("path");
const rxjs_1 = require("rxjs");
const webpack_1 = __importDefault(require("webpack"));
const utils_1 = require("../../utils");
function runWebpack(config, context, options = {}) {
const { logging: log = (stats, config) => context.logger.info(stats.toString(config.stats)), shouldProvideStats = true, } = options;
const createWebpack = (c) => {
if (options.webpackFactory) {
const result = options.webpackFactory(c);
if ((0, rxjs_1.isObservable)(result)) {
return result;
}
else {
return (0, rxjs_1.of)(result);
}
}
else {
return (0, rxjs_1.of)((0, webpack_1.default)(c));
}
};
return createWebpack({ ...config, watch: false }).pipe((0, rxjs_1.switchMap)((webpackCompiler) => new rxjs_1.Observable((obs) => {
const callback = (err, stats) => {
if (err) {
return obs.error(err);
}
if (!stats) {
return;
}
// Log stats.
log(stats, config);
const statsOptions = typeof config.stats === 'boolean' ? undefined : config.stats;
const result = {
success: !stats.hasErrors(),
webpackStats: shouldProvideStats ? stats.toJson(statsOptions) : undefined,
emittedFiles: (0, utils_1.getEmittedFiles)(stats.compilation),
outputPath: stats.compilation.outputOptions.path,
};
if (config.watch) {
obs.next(result);
}
else {
webpackCompiler.close(() => {
obs.next(result);
obs.complete();
});
}
};
try {
if (config.watch) {
const watchOptions = config.watchOptions || {};
const watching = webpackCompiler.watch(watchOptions, callback);
// Teardown logic. Close the watcher when unsubscribed from.
return () => {
watching.close(() => { });
webpackCompiler.close(() => { });
};
}
else {
webpackCompiler.run(callback);
}
}
catch (err) {
if (err) {
context.logger.error(`\nAn error occurred during the build:\n${err instanceof Error ? err.stack : err}`);
}
throw err;
}
})));
}
exports.runWebpack = runWebpack;
exports.default = (0, architect_1.createBuilder)((options, context) => {
const configPath = (0, path_1.resolve)(context.workspaceRoot, options.webpackConfig);
return (0, rxjs_1.from)((0, utils_1.getWebpackConfig)(configPath)).pipe((0, rxjs_1.switchMap)((config) => runWebpack(config, context)));
});

View file

@ -0,0 +1,9 @@
/**
* Webpack Builder schema for Architect.
*/
export interface Schema {
/**
* The path to the Webpack configuration file.
*/
webpackConfig: string;
}

View file

@ -0,0 +1,4 @@
"use strict";
// THIS FILE IS AUTOMATICALLY GENERATED. TO UPDATE THIS FILE YOU NEED TO CHANGE THE
// CORRESPONDING JSON SCHEMA FILE, THEN RUN devkit-admin build (or bazel build ...).
Object.defineProperty(exports, "__esModule", { value: true });

View file

@ -0,0 +1,14 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Webpack Builder.",
"description": "Webpack Builder schema for Architect.",
"type": "object",
"properties": {
"webpackConfig": {
"type": "string",
"description": "The path to the Webpack configuration file."
}
},
"additionalProperties": false,
"required": ["webpackConfig"]
}

View file

@ -0,0 +1,10 @@
/**
* @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
*/
export * from './builders/webpack';
export * from './builders/webpack-dev-server';
export { EmittedFiles } from './utils';

View file

@ -0,0 +1,25 @@
"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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./builders/webpack"), exports);
__exportStar(require("./builders/webpack-dev-server"), exports);

View file

@ -0,0 +1,18 @@
/**
* @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 { Compilation, Configuration } from 'webpack';
export interface EmittedFiles {
id?: string;
name?: string;
file: string;
initial: boolean;
asset?: boolean;
extension: string;
}
export declare function getEmittedFiles(compilation: Compilation): EmittedFiles[];
export declare function getWebpackConfig(configPath: string): Promise<Configuration>;

View file

@ -0,0 +1,112 @@
"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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWebpackConfig = exports.getEmittedFiles = void 0;
const fs_1 = require("fs");
const path = __importStar(require("path"));
const url_1 = require("url");
function getEmittedFiles(compilation) {
const files = [];
const chunkFileNames = new Set();
// adds all chunks to the list of emitted files such as lazy loaded modules
for (const chunk of compilation.chunks) {
for (const file of chunk.files) {
if (chunkFileNames.has(file)) {
continue;
}
chunkFileNames.add(file);
files.push({
id: chunk.id?.toString(),
name: chunk.name,
file,
extension: path.extname(file),
initial: chunk.isOnlyInitial(),
});
}
}
// add all other files
for (const file of Object.keys(compilation.assets)) {
// Chunk files have already been added to the files list above
if (chunkFileNames.has(file)) {
continue;
}
files.push({ file, extension: path.extname(file), initial: false, asset: true });
}
return files;
}
exports.getEmittedFiles = getEmittedFiles;
/**
* This uses a dynamic import to load a module which may be ESM.
* CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
* will currently, unconditionally downlevel dynamic import into a require call.
* require calls cannot load ESM code and will result in a runtime error. To workaround
* this, a Function constructor is used to prevent TypeScript from changing the dynamic import.
* Once TypeScript provides support for keeping the dynamic import this workaround can
* be dropped.
*
* @param modulePath The path of the module to load.
* @returns A Promise that resolves to the dynamically imported module.
*/
function loadEsmModule(modulePath) {
return new Function('modulePath', `return import(modulePath);`)(modulePath);
}
async function getWebpackConfig(configPath) {
if (!(0, fs_1.existsSync)(configPath)) {
throw new Error(`Webpack configuration file ${configPath} does not exist.`);
}
switch (path.extname(configPath)) {
case '.mjs':
// Load the ESM configuration file using the TypeScript dynamic import workaround.
// Once TypeScript provides support for keeping the dynamic import this workaround can be
// changed to a direct dynamic import.
return (await loadEsmModule((0, url_1.pathToFileURL)(configPath))).default;
case '.cjs':
return require(configPath);
default:
// The file could be either CommonJS or ESM.
// CommonJS is tried first then ESM if loading fails.
try {
return require(configPath);
}
catch (e) {
if (e.code === 'ERR_REQUIRE_ESM') {
// Load the ESM configuration file using the TypeScript dynamic import workaround.
// Once TypeScript provides support for keeping the dynamic import this workaround can be
// changed to a direct dynamic import.
return (await loadEsmModule((0, url_1.pathToFileURL)(configPath)))
.default;
}
throw e;
}
}
}
exports.getWebpackConfig = getWebpackConfig;