@mercurjs/cli 2.0.0-canary.94 → 2.0.0-canary.95
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 R from'path';import R__default,{join,basename}from'path';import et from'prompts';import {z as z$1}from'zod';import $t,{promises,existsSync,readFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import'typescript';import nt from'fast-glob';import {createHash}from'crypto';import ir from'deepmerge';import*as L from'fs/promises';import L__default,{writeFile,rm}from'fs/promises';import vo,{tmpdir,homedir}from'os';import {Project,ScriptKind}from'ts-morph';import le from'kleur';import Yi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {exec,execSync}from'child_process';import {Readable}from'stream';import {pipeline}from'stream/promises';import Et from'pg';import gs from'open';import {x as x$1}from'tar';import hs from'terminal-link';import vs from'validate-npm-package-name';import ws from'wait-on';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk';var Ft={version:"2.0.0-canary.
|
|
2
|
+
import {Command}from'commander';import*as R from'path';import R__default,{join,basename}from'path';import et from'prompts';import {z as z$1}from'zod';import $t,{promises,existsSync,readFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import'typescript';import nt from'fast-glob';import {createHash}from'crypto';import ir from'deepmerge';import*as L from'fs/promises';import L__default,{writeFile,rm}from'fs/promises';import vo,{tmpdir,homedir}from'os';import {Project,ScriptKind}from'ts-morph';import le from'kleur';import Yi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {exec,execSync}from'child_process';import {Readable}from'stream';import {pipeline}from'stream/promises';import Et from'pg';import gs from'open';import {x as x$1}from'tar';import hs from'terminal-link';import vs from'validate-npm-package-name';import ws from'wait-on';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk';var Ft={version:"2.0.0-canary.95"};var Ot="MISSING_DIR_OR_EMPTY_PROJECT",S="MISSING_CONFIG",z="BUILD_MISSING_REGISTRY_FILE";var ai=z$1.enum(["registry:api","registry:vendor","registry:admin"]),Nt=z$1.object({path:z$1.string(),content:z$1.string().optional(),type:ai,target:z$1.string().optional()}),At=z$1.object({$schema:z$1.string().optional(),name:z$1.string(),title:z$1.string().optional(),author:z$1.string().min(2).optional(),description:z$1.string().optional(),dependencies:z$1.array(z$1.string()).optional(),devDependencies:z$1.array(z$1.string()).optional(),registryDependencies:z$1.array(z$1.string()).optional(),meta:z$1.record(z$1.string(),z$1.any()).optional(),docs:z$1.string().optional(),categories:z$1.array(z$1.string()).optional()}),T=At.extend({files:z$1.array(Nt)}),H=z$1.object({name:z$1.string(),homepage:z$1.string(),items:z$1.array(T)}),tn=z$1.array(At),Lt=T.pick({dependencies:true,devDependencies:true,files:true,docs:true}),di=z$1.union([z$1.string(),z$1.object({url:z$1.string(),params:z$1.record(z$1.string(),z$1.string()).optional(),headers:z$1.record(z$1.string(),z$1.string()).optional()})]),Mt=z$1.record(z$1.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @mercurjs)"}),di);var De="https://registry.mercurjs.com/registry.json",zt="https://registry.mercurjs.com/registry-item.json",ge=process.env.REGISTRY_URL??"https://raw.githubusercontent.com/mercurjs/mercur/new/packages/registry/r",I={"@mercurjs":`${ge}/{name}.json`};var $={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"},_=class extends Error{code;statusCode;context;suggestion;timestamp;cause;constructor(t,r={}){super(t),this.name="RegistryError",this.code=r.code||$.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);}},ie=class extends _{constructor(r,i){let o=`The item at ${r} was not found. It may not exist at the registry.`;super(o,{code:$.NOT_FOUND,statusCode:404,cause:i,context:{url:r},suggestion:"Check if the item name is correct and the registry URL is accessible."});this.url=r;this.name="RegistryNotFoundError";}},Fe=class extends _{constructor(r,i){let o=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(o,{code:$.UNAUTHORIZED,statusCode:401,cause:i,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}},Oe=class extends _{constructor(r,i){let o=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(o,{code:$.FORBIDDEN,statusCode:403,cause:i,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},Ne=class extends _{constructor(r,i,o,s){let n=i?`Failed to fetch from registry (${i}): ${r}`:`Failed to fetch from registry: ${r}`,p=typeof s=="string"&&s?`${n} - ${s}`:n,m="Check your network connection and try again.";i===404?m="The requested resource was not found. Check the URL or item name.":i===500?m="The registry server encountered an error. Try again later.":i&&i>=400&&i<500&&(m="There was a client error. Check your request parameters.");super(p,{code:$.FETCH_ERROR,statusCode:i,cause:s,context:{url:r,responseBody:o},suggestion:m});this.url=r;this.responseBody=o;this.name="RegistryFetchError";}},Y=class extends _{constructor(r){let i=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]"
|