@mercurjs/cli 2.0.0-canary.21 → 2.0.0-canary.23
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 +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {Command}from'commander';import*as k from'path';import k__default,{join,basename}from'path';import lt from'prompts';import {z as z$1}from'zod';import {promises,existsSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import'typescript';import st from'fast-glob';import {createHash}from'crypto';import or from'deepmerge';import*as L from'fs/promises';import L__default from'fs/promises';import go,{tmpdir,homedir}from'os';import {Project,ScriptKind}from'ts-morph';import le from'kleur';import Gi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {exec,execSync}from'child_process';import Qo from'chokidar';import {Readable}from'stream';import {pipeline}from'stream/promises';import St from'pg';import fs from'open';import {x as x$1}from'tar';import ys from'terminal-link';import hs from'validate-npm-package-name';import ws from'wait-on';var Ot={version:"2.0.0-canary.
|
|
2
|
+
import {Command}from'commander';import*as k from'path';import k__default,{join,basename}from'path';import lt from'prompts';import {z as z$1}from'zod';import {promises,existsSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import'typescript';import st from'fast-glob';import {createHash}from'crypto';import or from'deepmerge';import*as L from'fs/promises';import L__default from'fs/promises';import go,{tmpdir,homedir}from'os';import {Project,ScriptKind}from'ts-morph';import le from'kleur';import Gi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {exec,execSync}from'child_process';import Qo from'chokidar';import {Readable}from'stream';import {pipeline}from'stream/promises';import St from'pg';import fs from'open';import {x as x$1}from'tar';import ys from'terminal-link';import hs from'validate-npm-package-name';import ws from'wait-on';var Ot={version:"2.0.0-canary.23"};var Nt="MISSING_DIR_OR_EMPTY_PROJECT",S="MISSING_CONFIG",z="BUILD_MISSING_REGISTRY_FILE";var Xr=z$1.enum(["registry:workflow","registry:api","registry:link","registry:module","registry:vendor","registry:admin","registry:lib"]),At=z$1.object({path:z$1.string(),content:z$1.string().optional(),type:Xr,target:z$1.string().optional()}),Lt=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=Lt.extend({files:z$1.array(At)}),Y=z$1.object({name:z$1.string(),homepage:z$1.string(),items:z$1.array(T)}),Ks=z$1.array(Lt),Mt=T.pick({dependencies:true,devDependencies:true,files:true,docs:true}),ei=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()})]),Ut=z$1.record(z$1.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @mercurjs)"}),ei);var $e="https://registry.mercurjs.com/registry.json",zt="https://registry.mercurjs.com/registry-item.json",fe=process.env.REGISTRY_URL??"https://raw.githubusercontent.com/mercurjs/mercur/new/packages/registry/r",I={"@mercurjs":`${fe}/{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);}},oe=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";}},De=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";}},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:$.FORBIDDEN,statusCode:403,cause:i,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}},Oe=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";}},J=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]"
|