anl 26.225.0 → 26.304.0
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../utils/index.cjs`),n=require(`./utils.cjs`);let r=require(`child_process`),i=require(`fs`);i=e.__toESM(i);let a=require(`path`);a=e.__toESM(a);const o=async()=>{let e=
|
|
1
|
+
const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../utils/index.cjs`),n=require(`./utils.cjs`);let r=require(`child_process`),i=require(`fs`);i=e.__toESM(i);let a=require(`path`);a=e.__toESM(a);const o=async()=>{let e=__dirname,o=process.cwd(),s=a.default.join(e,`.gitscripts`),c=a.default.join(o,`.gitscripts`);await n.pathExists(s)?(await n.copyDirectoryRecursive(s,c),t.log.success(`.gitscripts create done.`)):t.log.error(`source directory ${s} does not exist`);for(let r of[`.gitconfig`,`.commit-type.cjs`]){let i=a.default.join(e,r),s=a.default.join(o,r);await n.pathExists(i)?await n.copyFileIfMissing(i,s):t.log.error(`source file ${i} does not exist`)}try{i.default.chmodSync(a.default.join(c,`random-branch.sh`),493),t.log.success(`random-branch.sh Raise power`)}catch(e){console.log(e),t.log.error(`Set .githooks/commit-msg executable permission failed: ${e instanceof Error?e.message:String(e)}`)}try{(0,r.execSync)(`git config --local include.path ../.gitconfig`,{stdio:`ignore`}),t.log.success(`.gitconfig git set`)}catch(e){console.log(e),t.log.error(`Execute git config --local include.path ../.gitconfig failed, please execute the command manually`)}},s=async()=>{let e=a.default.join(__dirname,`.githooks`),o=process.cwd(),s=a.default.join(o,`.githooks`);if(!await n.pathExists(e)){t.log.error(`source directory ${e} does not exist`);return}await n.copyDirectoryRecursive(e,s),t.log.success(`.githooks create done.`);try{i.default.chmodSync(a.default.join(s,`commit-msg`),493),t.log.success(`commit-msg raise power done.`)}catch(e){console.log(e),t.log.error(`Set .githooks/commit-msg executable permission failed: ${e instanceof Error?e.message:String(e)}`)}try{(0,r.execSync)(`git config core.hooksPath .githooks`,{stdio:`ignore`}),t.log.success(`git set .githooks done.`)}catch(e){console.log(e),t.log.error(`Execute [git config core.hooksPath .githooks] failed, please execute the command manually`)}},c=async()=>{let e=__dirname,r=process.cwd(),i=a.default.join(e,`.gitattributes`),o=a.default.join(r,`.gitattributes`);if(!await n.pathExists(i)){t.log.error(`source file ${i} does not exist`);return}await n.copyFileIfMissing(i,o)},l=async(e=[])=>{e.includes(`gitflow`)&&await o(),e.includes(`commitSubject`)&&await s(),e.includes(`customGitCommand`)&&await c(),console.log(`
|
|
2
2
|
`),t.log.warning(`please run [git nb] command to create a new branch.`),console.log(`
|
|
3
3
|
`)};exports.gitHandle=l;
|
package/lib/package.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`26.
|
|
1
|
+
var e=`26.304.0`;Object.defineProperty(exports,`version`,{enumerable:!0,get:function(){return e}});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const e=require(`../../utils/index.cjs`),t=require(`../shared/format.cjs`),n=require(`../shared/naming.cjs`),r=require(`../shared/schema-utils.cjs`),i=require(`./enum-parser.cjs`);var a=class{schemas;config;requiredFieldSet=new Set;defaultReturn={headerRef:``,renderStr:``,comment:``,typeName:``};enumParser;schemasMap=new Map;constructor(e,t){this.schemas=e,this.config=t,this.enumParser=new i.EnumParser(t)}nullable(e){return r.nullableSuffix(e)}isRequired(e){return this.requiredFieldSet.has(e)}stringifyValue(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}buildDocComment(e,n){let r=t.getIndentation(this.config),i=[]
|
|
2
|
-
`).forEach(e=>i.push(e)),`deprecated`in e&&e.deprecated&&i.push(`@deprecated`),`default`in e&&e.default!==void 0&&i.push(`@default ${this.stringifyValue(e.default)}`),`example`in e&&e.example!==void 0&&i.push(`@example ${this.stringifyValue(e.example)}`),`format`in e&&e.format&&i.push(`@format ${e.format}`);let
|
|
3
|
-
`))return`${r}/** ${i[0]} */`;let
|
|
1
|
+
const e=require(`../../utils/index.cjs`),t=require(`../shared/format.cjs`),n=require(`../shared/naming.cjs`),r=require(`../shared/schema-utils.cjs`),i=require(`./enum-parser.cjs`);var a=class{schemas;config;requiredFieldSet=new Set;defaultReturn={headerRef:``,renderStr:``,comment:``,typeName:``};enumParser;schemasMap=new Map;constructor(e,t){this.schemas=e,this.config=t,this.enumParser=new i.EnumParser(t)}nullable(e){return r.nullableSuffix(e)}isRequired(e){return this.requiredFieldSet.has(e)}stringifyValue(e){if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}buildDocComment(e,n){let r=t.getIndentation(this.config),i=[],a=e,o=a.title,s=a.description;o&&i.push(`@title ${o}`),s&&s.split(`
|
|
2
|
+
`).forEach((e,t)=>i.push(t===0?`@description ${e}`:e)),`deprecated`in e&&e.deprecated&&i.push(`@deprecated`),`default`in e&&e.default!==void 0&&i.push(`@default ${this.stringifyValue(e.default)}`),`example`in e&&e.example!==void 0&&i.push(`@example ${this.stringifyValue(e.example)}`),`format`in e&&e.format&&i.push(`@format ${e.format}`);let c=[[`pattern`,`@pattern`],[`minimum`,`@minimum`],[`maximum`,`@maximum`],[`exclusiveMinimum`,`@exclusiveMinimum`],[`exclusiveMaximum`,`@exclusiveMaximum`],[`minLength`,`@minLength`],[`maxLength`,`@maxLength`],[`minItems`,`@minItems`],[`maxItems`,`@maxItems`]],l=e;if(c.some(([e])=>l[e]!==void 0)){let e=c.map(([e,t])=>l[e]===void 0?``:`${t} ${this.stringifyValue(l[e])}`).filter(Boolean);i.push(...e)}if(!i.length)return``;if(i.length===1&&!i[0].includes(`
|
|
3
|
+
`))return`${r}/** ${i[0]} */`;let u=[`${r}/**`];return i.forEach(e=>{e&&(e.includes(`
|
|
4
4
|
`)?e.split(`
|
|
5
|
-
`).forEach(e=>
|
|
6
|
-
`)}nameTheHumpCenterStroke(e){let t=e.replace(`#/components/schemas/`,``),r={typeName:
|
|
5
|
+
`).forEach(e=>u.push(`${r} * ${e}`)):u.push(`${r} * ${e}`))}),u.push(`${r} */`),u.join(`
|
|
6
|
+
`)}nameTheHumpCenterStroke(e){let t=e.replace(`#/components/schemas/`,``),r=n.resolveSchemaName(t),i={typeName:r,fileName:n.typeNameToFileName(r),dataType:``};if(this.schemas){let e=this.schemas[t];e?.enum?i.dataType=`enum`:i.dataType=e?.type}return i}parseRef(e){if(!e?.trim())return{headerRefStr:``,typeName:``,dataType:``};let{fileName:t,typeName:r,dataType:i=``}=this.nameTheHumpCenterStroke(e),a;return a=i===`enum`?`import type { ${n.getEnumTypeName(this.config,r)} } from '${this.config.importEnumPath}';`:`import type { ${r} } from './${t}';`,{headerRefStr:a,typeName:r,dataType:i}}parseArray(r,i){let a=r,{items:o={},nullable:s}=a,c=o?.$ref;if(c){let{headerRefStr:r,typeName:o,dataType:l}=this.parseRef(c),u=a.example;if(l===`enum`&&typeof u==`string`&&e.isValidJSON(u)){let e=this.enumParser.convertJsonToEnumString(u,o);this.enumParser.addEnumByName(o,e)}let d=l===`enum`?n.getEnumTypeName(this.config,o):o;return{headerRef:r,renderStr:`${t.getIndentation(this.config)}${i}${this.isRequired(i)?``:`?`}: Array<${d}>${this.nullable(s)};`,typeName:d}}let l=o?.type,u=l===`integer`?`number`:l;return l===`object`&&(u=`Record<string, unknown>`),{headerRef:``,renderStr:`${t.getIndentation(this.config)}${i}${this.isRequired(i)?``:`?`}: Array<${u}>${this.nullable(s)};`,typeName:u}}parseBoolean(e,n){return e.type===`boolean`?`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: boolean${this.nullable(e.nullable)};`:``}parseInteger(e,n){return Array.isArray(e.enum)?this.enumParser.handleEnum(e,n,this.isRequired(n))?.renderStr??``:`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: number${this.nullable(e.nullable)};`}parseNumber(e,n){if(e.type!==`number`)return null;if(e.enum){let t=this.enumParser.handleEnum(e,n,this.isRequired(n));if(t)return t}return{headerRef:``,renderStr:`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: number${this.nullable(e.nullable)};`}}getStringTypeByFormat(e){if(!e)return`string`;switch(e){case`date-time`:case`date`:case`time`:return`Date`;case`email`:case`idn-email`:case`uuid`:case`uri`:case`uri-reference`:case`iri`:case`iri-reference`:case`hostname`:case`idn-hostname`:case`ipv4`:case`ipv6`:return`string`;case`binary`:return`File`;default:return`string`}}parseString(e,n){if(e.type!==`string`)return null;if(e.enum){let t=this.enumParser.handleEnum(e,n,this.isRequired(n));if(t)return t}let r=this.getStringTypeByFormat(e.format);return{headerRef:``,renderStr:`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: ${r}${this.nullable(e.nullable)};`}}parseObject(e,n){let r=``,i=``;if(e.type===`object`){let a=e;if(typeof a.additionalProperties==`object`){let e=this.parseArray(a.additionalProperties,n)??this.defaultReturn;r=e?.headerRef??``,i=e?.renderStr??``}i=typeof a.additionalProperties==`boolean`?`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: Record<string, unknown>${this.nullable(a.nullable)};`:`${t.getIndentation(this.config)}${n}${this.isRequired(n)?``:`?`}: ${e.type}${this.nullable(e.nullable)};`}return{headerRef:r,renderStr:i}}parseProperties(r,i){let a=[],o=[];if(!r)return{headerRef:``,renderStr:`export interface ${i} {}`};let s=Object.keys(r).sort();for(let c of s){let s=r[c];if(s?.$ref){let{headerRefStr:r,typeName:l,dataType:u}=this.parseRef(s.$ref);!o.includes(r)&&l!==i&&o.push(r);let d=s,f=this.buildDocComment(d,c);f!==``&&a.push(f);let p=u===`enum`?n.getEnumTypeName(this.config,l):l;a.push(`${t.getIndentation(this.config)}${c}${this.isRequired(c)?``:`?`}: ${p};`);let m=s.example;if(u===`enum`&&m&&e.isValidJSON(m)){let e=this.enumParser.convertJsonToEnumString(m,l);this.enumParser.addEnumByName(l,e)}continue}if(`allOf`in s){let e=s.allOf?.[0];if(e?.$ref){let{headerRefStr:r,typeName:l,dataType:u}=this.parseRef(e.$ref),d=u===`enum`?n.getEnumTypeName(this.config,l):l;!o.includes(r)&&l!==i&&o.push(r);let f=s,p=this.buildDocComment(f,c);p!==``&&a.push(p),a.push(`${t.getIndentation(this.config)}${c}${this.isRequired(c)?``:`?`}: ${d}${this.nullable(s.nullable)};`);continue}}let l=s,u=this.buildDocComment(l,c);switch(u!==``&&a.push(u),l.type){case`array`:{let e=this.parseArray(l,c)??this.defaultReturn;a.push(e?.renderStr??``),!o.includes(e.headerRef)&&i!==e.typeName&&o.push(e.headerRef)}break;case`boolean`:a.push(this.parseBoolean(l,c));break;case`integer`:a.push(this.parseInteger(l,c));break;case`number`:{let e=this.parseNumber(l,c);e&&(e.headerRef&&!o.includes(e.headerRef)&&o.push(e.headerRef),a.push(e.renderStr))}break;case`string`:if(l.enum){let e=this.enumParser.handleEnum(l,c,this.isRequired(c));e&&(e.headerRef&&!o.includes(e.headerRef)&&o.push(e.headerRef),e.renderStr&&a.push(e.renderStr))}else a.push(this.parseString(l,c)?.renderStr??``);break;case`object`:{let{headerRef:e,renderStr:t}=this.parseObject(l,c)??this.defaultReturn;a.push(t),o.includes(e)||o.push(e)}break}}let c=[`export interface ${i} {`,...a,`}`];if(o.length>0){let e=o.filter(e=>e!==``);e.length>0&&e.push(``),c.unshift(...e)}let l=c.join(`
|
|
7
7
|
`);return{headerRef:o.join(`
|
|
8
|
-
`),renderStr:l}}generateContent(e,t){if(`items`in e)return console.warn(`数组类型未处理: ${t}`,e.items),``;switch(e.type){case`boolean`:return this.parseBoolean(e,t);case`integer`:return this.parseInteger(e,t);case`number`:return this.parseNumber(e,t)?.renderStr??``;case`object`:return this.parseProperties(e.properties,t)?.renderStr??``;case`string`:return this.parseString(e,t)?.renderStr??``;default:return``}}main(){if(!this.schemas)return console.warn(`schemas 为空`),{enumsMap:this.enumParser.enumsMap,schemasMap:this.schemasMap};let e=Object.keys(this.schemas).sort();for(let t of e){let e=this.schemas[t];if(`$ref`in e){console.warn(`跳过 ReferenceObject: ${t}`);continue}let r=`type`in e?e:null;if(!r?.type){console.warn(`无效的 schema 对象: ${t}`);continue}if(Array.isArray(e.enum)){let n=this.enumParser.parseEnum(e,
|
|
8
|
+
`),renderStr:l}}generateContent(e,t){if(`items`in e)return console.warn(`数组类型未处理: ${t}`,e.items),``;switch(e.type){case`boolean`:return this.parseBoolean(e,t);case`integer`:return this.parseInteger(e,t);case`number`:return this.parseNumber(e,t)?.renderStr??``;case`object`:return this.parseProperties(e.properties,t)?.renderStr??``;case`string`:return this.parseString(e,t)?.renderStr??``;default:return``}}main(){if(!this.schemas)return console.warn(`schemas 为空`),{enumsMap:this.enumParser.enumsMap,schemasMap:this.schemasMap};let e=Object.keys(this.schemas).sort();for(let t of e){let e=this.schemas[t];if(`$ref`in e){console.warn(`跳过 ReferenceObject: ${t}`);continue}let r=`type`in e?e:null;if(!r?.type){console.warn(`无效的 schema 对象: ${t}`);continue}if(Array.isArray(e.enum)){let r=n.resolveSchemaName(t),i=this.enumParser.parseEnum(e,r);i?.renderStr&&!this.enumParser.hasEnum(r)&&this.enumParser.addEnumByName(r,i.renderStr);continue}this.requiredFieldSet=new Set(e.required??[]);let i=n.resolveSchemaName(t),a=n.typeNameToFileName(i),o=this.generateContent(r,i);o&&((o.includes(`export enum `)||o.includes(`export const `)&&o.includes(`as const`))&&!this.enumParser.hasEnum(i)?this.enumParser.addEnumByName(i,o):this.schemasMap.set(i,{fileName:a,content:o}))}return{enumsMap:this.enumParser.enumsMap,schemasMap:this.schemasMap}}};exports.ComponentSchemaResolver=a;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const e=require(`../shared/format.cjs`),t=require(`../shared/naming.cjs`),n=require(`../shared/schema-utils.cjs`),r=require(`../shared/http.cjs`),i={schemas:`#/components/schemas/`,parameters:`#/components/parameters/`,definitions:`#/definitions/`};var a=class{config;schemas;parameters;referenceCache=new Map;handleError;constructor(e,t,n,r){this.config=e,this.schemas=t??{},this.parameters=n??{},this.handleError=r}stringifySchemaResult(t){if(Array.isArray(t)){let n=e.getLineEnding(this.config),r=e.getIndentation(this.config);return`{${n}${t.join(n)}${n}${r}}`}return t}handleComplexType(e){try{return e.oneOf?e.oneOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` | `):e.allOf?e.allOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` & `):e.anyOf?e.anyOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` | `):e.enum?e.type===`number`||e.type===`integer`?e.enum.join(` | `):e.enum.map(e=>`'${e}'`).join(` | `):`unknown`}catch(e){return this.handleError({type:`SCHEMA`,message:`Failed to handle complex type`,details:e}),`unknown`}}referenceObjectParse(e){try{let n=e.$ref,r=this.referenceCache.get(n);if(r)return r;let a=n;n.startsWith(i.schemas)&&(a=n.replace(i.schemas,``)),n.startsWith(i.parameters)&&(a=n.replace(i.parameters,``)),n.startsWith(i.definitions)&&(a=n.replace(i.definitions,``));let o=t.
|
|
2
|
-
`)}}>`:`Array<${e}>`}return``}propertiesParse(e){return n.formatObjectProperties(e,this.config,e=>this.main(e))}transformResponseModel(t,n){if(!n)return t;try{switch(n.type){case`unwrap`:{let e=n.dataField??`data`;if(Array.isArray(t))return this.handleError({type:`RESPONSE`,message:`Response model unwrap is not supported for inline object response types`}),t;let r=/^import\('([^']+)'\)\.(\w+)$/.exec(t);if(r){let[,t,n]=r,i=this.schemas?.[
|
|
1
|
+
const e=require(`../shared/format.cjs`),t=require(`../shared/naming.cjs`),n=require(`../shared/schema-utils.cjs`),r=require(`../shared/http.cjs`),i={schemas:`#/components/schemas/`,parameters:`#/components/parameters/`,definitions:`#/definitions/`};var a=class{config;schemas;parameters;referenceCache=new Map;resolvedToOriginalName=new Map;handleError;constructor(e,t,n,r){this.config=e,this.schemas=t??{},this.parameters=n??{},this.handleError=r}stringifySchemaResult(t){if(Array.isArray(t)){let n=e.getLineEnding(this.config),r=e.getIndentation(this.config);return`{${n}${t.join(n)}${n}${r}}`}return t}handleComplexType(e){try{return e.oneOf?e.oneOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` | `):e.allOf?e.allOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` & `):e.anyOf?e.anyOf.map(e=>this.stringifySchemaResult(this.main(e))).join(` | `):e.enum?e.type===`number`||e.type===`integer`?e.enum.join(` | `):e.enum.map(e=>`'${e}'`).join(` | `):`unknown`}catch(e){return this.handleError({type:`SCHEMA`,message:`Failed to handle complex type`,details:e}),`unknown`}}referenceObjectParse(e){try{let n=e.$ref,r=this.referenceCache.get(n);if(r)return r;let a=n;n.startsWith(i.schemas)&&(a=n.replace(i.schemas,``)),n.startsWith(i.parameters)&&(a=n.replace(i.parameters,``)),n.startsWith(i.definitions)&&(a=n.replace(i.definitions,``));let o=t.resolveSchemaName(a),s=t.typeNameToFileName(o),c=this.schemas?.[a];t.containsChinese(a)&&this.resolvedToOriginalName.set(o,a);let l=!1;if(c&&!(`$ref`in c)){let e=`properties`in c||c.type===`object`,t=c.type===`array`||`items`in c;`enum`in c&&Array.isArray(c.enum)&&!e&&!t&&(l=!0)}else l=/Enum$/i.test(a);let u=l?t.getEnumTypeName(this.config,o):o,d=l?`import('${this.config.importEnumPath}/${s}').${u}`:`import('../models/${s}').${o}`;return this.referenceCache.set(n,d),d}catch(e){return this.handleError({type:`REFERENCE`,message:`Failed to parse reference object`,details:e}),`unknown`}}nonArraySchemaObjectParse(e){if(!e)return`unknown`;if(e.format===`binary`||e.type===`string`&&e.format===`binary`)return`File`;switch(e.type){case`boolean`:return`boolean`;case`integer`:case`number`:return`number`;case`object`:return this.propertiesParse(e.properties);case`string`:return e.format===`binary`?`File`:`string`;default:return`unknown`}}arraySchemaObjectParse(e){if(e.type!==`array`)return``;let{items:t}=e,n=`$ref`in t?t:null,r=t;if(n)return`Array<${this.referenceObjectParse(n)}>`;if(r){let e=this.main(t);return Array.isArray(e)?`Array<{${e.join(`
|
|
2
|
+
`)}}>`:`Array<${e}>`}return``}propertiesParse(e){return n.formatObjectProperties(e,this.config,e=>this.main(e))}transformResponseModel(t,n){if(!n)return t;try{switch(n.type){case`unwrap`:{let e=n.dataField??`data`;if(Array.isArray(t))return this.handleError({type:`RESPONSE`,message:`Response model unwrap is not supported for inline object response types`}),t;let r=/^import\('([^']+)'\)\.(\w+)$/.exec(t);if(r){let[,t,n]=r,i=this.resolvedToOriginalName.get(n)??n,a=this.schemas?.[i];if(a&&!(`$ref`in a)){let t=a;if(t.properties?.[e]){let n=t.properties[e];return this.main(n)}else this.handleError({type:`RESPONSE`,message:`Field "${e}" not found in response type "${n}"`})}}return t}case`wrap`:{if(!n.wrapperFields)return this.handleError({type:`RESPONSE`,message:`wrapperFields is required when using wrap transform`}),t;let r=e.getIndentation(this.config),i=r+r,a=[],o=n.dataField??`data`;for(let[e,r]of Object.entries(n.wrapperFields))if(e===o)if(Array.isArray(t)){let n=t.join(`
|
|
3
3
|
`);a.push(`${i}${e}?: {${n}\n${i}};`)}else a.push(`${i}${e}?: ${t};`);else a.push(`${i}${e}?: ${r};`);return a}case`replace`:return n.wrapperType?n.wrapperType:(this.handleError({type:`RESPONSE`,message:`wrapperType is required when using replace transform`}),t);default:return t}}catch(e){return this.handleError({type:`RESPONSE`,message:`Failed to transform response model`,details:e}),t}}responseObjectParse(e){try{let t=e.content;if(!t)return``;let n;for(let e of r.SUPPORTED_REQUEST_TYPES_ALL)if(t[e]?.schema){n=t[e].schema;break}return n?this.main(n):``}catch(e){return this.handleError({type:`RESPONSE`,message:`Failed to parse response object`,details:e}),``}}main(e){try{if(!e)return`unknown`;if(`oneOf`in e||`allOf`in e||`anyOf`in e||`enum`in e)return this.handleComplexType(e);if(`$ref`in e)return this.referenceObjectParse(e);let t=e,r=t.type,i=n.nullableSuffix(t.nullable),a=n.applyTypeMapping(this.config,t);if(a)return a;if(r===`array`&&t.items)return n.stringifyArrayType(this.main(t.items),this.config);if(r===`object`||typeof t==`object`){if(t.properties){let e=this.propertiesParse(t.properties);return e.length?e:[`unknown`]}if(t.additionalProperties===!0)return`Record<string, unknown>`+i;if(typeof t.additionalProperties==`object`)return`Record<string, ${this.main(t.additionalProperties)}>`+i}return`unknown`}catch(e){return this.handleError({type:`SCHEMA`,message:`Failed to parse schema`,details:e}),`unknown`}}};exports.SchemaResolver=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e.replace(/_/g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase().replace(/-+/g,`-`)}function
|
|
1
|
+
require(`../../_virtual/rolldown_runtime.cjs`);let e=require(`pinyin-pro`);function t(e){return/[\u4e00-\u9fff]/.test(e)}function n(n){return t(n)?(n.match(/[\u4e00-\u9fff]+|[^\u4e00-\u9fff]+/g)??[]).map(n=>t(n)?(0,e.pinyin)(n,{toneType:`none`,type:`array`}).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``):n).join(``):n}function r(e){return t(e)?n(e):e}function i(e){return e.replace(/_/g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase().replace(/-+/g,`-`)}function a(e,t){return e.enmuConfig.erasableSyntaxOnly?`${t}Type`:t}function o(e){return!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function s(e){return o(e)?`"${e}"`:e}exports.containsChinese=t,exports.formatPropertyName=s,exports.getEnumTypeName=a,exports.resolveSchemaName=r,exports.typeNameToFileName=i;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anl",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.304.0",
|
|
4
4
|
"description": "FE command line tool",
|
|
5
5
|
"main": "bin/an-cli.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "rimraf lib && tsdown",
|
|
13
13
|
"pub": "bash publish.sh",
|
|
14
14
|
"ts": "tsc ./src/int.ts --noEmit --watch",
|
|
15
|
-
"blink": "
|
|
15
|
+
"blink": "pnpm run build && pnpm link",
|
|
16
16
|
"docs": "docsify serve ./docs"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"inquirer": "^10.1.8",
|
|
59
59
|
"log-symbols": "^5.1.0",
|
|
60
60
|
"ora": "5.*",
|
|
61
|
+
"pinyin-pro": "^3.28.0",
|
|
61
62
|
"progress-estimator": "^0.3.0",
|
|
62
63
|
"shelljs": "^0.8.5"
|
|
63
64
|
},
|
|
@@ -97,7 +98,6 @@
|
|
|
97
98
|
"url": "git+https://github.com/bianliuzhu/an-cli.git"
|
|
98
99
|
},
|
|
99
100
|
"homepage": "https://bianliuzhu.github.io/an-cli/#/",
|
|
100
|
-
"type": "commonjs",
|
|
101
101
|
"lint-staged": {
|
|
102
102
|
"*.{ts,js,mjs,cjs}": [
|
|
103
103
|
"eslint --fix"
|