sveld 0.40.3 → 0.40.4
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/browser.js +127 -127
- package/chunk-1wx900qk.js +40 -0
- package/{chunk-1pzasy7d.js → chunk-qwe39hva.js} +1 -1
- package/chunk-yp51zj9v.js +1 -0
- package/chunk-yv6ea3ve.js +193 -0
- package/cli-entry.js +2 -2
- package/cli.js +1 -1
- package/index.d.ts +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunk-m252rw53.js +0 -40
- package/chunk-r6xdep4j.js +0 -1
- package/chunk-ve0g5kge.js +0 -192
package/cli-entry.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L,n,$t,ye,xe,q,O,G,ee,H,U,Ie,Le,Oe}from"./chunk-yv6ea3ve.js";import{existsSync as v}from"node:fs";import{join as S}from"node:path";var f="src/index.js",m={SUCCESS:0,USAGE_ERROR:1,GENERATION_FAILURE:2,BREAKING_CHANGE:3,DIAGNOSTICS:4},x=`Usage: sveld [options]
|
|
2
2
|
|
|
3
3
|
Generate TypeScript definitions and component documentation for a Svelte
|
|
4
4
|
library. With no flags, only TypeScript definitions are generated for the
|
|
@@ -35,4 +35,4 @@ Exit codes:
|
|
|
35
35
|
2 generation failure
|
|
36
36
|
3 breaking API change detected by --check
|
|
37
37
|
4 diagnostics present under --strict
|
|
38
|
-
`,E=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],k=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),b=/[A-Z]/g,w=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),
|
|
38
|
+
`,E=["help","version","glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","entry","config","cache","check","check-level","types-format","types-index-types","format"],k=new Map([["-h","--help"],["-v","--version"],["-q","--quiet"]]),b=/[A-Z]/g,w=new Set(["glob","types","json","markdown","quiet","stdout","strict","report-diagnostics","check-examples","fail-fast","types-index-types"]),R=new Set(["entry","config","cache","check","types-format"]),C=new Set(["entry","config","types-format"]);function A(o){let s=o.replace(b,(r)=>`-${r.toLowerCase()}`);return L(s,E)}function j(o,s){let r=o.indexOf("="),t=r===-1?o.slice(2):o.slice(2,r),i=r===-1?!0:o.slice(r+1),e=!1;if(r===-1&&R.has(t)){if(s!==void 0&&!s.startsWith("--")&&!k.has(s))i=s,e=!0;else if(C.has(t))return{result:{kind:"usage-error",message:`sveld: --${t} requires a value (pass --${t}=<value> or --${t} <value>).`},consumedNext:!1,flag:t}}return{result:P(t,i,o),consumedNext:e,flag:t}}function P(o,s,r){let t=(c)=>({kind:"option",option:c}),i=s===!0||s==="true",e=typeof s==="string"?s:void 0;switch(o){case"help":return{kind:"help"};case"version":return{kind:"version"};case"glob":case"types":case"json":case"markdown":case"quiet":return t({[o]:i});case"stdout":if(i)return t({stdout:!0});if(s==="false")return t({stdout:!1});return{kind:"usage-error",message:`sveld: --stdout does not take a value; got "${s}".`};case"strict":if(i)return t({strict:!0});if(s==="false")return t({strict:!1});return t({strict:s});case"report-diagnostics":return t({reportDiagnostics:i});case"check-examples":if(i)return t({checkExamples:!0});if(s==="false")return t({checkExamples:!1});return t({checkExamples:s});case"fail-fast":return t({failFast:i});case"entry":return t(e===void 0?{}:{entry:e});case"config":return t(e===void 0?{}:{config:e});case"cache":if(s==="false")return t({cache:!1});return t({cache:e??!0});case"check":if(s==="false")return t({check:!1});return t({check:e??!0});case"types-format":return t(e===void 0?{}:{typesOptions:{format:e}});case"types-index-types":return t({typesOptions:{indexTypes:i}});case"format":return t(e===void 0?{}:{format:e});case"check-level":return t(e===void 0?{}:{checkLevel:e});default:return{kind:"unknown",arg:r,suggestion:A(o)}}}function T(o){let s={},r=!1;for(let t=0;t<o.length;t++){let i=k.get(o[t])??o[t];if(!i.startsWith("--"))return{kind:"unknown",arg:i,positionalHint:r?!0:void 0};let{result:e,consumedNext:c,flag:l}=j(i,o[t+1]);if(e.kind!=="option")return e;if(s=O(s,e.option),r=w.has(l),c)t++}return{kind:"options",options:s}}function u(o,s){return o!==void 0&&!s.includes(o)}async function _(o){let s=(a)=>{console.error(a),o.exitCode=m.USAGE_ERROR},r=T(o.argv.slice(2));if(r.kind==="help"){console.log(x);return}if(r.kind==="version"){console.log($t.version);return}if(r.kind==="usage-error")return s(r.message);if(r.kind==="unknown"){let a=`sveld: unknown flag "${r.arg}".`;if(r.suggestion)a+=` Did you mean "--${r.suggestion}"?`;if(r.positionalHint)a+=" Values are passed as --flag=value or --flag value.";return console.error(a),s("Run sveld --help for a list of available flags.")}let t=r.options,i;try{i=await q(t.config,o.cwd(),!0)}catch(a){return s(a instanceof Error?a.message:String(a))}let e=O(i,t);if(G(e),e.stdout){if([e.json,e.markdown].filter(Boolean).length!==1)return s("sveld: --stdout requires exactly one of --json or --markdown.");if(e.types===!0)return s("sveld: --stdout cannot be combined with --types; type definitions span multiple files.");if(e.check)return s("sveld: --stdout cannot be combined with --check; both write their document to stdout.")}if(u(e.format,["text","json","github"]))return s(`sveld: --format must be "text", "json", or "github"; got "${e.format}".`);if(u(e.strict,[!0,!1,"errors"]))return s(`sveld: --strict must be "errors" when given a value; got "${e.strict}".`);if(u(e.checkLevel,["major","minor","patch"]))return s(`sveld: --check-level must be "major", "minor", or "patch"; got "${e.checkLevel}".`);if(u(e.checkExamples,[!0,!1,"syntax"]))return s(`sveld: --check-examples must be "syntax" when given a value; got "${e.checkExamples}".`);let c=e.typesOptions?.format;if(u(c,["class","component"]))return s(`sveld: --types-format must be "class" or "component"; got "${c}".`);H(e.quiet===!0);let l=Ie(e.entry),d;if(l.entry!==null)d=l.entry;else if(!l.configured&&v(S(o.cwd(),f)))console.error(`sveld: no entry point configured; using "${f}". Set package.json#svelte (or pass --entry) to silence this.`),d=ee(n(f));else return s(`sveld: ${l.message}`);let g;try{g=await Le(d,e,e.stdout===!0)}catch(a){if(a instanceof U)return s(`sveld: ${a.message}`);console.error(a instanceof Error?a.message:String(a)),o.exitCode=m.GENERATION_FAILURE;return}let{result:y,check:p}=g,{exitCode:h}=Oe(y,p,e,d);if(p)if(e.format==="json")o.stdout.write(xe(p));else console.log(ye(p));if(h!==m.SUCCESS)o.exitCode=h}export{_ as cli};
|
package/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// eslint-disable-next-line no-restricted-syntax -- a named import of enableCompileCache fails to link on Node < 22.1.
|
|
4
4
|
import * as nodeModule from "node:module";
|
|
5
5
|
|
|
6
6
|
// Caches V8's compiled bytecode for sveld's own modules across runs (Node
|
package/index.d.ts
CHANGED
|
@@ -525,8 +525,8 @@ export type SemverBump = "major" | "minor" | "patch" | "none";
|
|
|
525
525
|
export interface ApiChange {
|
|
526
526
|
/** Component `moduleName` this change belongs to, or `"*"` for document-wide notices. */
|
|
527
527
|
component: string;
|
|
528
|
-
kind: "component" | "prop" | "moduleExport" | "event" | "slot" | "context" | "shape" | "schema";
|
|
529
|
-
/** Prop, event, slot, context key, or shape-field name, when applicable. */
|
|
528
|
+
kind: "component" | "prop" | "moduleExport" | "event" | "slot" | "context" | "typedef" | "shape" | "schema";
|
|
529
|
+
/** Prop, event, slot, context key, typedef, or shape-field name, when applicable. */
|
|
530
530
|
name?: string;
|
|
531
531
|
/** For `kind: "context"`, the context property the change is about. Absent when it's the context as a whole. */
|
|
532
532
|
property?: string;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{K,Be,y,Rt,Re,ye,It,xe,Ft,Lt,Bt}from"./chunk-yv6ea3ve.js";import{ne}from"./chunk-1wx900qk.js";export{It as CHECK_REPORT_SCHEMA_VERSION,ne as ComponentParser,Be as DIAGNOSTICS_SCHEMA_VERSION,K as DIAGNOSTIC_CODES,y as buildComponentApiDocument,Lt as default,Ft as defineConfig,Rt as diffApiDocuments,ye as formatCheckReport,xe as formatCheckReportJson,Re as runCheck,Bt as sveld};
|