Primeiro commit do projeto Angular

This commit is contained in:
2026-03-14 20:41:55 +00:00
parent 9bebe1de72
commit 94f4f46395
22413 changed files with 3221690 additions and 0 deletions
File diff suppressed because it is too large Load Diff
+56
View File
@@ -0,0 +1,56 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var path = require('node:path');
var node_fs = require('node:fs');
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
const defaultCacheDir = "node_modules/.vite";
function viteBasicSslPlugin(options) {
return {
name: "vite:basic-ssl",
async configResolved(config) {
const certificate = await getCertificate(
options?.certDir ?? (config.cacheDir ?? defaultCacheDir) + "/basic-ssl",
options?.name,
options?.domains
);
const https = () => ({ cert: certificate, key: certificate });
if (config.server.https === void 0 || !!config.server.https) {
config.server.https = Object.assign({}, config.server.https, https());
}
if (config.preview.https === void 0 || !!config.preview.https) {
config.preview.https = Object.assign({}, config.preview.https, https());
}
}
};
}
async function getCertificate(cacheDir, name, domains) {
const cachePath = path__default.join(cacheDir, "_cert.pem");
try {
const [stat, content] = await Promise.all([
node_fs.promises.stat(cachePath),
node_fs.promises.readFile(cachePath, "utf8")
]);
if (Date.now() - stat.ctime.valueOf() > 30 * 24 * 60 * 60 * 1e3) {
throw new Error("cache is outdated.");
}
return content;
} catch {
const content = (await import('./chunks/certificate.mjs')).createCertificate(
name,
domains
);
node_fs.promises.mkdir(cacheDir, { recursive: true }).then(() => node_fs.promises.writeFile(cachePath, content)).catch(() => {
});
return content;
}
}
module.exports = viteBasicSslPlugin;
module.exports["default"] = viteBasicSslPlugin;
module.exports.getCertificate = getCertificate;
+13
View File
@@ -0,0 +1,13 @@
import { Plugin } from 'vite';
interface Options {
certDir: string;
domains: string[];
name: string;
}
declare function viteBasicSslPlugin(options?: Partial<Options>): Plugin;
declare function getCertificate(cacheDir: string, name?: string, domains?: string[]): Promise<string>;
// @ts-ignore
export = viteBasicSslPlugin;
export { getCertificate };
+11
View File
@@ -0,0 +1,11 @@
import { Plugin } from 'vite';
interface Options {
certDir: string;
domains: string[];
name: string;
}
declare function viteBasicSslPlugin(options?: Partial<Options>): Plugin;
declare function getCertificate(cacheDir: string, name?: string, domains?: string[]): Promise<string>;
export { viteBasicSslPlugin as default, getCertificate };
+13
View File
@@ -0,0 +1,13 @@
import { Plugin } from 'vite';
interface Options {
certDir: string;
domains: string[];
name: string;
}
declare function viteBasicSslPlugin(options?: Partial<Options>): Plugin;
declare function getCertificate(cacheDir: string, name?: string, domains?: string[]): Promise<string>;
// @ts-ignore
export = viteBasicSslPlugin;
export { getCertificate };
+46
View File
@@ -0,0 +1,46 @@
import path from 'node:path';
import { promises } from 'node:fs';
const defaultCacheDir = "node_modules/.vite";
function viteBasicSslPlugin(options) {
return {
name: "vite:basic-ssl",
async configResolved(config) {
const certificate = await getCertificate(
options?.certDir ?? (config.cacheDir ?? defaultCacheDir) + "/basic-ssl",
options?.name,
options?.domains
);
const https = () => ({ cert: certificate, key: certificate });
if (config.server.https === void 0 || !!config.server.https) {
config.server.https = Object.assign({}, config.server.https, https());
}
if (config.preview.https === void 0 || !!config.preview.https) {
config.preview.https = Object.assign({}, config.preview.https, https());
}
}
};
}
async function getCertificate(cacheDir, name, domains) {
const cachePath = path.join(cacheDir, "_cert.pem");
try {
const [stat, content] = await Promise.all([
promises.stat(cachePath),
promises.readFile(cachePath, "utf8")
]);
if (Date.now() - stat.ctime.valueOf() > 30 * 24 * 60 * 60 * 1e3) {
throw new Error("cache is outdated.");
}
return content;
} catch {
const content = (await import('./chunks/certificate.mjs')).createCertificate(
name,
domains
);
promises.mkdir(cacheDir, { recursive: true }).then(() => promises.writeFile(cachePath, content)).catch(() => {
});
return content;
}
}
export { viteBasicSslPlugin as default, getCertificate };