first commit

This commit is contained in:
2024-01-19 11:09:11 +01:00
commit b18af7a943
29473 changed files with 4500547 additions and 0 deletions

10
node_modules/@angular-devkit/build-webpack/src/index.d.ts generated vendored Executable file
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 './webpack';
export * from './webpack-dev-server';
export { EmittedFiles } from './utils';

25
node_modules/@angular-devkit/build-webpack/src/index.js generated vendored Executable file
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("./webpack"), exports);
__exportStar(require("./webpack-dev-server"), exports);

18
node_modules/@angular-devkit/build-webpack/src/utils.d.ts generated vendored Executable file
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>;

112
node_modules/@angular-devkit/build-webpack/src/utils.js generated vendored Executable file
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;

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"]
}