@mercurjs/cli 2.2.0-canary.44 → 2.2.0-canary.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {Command}from'commander';import*as v from'path';import v__default,{join,basename}from'path';import ft from'prompts';import {z}from'zod';import Et,{promises,existsSync,readFileSync,mkdirSync,writeFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import ut from'fs-extra';import Qe from'fast-glob';import Ds,{createHash}from'crypto';import Vt from'deepmerge';import*as $ from'fs/promises';import $__default,{writeFile,rm}from'fs/promises';import As,{homedir,tmpdir}from'os';import {Project,ScriptKind}from'ts-morph';import Re from'kleur';import Fo from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {execSync}from'child_process';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk/vite';var vt={version:"2.2.0-canary.
|
|
2
|
+
import {Command}from'commander';import*as v from'path';import v__default,{join,basename}from'path';import ft from'prompts';import {z}from'zod';import Et,{promises,existsSync,readFileSync,mkdirSync,writeFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import ut from'fs-extra';import Qe from'fast-glob';import Ds,{createHash}from'crypto';import Vt from'deepmerge';import*as $ from'fs/promises';import $__default,{writeFile,rm}from'fs/promises';import As,{homedir,tmpdir}from'os';import {Project,ScriptKind}from'ts-morph';import Re from'kleur';import Fo from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {execSync}from'child_process';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk/vite';var vt={version:"2.2.0-canary.45"};var It="MISSING_DIR_OR_EMPTY_PROJECT",C="MISSING_CONFIG",A="BUILD_MISSING_REGISTRY_FILE";var Gr=z.enum(["registry:api","registry:vendor","registry:admin"]),bt=z.object({path:z.string(),content:z.string().optional(),type:Gr,target:z.string().optional()}),St=z.object({$schema:z.string().optional(),name:z.string(),title:z.string().optional(),author:z.string().min(2).optional(),description:z.string().optional(),dependencies:z.array(z.string()).optional(),devDependencies:z.array(z.string()).optional(),registryDependencies:z.array(z.string()).optional(),meta:z.record(z.string(),z.any()).optional(),docs:z.string().optional(),categories:z.array(z.string()).optional()}),T=St.extend({files:z.array(bt)}),Y=z.object({name:z.string(),homepage:z.string(),items:z.array(T)}),Sn=z.array(St),kt=T.pick({dependencies:true,devDependencies:true,files:true,docs:true}),Vr=z.union([z.string(),z.object({url:z.string(),params:z.record(z.string(),z.string()).optional(),headers:z.record(z.string(),z.string()).optional()})]),Ct=z.record(z.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @mercurjs)"}),Vr);var _e="https://registry.mercurjs.com/registry.json",Pt="https://registry.mercurjs.com/registry-item.json",ue=process.env.REGISTRY_URL??"https://raw.githubusercontent.com/mercurjs/mercur/main/packages/registry/r",P={"@mercurjs":`${ue}/{name}.json`};var j={NOT_FOUND:"NOT_FOUND",UNAUTHORIZED:"UNAUTHORIZED",FORBIDDEN:"FORBIDDEN",FETCH_ERROR:"FETCH_ERROR",NOT_CONFIGURED:"NOT_CONFIGURED",INVALID_CONFIG:"INVALID_CONFIG",MISSING_ENV_VARS:"MISSING_ENV_VARS",LOCAL_FILE_ERROR:"LOCAL_FILE_ERROR",PARSE_ERROR:"PARSE_ERROR",VALIDATION_ERROR:"VALIDATION_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},I=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||j.UNKNOWN_ERROR,this.statusCode=r.statusCode,this.cause=r.cause,this.context=r.context,this.suggestion=r.suggestion,this.timestamp=new Date,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor);}},re=class extends I{constructor(r,o){let s=`The item at ${r} was not found. It may not exist at the registry.`;super(s,{code:j.NOT_FOUND,statusCode:404,cause:o,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}url},Te=class extends I{constructor(r,o){let s=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(s,{code:j.UNAUTHORIZED,statusCode:401,cause:o,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}url},je=class extends I{constructor(r,o){let s=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(s,{code:j.FORBIDDEN,statusCode:403,cause:o,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}url},Fe=class extends I{constructor(r,o,s,n){let i=o?`Failed to fetch from registry (${o}): ${r}`:`Failed to fetch from registry: ${r}`,f=typeof n=="string"&&n?`${i} - ${n}`:i,c="Check your network connection and try again.";o===404?c="The requested resource was not found. Check the URL or item name.":o===500?c="The registry server encountered an error. Try again later.":o&&o>=400&&o<500&&(c="There was a client error. Check your request parameters.");super(f,{code:j.FETCH_ERROR,statusCode:o,cause:n,context:{url:r,responseBody:s},suggestion:c});this.url=r;this.responseBody=s;this.name="RegistryFetchError";}url;responseBody},J=class extends I{constructor(r){let o=r?`Unknown registry "${r}". Make sure it is defined in agents.json as follows:
|
|
3
3
|
{
|
|
4
4
|
"registries": {
|
|
5
5
|
"${r}": "[URL_TO_REGISTRY]"
|