heading-case 1.1.8 → 2.0.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.
- package/README.md +58 -8
- package/bin.js +2 -2
- package/dist/cli.d.ts +5 -0
- package/dist/cli.js +2659 -0
- package/dist/core.d.ts +6 -0
- package/dist/core.js +123 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +49 -2822
- package/dist/rslib-runtime.js +42 -0
- package/package.json +21 -15
package/dist/core.d.ts
ADDED
package/dist/core.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var abbreviates_namespaceObject = /*#__PURE__*/ JSON.parse('{"abi":"ABI","amd":"AMD","api":"API","ast":"AST","bom":"BOM","bsd":"BSD","cdn":"CDN","cjs":"CJS","cli":"CLI","cncf":"CNCF","cors":"CORS","cpu":"CPU","crud":"CRUD","csrf":"CSRF","css":"CSS","csv":"CSV","db2":"DB2","dns":"DNS","dom":"DOM","dos":"DOS","es6":"ES6","esm":"ESM","fbi":"FBI","ftp":"FTP","ftps":"FTPS","gcc":"GCC","gcp":"GCP","glsl":"GLSL","gorm":"GORM","gpl":"GPL","gps":"GPS","gpu":"GPU","gre":"GRE","gui":"GUI","hdmi":"HDMI","hmr":"HMR","html":"HTML","http":"HTTP","https":"HTTPS","iife":"IIFE","iot":"IoT","ipc":"IPC","ipfs":"IPFS","ipmi":"IPMI","jdbc":"JDBC","jdk":"JDK","jit":"JIT","jpeg":"JPEG","jpg":"JPG","jre":"JRE","jsf":"JSF","json":"JSON","jsonp":"JSONP","jsp":"JSP","jwt":"JWT","kcp":"KCP","kde":"KDE","kpi":"KPI","lfu":"LFU","llvm":"LLVM","lru":"LRU","lts":"LTS","mdn":"MDN","mdx":"MDX","mvc":"MVC","mvp":"MVP","mvvm":"MVVM","nft":"NFT","odbc":"ODBC","ont":"ONT","orm":"ORM","oss":"OSS","pdf":"PDF","pdo":"PDO","posix":"POSIX","pwa":"PWA","qemu":"QEMU","qgis":"QGIS","quic":"QUIC","rfc":"RFC","rom":"ROM","rpc":"RPC","rss":"RSS","rss3":"RSS3","sdk":"SDK","seo":"SEO","sip":"SIP","smtp":"SMTP","sql":"SQL","sre":"SRE","ssg":"SSG","ssh":"SSH","sso":"SSO","ssr":"SSR","stp":"STP","svg":"SVG","svn":"SVN","tcp":"TCP","tls":"TLS","toml":"TOML","tsc":"TSC","udp":"UDP","umd":"UMD","uri":"URI","url":"URL","usb":"USB","vlan":"VLAN","vnc":"VNC","vpn":"VPN","vps":"VPS","wgsl":"WGSL","wlan":"WLAN","wsa":"WSA","wsl":"WSL","xhtml":"XHTML","xml":"XML","xss":"XSS","yaml":"YAML"}');
|
|
2
|
+
var brands_namespaceObject = /*#__PURE__*/ JSON.parse('{"airbnb":"Airbnb","alphago":"AlphaGo","bitbucket":"Bitbucket","bytedance":"ByteDance","circleci":"CircleCI","cloudflare":"Cloudflare","freecodecamp":"freeCodeCamp","gitea":"Gitea","gitee":"Gitee","github":"GitHub","gitlab":"GitLab","gitops":"GitOps","gitpod":"Gitpod","hp":"HP","ibm":"IBM","jsdelivr":"jsDelivr","kfc":"KFC","leetcode":"LeetCode","linkedin":"LinkedIn","mcdonald":"McDonald","nvidia":"NVIDIA","pagerduty":"PagerDuty","producthunt":"Product Hunt","stackblitz":"StackBlitz","stackit":"STACKIT","stackoverflow":"Stack Overflow","unjs":"UnJS","v2ex":"V2EX","vuefes":"Vue Fes","youtube":"YouTube"}');
|
|
3
|
+
var general_namespaceObject = /*#__PURE__*/ JSON.parse('{"aiaas":"AIaaS","baas":"BaaS","caas":"CaaS","daas":"DaaS","ddos":"DDoS","devops":"DevOps","devtools":"DevTools","esim":"eSIM","faas":"FaaS","iac":"IaC","iaas":"IaaS","ioc":"IoC","ipsec":"IPsec","mpaas":"mPaaS","paas":"PaaS","saas":"SaaS","wifi":"Wi-Fi","xaas":"XaaS"}');
|
|
4
|
+
var products_namespaceObject = /*#__PURE__*/ JSON.parse('{"airdrop":"AirDrop","airpods":"AirPods","airtag":"AirTag","homekit":"HomeKit","homepod":"HomePod","imac":"iMac","ipad":"iPad","iphone":"iPhone","ipod":"iPod","macbook":"MacBook","macbook air":"MacBook Air","macbook pro":"MacBook Pro","yubikey":"YubiKey"}');
|
|
5
|
+
var softwares_namespaceObject = /*#__PURE__*/ JSON.parse('{"1password":"1Password","3dtiles":"3DTiles","actionscript":"ActionScript","adblock":"AdBlock","ajax":"AJAX","alipay":"Alipay","amap":"AMap","angularjs":"AngularJS","ant design":"Ant Design","ant design vue":"Ant Design Vue","antd":"AntD","antdesign":"AntDesign","antdesignvue":"AntDesignVue","antv":"AntV","apifox":"Apifox","app store":"App Store","apple pay":"Apple Pay","applescript":"AppleScript","appletalk":"AppleTalk","arangodb":"ArangoDB","arcgis":"ArcGIS","arcmap":"ArcMap","arcobjects":"ArcObjects","beego":"Beego","bittorrent":"BitTorrent","bluesky":"Bluesky","busybox":"BusyBox","centos":"CentOS","cesiumjs":"CesiumJS","chatgpt":"ChatGPT","citygml":"CityGML","cityjson":"CityJSON","ckeditor":"CKEditor","clashx":"ClashX","clickhouse":"ClickHouse","cloudfront":"CloudFront","cmake":"CMake","cockroachdb":"CockroachDB","cocoapods":"CocoaPods","codepen":"CodePen","codesandbox":"CodeSandbox","coffeescript":"CoffeeScript","commonjs":"CommonJS","composition api":"Composition API","compositionapi":"CompositionAPI","coredns":"CoreDNS","css modules":"CSS Modules","dapr":"Dapr","datadog":"Datadog","datagrip":"DataGrip","dbase":"dBase","definitelytyped":"DefinitelyTyped","denodeploy":"DenoDeploy","digital ocean":"DigitalOcean","digitalocean":"DigitalOcean","dingtalk":"DingTalk","directx":"DirectX","django":"Django","duckduckgo":"DuckDuckGo","dynamodb":"DynamoDB","echarts":"ECharts","ecmascript":"ECMAScript","edgedb":"EdgeDB","eggjs":"Egg.js","elasticsearch":"Elasticsearch","element plus":"Element Plus","elementui":"ElementUI","esbuild":"esbuild","eslint":"ESLint","esxi":"ESXi","etcd":"etcd","facetime":"FaceTime","fastapi":"FastAPI","ffmpeg":"FFmpeg","filezilla":"FileZilla","firefox":"Firefox","freemarker":"FreeMarker","gdnative":"GDNative","gdscript":"GDScript","geforce":"GeForce","geojson":"GeoJSON","geopackage":"GeoPackage","geopandas":"GeoPandas","geoserver":"GeoServer","gitbook":"GitBook","gitkraken":"GitKraken","gltf":"glTF","gnome":"GNOME","gnu":"GNU","gnupg":"GnuPG","goland":"GoLand","google pay":"Google Pay","graph rag":"Graph RAG","graphql":"GraphQL","graphrag":"GraphRAG","greensock":"GreenSock","grpc":"gRPC","hackernews":"Hacker News","hacpai":"HacPai","hbase":"HBase","hbuilderx":"HBuilderX","ibook":"iBook","icloud":"iCloud","idrac":"iDRAC","ilo":"iLO","imessage":"iMessage","imovie":"iMovie","imtoken":"imToken","influxdb":"InfluxDB","intellij":"IntelliJ","intellij idea":"IntelliJ IDEA","ios":"iOS","ipados":"iPadOS","iphoto":"iPhoto","iscsi":"iSCSI","iterm":"iTerm","itunes":"iTunes","iwork":"iWork","javascript":"JavaScript","jetbrains":"JetBrains","jquery":"jQuery","jsdoc":"JSDoc","jupyterlab":"JupyterLab","katex":"KaTeX","kubernetes":"Kubernetes","latex":"LaTeX","less":"Less","libreoffice":"LibreOffice","line pay":"LINE Pay","lineageos":"LineageOS","macos":"macOS","mariadb":"MariaDB","markdown":"Markdown","markdownlint":"MarkdownLint","mathjax":"MathJax","mathml":"MathML","mathtype":"MathType","matlab":"MATLAB","mediawiki":"MediaWiki","memcached":"Memcached","messagepack":"MessagePack","metamask":"MetaMask","mkdocs":"MkDocs","mlaas":"MLaaS","mlops":"MLOps","mobx":"MobX","mongodb":"MongoDB","mongoose":"Mongoose","ms-dos":"MS-DOS","mybatis":"MyBatis","mysql":"MySQL","naive ui":"Naive UI","naiveui":"NaiveUI","neo4j":"Neo4j","nestjs":"NestJS","netbeans":"NetBeans","netbios":"NetBIOS","nextjs":"Next.js","nixos":"NixOS","nocodb":"NocoDB","node.js":"Node.js","nosql":"NoSQL","notepad ++":"Notepad++","npm":"npm","numpy":"NumPy","nuxtjs":"NuxtJS","oauth":"OAuth","obs":"OBS","ocaml":"OCaml","onedrive":"OneDrive","onenote":"OneNote","openai":"OpenAI","openapi":"OpenAPI","opencv":"OpenCV","openfaas":"OpenFaaS","openflow":"OpenFlow","opengauss":"openGauss","opengl":"OpenGL","opengl es":"OpenGL ES","openjdk":"OpenJDK","openlayers":"OpenLayers","openpgp":"OpenPGP","opensea":"OpenSea","openssl":"OpenSSL","openstack":"OpenStack","openstreetmap":"OpenStreetMap","opensuse":"openSUSE","openvino":"OpenVINO","openwrt":"OpenWrt","opnsense":"OPNsense","pagp":"PAgP","paypal":"PayPal","photoshop":"Photoshop","php":"PHP","phpstorm":"PhpStorm","pihole":"Pi-hole","planetscale":"PlanetScale","postcss":"PostCSS","postgis":"PostGIS","postgresql":"PostgreSQL","potplayer":"PotPlayer","powerpoint":"PowerPoint","powershell":"PowerShell","premid":"PreMiD","primevue":"PrimeVue","protobuf":"Protobuf","pycharm":"PyCharm","pytorch":"PyTorch","qtscript":"QtScript","raii":"RAII","react native":"React Native","redhat":"RedHat","redisearch":"RediSearch","redisjson":"RedisJSON","rescript":"ReScript","restful":"RESTful","rethinkdb":"RethinkDB","rsshub":"RSSHub","rust":"Rust","rxdb":"RxDB","rxjs":"RxJS","samsung pay":"Samsung Pay","sass":"Sass","scss":"SCSS","segmentfault":"SegmentFault","socket.io":"Socket.IO","solarwinds":"SolarWinds","spatiallite":"SpatialLite","spir-v":"SPIR-V","springboot":"SpringBoot","springcloud":"SpringCloud","springmvc":"SpringMVC","sqlite":"SQLite","sqlserver":"SQLServer","storybook":"Storybook","stylus":"Stylus","sublime text":"Sublime Text","surrealdb":"SurrealDB","sveltekit":"SvelteKit","tailwind css":"Tailwind CSS","tailwindcss":"TailwindCSS","teamviewer":"TeamViewer","tensorflow":"TensorFlow","testflight":"TestFlight","tex":"TeX","threejs":"ThreeJS","tianocore":"TianoCore","tidb":"TiDB","tiflash":"TiFlash","tiktok":"TikTok","tikv":"TiKV","travis ci":"Travis CI","trpc":"tRPC","tsconfig":"TSConfig","tsdoc":"TSDoc","tsdx":"TSdx","turbopack":"Turbopack","turborepo":"Turborepo","typeorm":"TypeORM","typescript":"TypeScript","uniapp":"uniapp","unifi":"UniFi","unix":"UNIX","unocss":"UnoCSS","upnp":"UPnP","vercel":"Vercel","videolan":"VideoLAN","vim":"Vim","virtualbox":"VirtualBox","visual studio":"Visual Studio","visual studio code":"Visual Studio Code","vitepress":"VitePress","vividcortex":"VividCortex","vlc":"VLC","vmware":"VMware","voip":"VoIP","vs code":"VS Code","vs codium":"VSCodium","vscode":"VS Code","vscodium":"VSCodium","vue cli":"Vue CLI","vuepress":"VuePress","vueuse":"VueUse","vulkan":"Vulkan","w3c":"W3C","wasm":"Wasm","watchos":"watchOS","web assembly":"WebAssembly","webar":"WebAR","webassembly":"WebAssembly","webgl":"WebGL","webgpu":"WebGPU","webkit":"WebKit","webpack":"webpack","webrtc":"WebRTC","websocket":"WebSocket","webstorm":"WebStorm","webvr":"WebVR","webxr":"WebXR","wechat":"WeChat","wechat pay":"WeChat Pay","whatsapp":"WhatsApp","windi css":"Windi CSS","windicss":"WindiCSS","wireguard":"WireGuard","wordpress":"WordPress","xmind":"XMind","xstate":"XState","yapi":"YApi"}');
|
|
6
|
+
const dict = [
|
|
7
|
+
...Object.values(abbreviates_namespaceObject),
|
|
8
|
+
...Object.values(brands_namespaceObject),
|
|
9
|
+
...Object.values(general_namespaceObject),
|
|
10
|
+
...Object.values(products_namespaceObject),
|
|
11
|
+
...Object.values(softwares_namespaceObject),
|
|
12
|
+
'Angular',
|
|
13
|
+
'Agent Skills',
|
|
14
|
+
'API Report File',
|
|
15
|
+
'App Router',
|
|
16
|
+
'Babel',
|
|
17
|
+
'Baseline',
|
|
18
|
+
'Create React App',
|
|
19
|
+
'Cloudflare Pages',
|
|
20
|
+
'Cloudflare Workers',
|
|
21
|
+
'CSS Modules',
|
|
22
|
+
'Coding Agent',
|
|
23
|
+
'Coding Agents',
|
|
24
|
+
'Docusaurus',
|
|
25
|
+
'Docusaurus Faster',
|
|
26
|
+
'EJS',
|
|
27
|
+
'Emotion',
|
|
28
|
+
'Fast Refresh',
|
|
29
|
+
'Git',
|
|
30
|
+
'GitHub Actions',
|
|
31
|
+
'GitHub Pages',
|
|
32
|
+
'I',
|
|
33
|
+
'Jest',
|
|
34
|
+
'Lightning CSS',
|
|
35
|
+
'Lynx',
|
|
36
|
+
'Module Federation',
|
|
37
|
+
'Nextra',
|
|
38
|
+
'Netlify',
|
|
39
|
+
'Kinsta',
|
|
40
|
+
'Open Graph',
|
|
41
|
+
'Octane',
|
|
42
|
+
'Page Router',
|
|
43
|
+
'Parcel',
|
|
44
|
+
'Playwright',
|
|
45
|
+
'Preact',
|
|
46
|
+
'Preact Refresh',
|
|
47
|
+
'Relay',
|
|
48
|
+
'React',
|
|
49
|
+
'React Compiler',
|
|
50
|
+
'React Router',
|
|
51
|
+
'React Scan',
|
|
52
|
+
'React Server Components',
|
|
53
|
+
'Rollup',
|
|
54
|
+
'Rsbuild',
|
|
55
|
+
'Rsdoctor',
|
|
56
|
+
'Rslib',
|
|
57
|
+
'Rspack',
|
|
58
|
+
'Rstack',
|
|
59
|
+
'Rspack Stack',
|
|
60
|
+
'Rspress',
|
|
61
|
+
'Rstest',
|
|
62
|
+
'Rslint',
|
|
63
|
+
'Solid',
|
|
64
|
+
'Svelte',
|
|
65
|
+
'Server Action',
|
|
66
|
+
'Service Worker',
|
|
67
|
+
'TanStack Router',
|
|
68
|
+
'TanStack Start',
|
|
69
|
+
'Vite',
|
|
70
|
+
'Vitest',
|
|
71
|
+
'Vue',
|
|
72
|
+
'Web Workers',
|
|
73
|
+
'Xcode',
|
|
74
|
+
'Yarn',
|
|
75
|
+
'Zeabur',
|
|
76
|
+
'Zephyr',
|
|
77
|
+
'Zephyr Cloud'
|
|
78
|
+
];
|
|
79
|
+
const isEnglishWord = (word)=>/^[a-zA-Z]+$/.test(word);
|
|
80
|
+
const isFirstCharUppercase = (word)=>/^[A-Z][a-z]*$/.test(word);
|
|
81
|
+
const isTerm = (word, line)=>dict.some((term)=>{
|
|
82
|
+
if (term.includes(` ${word}`) || term.includes(`${word} `)) return line.includes(term);
|
|
83
|
+
return term === word;
|
|
84
|
+
});
|
|
85
|
+
const lineToWords = (line)=>{
|
|
86
|
+
const words = [];
|
|
87
|
+
let lastWord = {
|
|
88
|
+
type: 'word',
|
|
89
|
+
value: ''
|
|
90
|
+
};
|
|
91
|
+
for (const char of line.split(''))if (/\s/.test(char)) if ('space' === lastWord.type) lastWord.value += char;
|
|
92
|
+
else {
|
|
93
|
+
words.push(lastWord);
|
|
94
|
+
lastWord = {
|
|
95
|
+
type: 'space',
|
|
96
|
+
value: char
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
else if ('word' === lastWord.type) lastWord.value += char;
|
|
100
|
+
else {
|
|
101
|
+
words.push(lastWord);
|
|
102
|
+
lastWord = {
|
|
103
|
+
type: 'word',
|
|
104
|
+
value: char
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
words.push(lastWord);
|
|
108
|
+
return words;
|
|
109
|
+
};
|
|
110
|
+
const formatWords = (words)=>{
|
|
111
|
+
const line = words.map((word)=>word.value).join('');
|
|
112
|
+
const englishWords = [];
|
|
113
|
+
for (const word of words){
|
|
114
|
+
const { type, value } = word;
|
|
115
|
+
if ('space' !== type) {
|
|
116
|
+
if (isEnglishWord(value)) englishWords.push(value);
|
|
117
|
+
if (!(englishWords.length <= 1 || isTerm(value, line)) && isFirstCharUppercase(value)) word.value = value.toLowerCase();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return words;
|
|
121
|
+
};
|
|
122
|
+
const formatLine = (line)=>formatWords(lineToWords(line)).map((word)=>word.value).join('');
|
|
123
|
+
export { formatLine, formatWords };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { Parser, Plugin, Printer } from 'prettier';
|
|
2
|
+
export declare const parsers: {
|
|
3
|
+
markdown: Parser<any>;
|
|
4
|
+
mdx: Parser<any>;
|
|
5
|
+
remark: Parser<any>;
|
|
6
|
+
};
|
|
7
|
+
export declare const printers: {
|
|
8
|
+
"heading-case-mdast": Printer<any>;
|
|
9
|
+
};
|
|
10
|
+
declare const plugin: Plugin;
|
|
11
|
+
export default plugin;
|