@mercurjs/cli 2.2.0-canary.2 → 2.2.0-canary.3
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 R from'path';import R__default,{join,basename}from'path';import De from'prompts';import {z}from'zod';import Lt,{promises,existsSync,readFileSync,mkdirSync,writeFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import dt from'fast-glob';import {createHash}from'crypto';import mr from'deepmerge';import*as U from'fs/promises';import U__default,{writeFile,rm}from'fs/promises';import {homedir,tmpdir}from'os';import {Project,ScriptKind}from'ts-morph';import F from'kleur';import mi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {spawn,execSync}from'child_process';import hs from'cross-spawn';import {packageDirectory}from'pkg-dir';import fs from'resolve-cwd';import {Readable}from'stream';import {pipeline}from'stream/promises';import $t from'pg';import Ws from'open';import {x as x$1}from'tar';import Vs from'terminal-link';import Ys from'validate-npm-package-name';import qs from'wait-on';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk';var Ae={version:"2.2.0-canary.
|
|
2
|
+
import {Command}from'commander';import*as R from'path';import R__default,{join,basename}from'path';import De from'prompts';import {z}from'zod';import Lt,{promises,existsSync,readFileSync,mkdirSync,writeFileSync,statSync}from'fs';import {cosmiconfig}from'cosmiconfig';import {loadConfig,createMatchPath}from'tsconfig-paths';import A from'fs-extra';import dt from'fast-glob';import {createHash}from'crypto';import mr from'deepmerge';import*as U from'fs/promises';import U__default,{writeFile,rm}from'fs/promises';import {homedir,tmpdir}from'os';import {Project,ScriptKind}from'ts-morph';import F from'kleur';import mi from'ora';import {execa}from'execa';import {detect}from'@antfu/ni';import {diffLines}from'diff';import {spawn,execSync}from'child_process';import hs from'cross-spawn';import {packageDirectory}from'pkg-dir';import fs from'resolve-cwd';import {Readable}from'stream';import {pipeline}from'stream/promises';import $t from'pg';import Ws from'open';import {x as x$1}from'tar';import Vs from'terminal-link';import Ys from'validate-npm-package-name';import qs from'wait-on';import {builtinModules}from'module';import {generatePluginEntryModule}from'@mercurjs/dashboard-sdk';var Ae={version:"2.2.0-canary.3"};var zt="MISSING_DIR_OR_EMPTY_PROJECT",E="MISSING_CONFIG",B="BUILD_MISSING_REGISTRY_FILE";var Ro=z.enum(["registry:api","registry:vendor","registry:admin"]),Bt=z.object({path:z.string(),content:z.string().optional(),type:Ro,target:z.string().optional()}),Wt=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=Wt.extend({files:z.array(Bt)}),K=z.object({name:z.string(),homepage:z.string(),items:z.array(T)}),Pn=z.array(Wt),Gt=T.pick({dependencies:true,devDependencies:true,files:true,docs:true}),xo=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()})]),Vt=z.record(z.string().refine(e=>e.startsWith("@"),{message:"Registry names must start with @ (e.g., @mercurjs)"}),xo);var Le="https://registry.mercurjs.com/registry.json",Yt="https://registry.mercurjs.com/registry-item.json",we=process.env.REGISTRY_URL??"https://raw.githubusercontent.com/mercurjs/mercur/canary/packages/registry/r",I={"@mercurjs":`${we}/{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"},S=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);}},ae=class extends S{constructor(r,o){let i=`The item at ${r} was not found. It may not exist at the registry.`;super(i,{code:$.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},Ue=class extends S{constructor(r,o){let i=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(i,{code:$.UNAUTHORIZED,statusCode:401,cause:o,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryUnauthorizedError";}url},ze=class extends S{constructor(r,o){let i=`You are not authorized to access the item at ${r}. If this is a remote registry, you may need to authenticate.`;super(i,{code:$.FORBIDDEN,statusCode:403,cause:o,context:{url:r},suggestion:"Check your authentication credentials and environment variables."});this.url=r;this.name="RegistryForbiddenError";}url},Be=class extends S{constructor(r,o,i,s){let n=o?`Failed to fetch from registry (${o}): ${r}`:`Failed to fetch from registry: ${r}`,m=typeof s=="string"&&s?`${n} - ${s}`:n,p="Check your network connection and try again.";o===404?p="The requested resource was not found. Check the URL or item name.":o===500?p="The registry server encountered an error. Try again later.":o&&o>=400&&o<500&&(p="There was a client error. Check your request parameters.");super(m,{code:$.FETCH_ERROR,statusCode:o,cause:s,context:{url:r,responseBody:i},suggestion:p});this.url=r;this.responseBody=i;this.name="RegistryFetchError";}url;responseBody},Z=class extends S{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]"
|