penambahan web socket

This commit is contained in:
2025-09-18 19:01:22 +07:00
parent 1d053646a9
commit d7bb2eb5bb
15070 changed files with 2402916 additions and 0 deletions

No files matched your search

@@ -0,0 +1,51 @@
import { promises } from 'node:fs';
import { hash } from 'ohash';
import { resolve, dirname } from 'pathe';
import { l as logger } from './cli.B9AmABr3.mjs';
import { r as rmRecursive } from './cli.pLQ0oPGc.mjs';
async function cleanupNuxtDirs(rootDir, buildDir) {
logger.info("Cleaning up generated Nuxt files and caches...");
await rmRecursive(
[
buildDir,
".output",
"dist",
"node_modules/.vite",
"node_modules/.cache"
].map((dir) => resolve(rootDir, dir))
);
}
function nuxtVersionToGitIdentifier(version) {
const id = /\.([0-9a-f]{7,8})$/.exec(version);
if (id?.[1]) {
return id[1];
}
return `v${version}`;
}
function resolveNuxtManifest(nuxt) {
const manifest = {
_hash: null,
project: {
rootDir: nuxt.options.rootDir
},
versions: {
nuxt: nuxt._version
}
};
manifest._hash = hash(manifest);
return manifest;
}
async function writeNuxtManifest(nuxt, manifest = resolveNuxtManifest(nuxt)) {
const manifestPath = resolve(nuxt.options.buildDir, "nuxt.json");
await promises.mkdir(dirname(manifestPath), { recursive: true });
await promises.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
return manifest;
}
async function loadNuxtManifest(buildDir) {
const manifestPath = resolve(buildDir, "nuxt.json");
const manifest = await promises.readFile(manifestPath, "utf-8").then((data) => JSON.parse(data)).catch(() => null);
return manifest;
}
export { cleanupNuxtDirs as c, loadNuxtManifest as l, nuxtVersionToGitIdentifier as n, resolveNuxtManifest as r, writeNuxtManifest as w };
@@ -0,0 +1,5 @@
import { consola } from 'consola';
const logger = consola.withTag("nuxi");
export { logger as l };
@@ -0,0 +1,14 @@
import process from 'node:process';
import { l as logger } from './cli.B9AmABr3.mjs';
function overrideEnv(targetEnv) {
const currentEnv = process.env.NODE_ENV;
if (currentEnv && currentEnv !== targetEnv) {
logger.warn(
`Changing \`NODE_ENV\` from \`${currentEnv}\` to \`${targetEnv}\`, to avoid unintended behavior.`
);
}
process.env.NODE_ENV = targetEnv;
}
export { overrideEnv as o };
@@ -0,0 +1,7 @@
import { execSync } from 'node:child_process';
function getPackageManagerVersion(name) {
return execSync(`${name} --version`).toString("utf8").trim();
}
export { getPackageManagerVersion as g };
@@ -0,0 +1,204 @@
import { resolve } from 'node:path';
import process from 'node:process';
import { defineCommand, runMain as runMain$1, runCommand as runCommand$1 } from 'citty';
import { provider } from 'std-env';
import { consola } from 'consola';
import { l as logger } from './cli.B9AmABr3.mjs';
import { fileURLToPath } from 'node:url';
const _rDefault = (r) => r.default || r;
const commands = {
add: () => import('../chunks/add2.mjs').then(_rDefault),
analyze: () => import('../chunks/analyze.mjs').then(_rDefault),
build: () => import('../chunks/build.mjs').then(_rDefault),
cleanup: () => import('../chunks/cleanup.mjs').then(_rDefault),
_dev: () => import('../chunks/dev-child.mjs').then(_rDefault),
dev: () => import('../chunks/dev.mjs').then(_rDefault),
devtools: () => import('../chunks/devtools.mjs').then(_rDefault),
generate: () => import('../chunks/generate.mjs').then(_rDefault),
info: () => import('../chunks/info.mjs').then(_rDefault),
init: () => import('../chunks/init.mjs').then(_rDefault),
module: () => import('../chunks/index2.mjs').then(_rDefault),
prepare: () => import('../chunks/prepare.mjs').then(_rDefault),
preview: () => import('../chunks/preview.mjs').then(_rDefault),
start: () => import('../chunks/preview.mjs').then(_rDefault),
test: () => import('../chunks/test.mjs').then(_rDefault),
typecheck: () => import('../chunks/typecheck.mjs').then(_rDefault),
upgrade: () => import('../chunks/upgrade.mjs').then(_rDefault)
};
const cwdArgs = {
cwd: {
type: "string",
description: "Specify the working directory",
valueHint: "directory",
default: "."
}
};
const logLevelArgs = {
logLevel: {
type: "string",
description: "Specify build-time log level",
valueHint: "silent|info|verbose"
}
};
const envNameArgs = {
envName: {
type: "string",
description: "The environment to use when resolving configuration overrides (default is `production` when building, and `development` when running the dev server)"
}
};
const dotEnvArgs = {
dotenv: {
type: "string",
description: "Path to `.env` file to load, relative to the root directory"
}
};
const extendsArgs = {
extends: {
type: "string",
description: "Extend from a Nuxt layer",
valueHint: "layer-name",
alias: ["e"]
}
};
const legacyRootDirArgs = {
// cwd falls back to rootDir's default (indirect default)
cwd: {
...cwdArgs.cwd,
description: "Specify the working directory, this takes precedence over ROOTDIR (default: `.`)",
default: void 0
},
rootDir: {
type: "positional",
description: "Specifies the working directory (default: `.`)",
required: false,
default: "."
}
};
function wrapReporter(reporter) {
return {
log(logObj, ctx) {
if (!logObj.args || !logObj.args.length) {
return;
}
const msg = logObj.args[0];
if (typeof msg === "string" && !process.env.DEBUG) {
if (msg.startsWith(
"[Vue Router warn]: No match found for location with path"
)) {
return;
}
if (msg.includes(
"ExperimentalWarning: The Fetch API is an experimental feature"
)) {
return;
}
if (msg.startsWith("Sourcemap") && msg.includes("node_modules")) {
return;
}
}
return reporter.log(logObj, ctx);
}
};
}
function setupGlobalConsole(opts = {}) {
consola.options.reporters = consola.options.reporters.map(wrapReporter);
if (opts.dev) {
consola.wrapAll();
} else {
consola.wrapConsole();
}
process.on("unhandledRejection", (err) => consola.error("[unhandledRejection]", err));
process.on("uncaughtException", (err) => consola.error("[uncaughtException]", err));
}
async function checkEngines() {
const satisfies = await import('semver/functions/satisfies.js').then(
(r) => r.default || r
);
const currentNode = process.versions.node;
const nodeRange = ">= 18.0.0";
if (!satisfies(currentNode, nodeRange)) {
logger.warn(
`Current version of Node.js (\`${currentNode}\`) is unsupported and might cause issues.
Please upgrade to a compatible version \`${nodeRange}\`.`
);
}
}
const name = "@nuxt/cli";
const version = "3.28.0";
const description = "Nuxt CLI";
const main = defineCommand({
meta: {
name: name.endsWith("nightly") ? name : "nuxi",
version,
description
},
args: {
...cwdArgs,
command: {
type: "positional",
required: false
}
},
subCommands: commands,
async setup(ctx) {
const command = ctx.args._[0];
const dev = command === "dev";
setupGlobalConsole({ dev });
let backgroundTasks;
if (command !== "_dev" && provider !== "stackblitz") {
backgroundTasks = Promise.all([
checkEngines()
]).catch((err) => logger.error(err));
}
if (command === "init") {
await backgroundTasks;
}
if (ctx.args.command && !(ctx.args.command in commands)) {
const cwd = resolve(ctx.args.cwd);
try {
const { x } = await import('tinyexec');
await x(`nuxt-${ctx.args.command}`, ctx.rawArgs.slice(1), {
nodeOptions: { stdio: "inherit", cwd },
throwOnError: true
});
} catch (err) {
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
return;
}
}
process.exit();
}
}
});
globalThis.__nuxt_cli__ = globalThis.__nuxt_cli__ || {
// Programmatic usage fallback
startTime: Date.now(),
entry: fileURLToPath(
new URL("../../bin/nuxi.mjs", import.meta.url)
),
devEntry: fileURLToPath(
new URL("../dev/index.mjs", import.meta.url)
)
};
const runMain = () => runMain$1(main);
async function runCommand(name, argv = process.argv.slice(2), data = {}) {
argv.push("--no-clear");
if (!(name in commands)) {
throw new Error(`Invalid command ${name}`);
}
return await runCommand$1(await commands[name](), {
rawArgs: argv,
data: {
overrides: data.overrides || {}
}
});
}
export { logLevelArgs as a, envNameArgs as b, cwdArgs as c, dotEnvArgs as d, extendsArgs as e, commands as f, checkEngines as g, runMain as h, legacyRootDirArgs as l, main as m, runCommand as r, setupGlobalConsole as s };
@@ -0,0 +1,37 @@
import { parseINI } from 'confbox';
import { $fetch } from 'ofetch';
import { satisfies } from 'semver';
async function fetchModules() {
const { modules } = await $fetch(
`https://api.nuxt.com/modules?version=all`
);
return modules;
}
function checkNuxtCompatibility(module, nuxtVersion) {
if (!module.compatibility?.nuxt) {
return true;
}
return satisfies(nuxtVersion, module.compatibility.nuxt, {
includePrerelease: true
});
}
function getRegistryFromContent(content, scope) {
try {
const npmConfig = parseINI(content);
if (scope) {
const scopeKey = `${scope}:registry`;
if (npmConfig[scopeKey]) {
return npmConfig[scopeKey].trim();
}
}
if (npmConfig.registry) {
return npmConfig.registry.trim();
}
return null;
} catch {
return null;
}
}
export { checkNuxtCompatibility as c, fetchModules as f, getRegistryFromContent as g };
@@ -0,0 +1,14 @@
import { readPackageJSON } from 'pkg-types';
import { coerce } from 'semver';
async function getNuxtVersion(cwd, cache = true) {
const nuxtPkg = await readPackageJSON("nuxt", { url: cwd, try: true, cache });
if (nuxtPkg) {
return nuxtPkg.version;
}
const pkg = await readPackageJSON(cwd);
const pkgDep = pkg?.dependencies?.nuxt || pkg?.devDependencies?.nuxt;
return pkgDep && coerce(pkgDep)?.version || "3.0.0";
}
export { getNuxtVersion as g };
@@ -0,0 +1,5 @@
const name = "nuxi";
const version = "3.28.0";
const description = "Nuxt CLI";
export { description as d, name as n, version as v };
@@ -0,0 +1,27 @@
import { readFileSync } from 'node:fs';
import { colors } from 'consola/utils';
import { resolveModulePath } from 'exsolve';
import { t as tryResolveNuxt } from './cli.qKvs7FJ2.mjs';
import { l as logger } from './cli.B9AmABr3.mjs';
function showVersions(cwd) {
const { bold, gray, green } = colors;
const nuxtDir = tryResolveNuxt(cwd);
function getPkgVersion(pkg) {
for (const url of [cwd, nuxtDir]) {
if (!url) {
continue;
}
const p = resolveModulePath(`${pkg}/package.json`, { from: url, try: true });
if (p) {
return JSON.parse(readFileSync(p, "utf-8")).version;
}
}
return "";
}
const nuxtVersion = getPkgVersion("nuxt") || getPkgVersion("nuxt-nightly") || getPkgVersion("nuxt3") || getPkgVersion("nuxt-edge");
const nitroVersion = getPkgVersion("nitropack") || getPkgVersion("nitropack-nightly") || getPkgVersion("nitropack-edge");
logger.log(gray(green(`Nuxt ${bold(nuxtVersion)}`) + (nitroVersion ? ` with Nitro ${bold(nitroVersion)}` : "")));
}
export { showVersions as s };
@@ -0,0 +1,33 @@
import { promises, existsSync } from 'node:fs';
import { join } from 'pathe';
import { l as logger } from './cli.B9AmABr3.mjs';
async function clearDir(path, exclude) {
if (!exclude) {
await promises.rm(path, { recursive: true, force: true });
} else if (existsSync(path)) {
const files = await promises.readdir(path);
await Promise.all(
files.map(async (name) => {
if (!exclude.includes(name)) {
await promises.rm(join(path, name), { recursive: true, force: true });
}
})
);
}
await promises.mkdir(path, { recursive: true });
}
function clearBuildDir(path) {
return clearDir(path, ["cache", "analyze", "nuxt.json"]);
}
async function rmRecursive(paths) {
await Promise.all(
paths.filter((p) => typeof p === "string").map(async (path) => {
logger.debug("Removing recursive path", path);
await promises.rm(path, { recursive: true, force: true }).catch(() => {
});
})
);
}
export { clearBuildDir as a, clearDir as c, rmRecursive as r };
@@ -0,0 +1,36 @@
import { pathToFileURL } from 'node:url';
import { resolveModulePath } from 'exsolve';
async function loadKit(rootDir) {
try {
const kitPath = resolveModulePath("@nuxt/kit", { from: tryResolveNuxt(rootDir) || rootDir });
let kit = await import(pathToFileURL(kitPath).href);
if (!kit.writeTypes) {
kit = {
...kit,
writeTypes: () => {
throw new Error("`writeTypes` is not available in this version of `@nuxt/kit`. Please upgrade to v3.7 or newer.");
}
};
}
return kit;
} catch (e) {
if (e.toString().includes("Cannot find module '@nuxt/kit'")) {
throw new Error(
"nuxi requires `@nuxt/kit` to be installed in your project. Try installing `nuxt` v3+ or `@nuxt/bridge` first."
);
}
throw e;
}
}
function tryResolveNuxt(rootDir) {
for (const pkg of ["nuxt-nightly", "nuxt", "nuxt3", "nuxt-edge"]) {
const path = resolveModulePath(pkg, { from: rootDir, try: true });
if (path) {
return path;
}
}
return null;
}
export { loadKit as l, tryResolveNuxt as t };
@@ -0,0 +1,83 @@
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { defineCommand, runCommand as runCommand$1 } from 'citty';
import { f as commands, c as cwdArgs, s as setupGlobalConsole, g as checkEngines } from './cli.CTXRG5Cu.mjs';
import nodeCrypto from 'node:crypto';
import { resolve } from 'node:path';
import { provider } from 'std-env';
import { d as description, v as version, n as name } from './cli.DhJ3cH8w.mjs';
import { l as logger } from './cli.B9AmABr3.mjs';
if (!globalThis.crypto) {
globalThis.crypto = nodeCrypto.webcrypto;
}
defineCommand({
meta: {
name: name.endsWith("nightly") ? name : "nuxi",
version,
description
},
args: {
...cwdArgs,
command: {
type: "positional",
required: false
}
},
subCommands: commands,
async setup(ctx) {
const command = ctx.args._[0];
logger.debug(`Running \`nuxt ${command}\` command`);
const dev = command === "dev";
setupGlobalConsole({ dev });
let backgroundTasks;
if (command !== "_dev" && provider !== "stackblitz") {
backgroundTasks = Promise.all([
checkEngines()
]).catch((err) => logger.error(err));
}
if (command === "init") {
await backgroundTasks;
}
if (ctx.args.command && !(ctx.args.command in commands)) {
const cwd = resolve(ctx.args.cwd);
try {
const { x } = await import('tinyexec');
await x(`nuxt-${ctx.args.command}`, ctx.rawArgs.slice(1), {
nodeOptions: { stdio: "inherit", cwd },
throwOnError: true
});
} catch (err) {
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
return;
}
}
process.exit();
}
}
});
globalThis.__nuxt_cli__ = globalThis.__nuxt_cli__ || {
// Programmatic usage fallback
startTime: Date.now(),
entry: fileURLToPath(
new URL("../../bin/nuxi.mjs", import.meta.url)
),
devEntry: fileURLToPath(
new URL("../dev/index.mjs", import.meta.url)
)
};
async function runCommand(name, argv = process.argv.slice(2), data = {}) {
argv.push("--no-clear");
if (!(name in commands)) {
throw new Error(`Invalid command ${name}`);
}
return await runCommand$1(await commands[name](), {
rawArgs: argv,
data: {
overrides: data.overrides || {}
}
});
}
export { runCommand as r };