@sanity/cli-core 3.5.0 → 3.5.1
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/ux/spinner.js +15 -2
- package/dist/ux/spinner.js.map +1 -1
- package/package.json +7 -7
package/dist/ux/spinner.js
CHANGED
|
@@ -80,11 +80,24 @@ function resolveAffix(value1) {
|
|
|
80
80
|
};
|
|
81
81
|
return instance;
|
|
82
82
|
}
|
|
83
|
+
// Ora's default `discardStdin: true` puts stdin in raw mode, which stops the
|
|
84
|
+
// kernel from turning Ctrl+C into SIGINT (and ora's userland re-signal
|
|
85
|
+
// fallback never fires on a non-flowing stdin), hanging the process. Keep it
|
|
86
|
+
// off by default; explicit caller options still win.
|
|
87
|
+
function normalize(options) {
|
|
88
|
+
const resolved = typeof options === 'string' ? {
|
|
89
|
+
text: options
|
|
90
|
+
} : options ?? {};
|
|
91
|
+
return {
|
|
92
|
+
discardStdin: false,
|
|
93
|
+
...resolved
|
|
94
|
+
};
|
|
95
|
+
}
|
|
83
96
|
export function spinner(options) {
|
|
84
|
-
return getCliExecutionContext() ? silentSpinner(options) : ora(options);
|
|
97
|
+
return getCliExecutionContext() ? silentSpinner(options) : ora(normalize(options));
|
|
85
98
|
}
|
|
86
99
|
export function spinnerPromise(action, options) {
|
|
87
|
-
if (!getCliExecutionContext()) return oraPromise(action, options);
|
|
100
|
+
if (!getCliExecutionContext()) return oraPromise(action, normalize(options));
|
|
88
101
|
return Promise.resolve(typeof action === 'function' ? action(silentSpinner(options)) : action);
|
|
89
102
|
}
|
|
90
103
|
|
package/dist/ux/spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ux/spinner.ts"],"sourcesContent":["import ora, {\n type Options,\n type Ora,\n oraPromise,\n type Spinner as OraSpinner,\n type PersistOptions,\n type PromiseOptions,\n} from 'ora'\n\nimport {getCliExecutionContext} from '../executionContext.js'\n\n/**\n * Uncolored counterparts of the `log-symbols` glyphs a real spinner persists\n * with. Lines forwarded to an execution context are handed to the embedding\n * host verbatim, so they should not carry ANSI codes the host has to strip.\n */\nconst persistSymbols = {\n error: '✖',\n info: 'ℹ',\n success: '✔',\n warning: '⚠',\n}\n\nfunction resolveAffix(value: Options['prefixText'] | Options['suffixText']): string {\n const resolved = typeof value === 'function' ? value() : value\n return typeof resolved === 'string' ? resolved : ''\n}\n\n/**\n * Stand-in for a real spinner, used when a CLI execution context is active.\n *\n * Frame animation and transient text updates have nowhere useful to go, so they\n * are dropped. The lines a spinner *persists* (`succeed`, `fail`, `warn`,\n * `info`, `stopAndPersist`) are the command's actual output rather than\n * progress, so they are forwarded to the context's sink instead of being\n * swallowed. Ora writes to `process.stderr` by default, so the `stderr` sink is\n * preferred, falling back to `stdout`.\n */\nfunction silentSpinner(options?: Options | string): Ora {\n const resolved = typeof options === 'string' ? {text: options} : (options ?? {})\n const context = getCliExecutionContext()\n const emit = resolved.isSilent ? undefined : (context?.stderr ?? context?.stdout)\n\n const prefixText = resolveAffix(resolved.prefixText)\n const suffixText = resolveAffix(resolved.suffixText)\n const state = {text: resolved.text ?? ''}\n\n const persist = (symbol: string, text?: string): void => {\n if (!emit) return\n\n // Mirrors ora's own line layout, minus the trailing whitespace it leaves\n // behind when only one of the symbol and the text is present.\n const body = text ?? state.text\n const line =\n (prefixText ? `${prefixText} ` : '') +\n symbol +\n (symbol && body ? ` ${body}` : body) +\n (suffixText ? ` ${suffixText}` : '')\n\n if (line.trim() !== '') emit(line)\n }\n\n const instance = {\n clear: () => instance,\n fail: (text?: string) => {\n persist(persistSymbols.error, text)\n return instance\n },\n frame: () => '',\n info: (text?: string) => {\n persist(persistSymbols.info, text)\n return instance\n },\n isSpinning: false,\n prefixText,\n render: () => instance,\n start: () => instance,\n stop: () => instance,\n stopAndPersist: (persistOptions: PersistOptions = {}) => {\n persist(persistOptions.symbol ?? '', persistOptions.text)\n return instance\n },\n succeed: (text?: string) => {\n persist(persistSymbols.success, text)\n return instance\n },\n suffixText,\n get text(): string {\n return state.text\n },\n set text(value: string) {\n state.text = value\n },\n warn: (text?: string) => {\n persist(persistSymbols.warning, text)\n return instance\n },\n }\n return instance as unknown as Ora\n}\n\nexport function spinner(options?: Options | string): Ora {\n return getCliExecutionContext() ? silentSpinner(options) : ora(options)\n}\n\nexport function spinnerPromise<T>(\n action: ((instance: Ora) => PromiseLike<T>) | PromiseLike<T>,\n options?: PromiseOptions<T> | string,\n): Promise<T> {\n if (!getCliExecutionContext()) return oraPromise(action, options)\n return Promise.resolve(typeof action === 'function' ? action(silentSpinner(options)) : action)\n}\n\nexport type Spinner = OraSpinner\nexport type SpinnerInstance = Ora\nexport type SpinnerOptions = Options\nexport type SpinnerPromiseOptions<T> = PromiseOptions<T>\n"],"names":["ora","oraPromise","getCliExecutionContext","persistSymbols","error","info","success","warning","resolveAffix","value","resolved","silentSpinner","options","text","context","emit","isSilent","undefined","stderr","stdout","prefixText","suffixText","state","persist","symbol","body","line","trim","instance","clear","fail","frame","isSpinning","render","start","stop","stopAndPersist","persistOptions","succeed","warn","spinner","spinnerPromise","action","Promise","resolve"],"mappings":"AAAA,OAAOA,OAGLC,UAAU,QAIL,MAAK;AAEZ,SAAQC,sBAAsB,QAAO,yBAAwB;AAE7D;;;;CAIC,GACD,MAAMC,iBAAiB;IACrBC,OAAO;IACPC,MAAM;IACNC,SAAS;IACTC,SAAS;AACX;AAEA,SAASC,aAAaC,MAAoD;IACxE,MAAMC,WAAW,OAAOD,WAAU,aAAaA,WAAUA;IACzD,OAAO,OAAOC,aAAa,WAAWA,WAAW;AACnD;AAEA;;;;;;;;;CASC,GACD,SAASC,cAAcC,OAA0B;IAC/C,MAAMF,WAAW,OAAOE,YAAY,WAAW;QAACC,MAAMD;IAAO,IAAKA,WAAW,CAAC;IAC9E,MAAME,UAAUZ;IAChB,MAAMa,OAAOL,SAASM,QAAQ,GAAGC,YAAaH,SAASI,UAAUJ,SAASK;IAE1E,MAAMC,aAAaZ,aAAaE,S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],"sourcesContent":["import ora, {\n type Options,\n type Ora,\n oraPromise,\n type Spinner as OraSpinner,\n type PersistOptions,\n type PromiseOptions,\n} from 'ora'\n\nimport {getCliExecutionContext} from '../executionContext.js'\n\n/**\n * Uncolored counterparts of the `log-symbols` glyphs a real spinner persists\n * with. Lines forwarded to an execution context are handed to the embedding\n * host verbatim, so they should not carry ANSI codes the host has to strip.\n */\nconst persistSymbols = {\n error: '✖',\n info: 'ℹ',\n success: '✔',\n warning: '⚠',\n}\n\nfunction resolveAffix(value: Options['prefixText'] | Options['suffixText']): string {\n const resolved = typeof value === 'function' ? value() : value\n return typeof resolved === 'string' ? resolved : ''\n}\n\n/**\n * Stand-in for a real spinner, used when a CLI execution context is active.\n *\n * Frame animation and transient text updates have nowhere useful to go, so they\n * are dropped. The lines a spinner *persists* (`succeed`, `fail`, `warn`,\n * `info`, `stopAndPersist`) are the command's actual output rather than\n * progress, so they are forwarded to the context's sink instead of being\n * swallowed. Ora writes to `process.stderr` by default, so the `stderr` sink is\n * preferred, falling back to `stdout`.\n */\nfunction silentSpinner(options?: Options | string): Ora {\n const resolved = typeof options === 'string' ? {text: options} : (options ?? {})\n const context = getCliExecutionContext()\n const emit = resolved.isSilent ? undefined : (context?.stderr ?? context?.stdout)\n\n const prefixText = resolveAffix(resolved.prefixText)\n const suffixText = resolveAffix(resolved.suffixText)\n const state = {text: resolved.text ?? ''}\n\n const persist = (symbol: string, text?: string): void => {\n if (!emit) return\n\n // Mirrors ora's own line layout, minus the trailing whitespace it leaves\n // behind when only one of the symbol and the text is present.\n const body = text ?? state.text\n const line =\n (prefixText ? `${prefixText} ` : '') +\n symbol +\n (symbol && body ? ` ${body}` : body) +\n (suffixText ? ` ${suffixText}` : '')\n\n if (line.trim() !== '') emit(line)\n }\n\n const instance = {\n clear: () => instance,\n fail: (text?: string) => {\n persist(persistSymbols.error, text)\n return instance\n },\n frame: () => '',\n info: (text?: string) => {\n persist(persistSymbols.info, text)\n return instance\n },\n isSpinning: false,\n prefixText,\n render: () => instance,\n start: () => instance,\n stop: () => instance,\n stopAndPersist: (persistOptions: PersistOptions = {}) => {\n persist(persistOptions.symbol ?? '', persistOptions.text)\n return instance\n },\n succeed: (text?: string) => {\n persist(persistSymbols.success, text)\n return instance\n },\n suffixText,\n get text(): string {\n return state.text\n },\n set text(value: string) {\n state.text = value\n },\n warn: (text?: string) => {\n persist(persistSymbols.warning, text)\n return instance\n },\n }\n return instance as unknown as Ora\n}\n\n// Ora's default `discardStdin: true` puts stdin in raw mode, which stops the\n// kernel from turning Ctrl+C into SIGINT (and ora's userland re-signal\n// fallback never fires on a non-flowing stdin), hanging the process. Keep it\n// off by default; explicit caller options still win.\nfunction normalize<T extends Options>(options?: string | T): T {\n const resolved = typeof options === 'string' ? ({text: options} as T) : (options ?? ({} as T))\n return {discardStdin: false, ...resolved}\n}\n\nexport function spinner(options?: Options | string): Ora {\n return getCliExecutionContext() ? silentSpinner(options) : ora(normalize(options))\n}\n\nexport function spinnerPromise<T>(\n action: ((instance: Ora) => PromiseLike<T>) | PromiseLike<T>,\n options?: PromiseOptions<T> | string,\n): Promise<T> {\n if (!getCliExecutionContext()) return oraPromise(action, normalize(options))\n return Promise.resolve(typeof action === 'function' ? action(silentSpinner(options)) : action)\n}\n\nexport type Spinner = OraSpinner\nexport type SpinnerInstance = Ora\nexport type SpinnerOptions = Options\nexport type SpinnerPromiseOptions<T> = PromiseOptions<T>\n"],"names":["ora","oraPromise","getCliExecutionContext","persistSymbols","error","info","success","warning","resolveAffix","value","resolved","silentSpinner","options","text","context","emit","isSilent","undefined","stderr","stdout","prefixText","suffixText","state","persist","symbol","body","line","trim","instance","clear","fail","frame","isSpinning","render","start","stop","stopAndPersist","persistOptions","succeed","warn","normalize","discardStdin","spinner","spinnerPromise","action","Promise","resolve"],"mappings":"AAAA,OAAOA,OAGLC,UAAU,QAIL,MAAK;AAEZ,SAAQC,sBAAsB,QAAO,yBAAwB;AAE7D;;;;CAIC,GACD,MAAMC,iBAAiB;IACr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,CAAC;YAClDd,QAAQc,eAAeb,MAAM,IAAI,IAAIa,eAAexB,IAAI;YACxD,OAAOe;QACT;QACAU,SAAS,CAACzB;YACRU,QAAQpB,eAAeG,OAAO,EAAEO;YAChC,OAAOe;QACT;QACAP;QACA,IAAIR,QAAe;YACjB,OAAOS,MAAMT,IAAI;QACnB;QACA,IAAIA,MAAKJ,MAAe;YACtBa,MAAMT,IAAI,GAAGJ;QACf;QACA8B,MAAM,CAAC1B;YACLU,QAAQpB,eAAeI,OAAO,EAAEM;YAChC,OAAOe;QACT;IACF;IACA,OAAOA;AACT;AAEA,6EAA6E;AAC7E,uEAAuE;AACvE,6EAA6E;AAC7E,qDAAqD;AACrD,SAASY,UAA6B5B,OAAoB;IACxD,MAAMF,WAAW,OAAOE,YAAY,WAAY;QAACC,MAAMD;IAAO,IAAWA,WAAY,CAAC;IACtF,OAAO;QAAC6B,cAAc;QAAO,GAAG/B,QAAQ;IAAA;AAC1C;AAEA,OAAO,SAASgC,QAAQ9B,OAA0B;IAChD,OAAOV,2BAA2BS,cAAcC,WAAWZ,IAAIwC,UAAU5B;AAC3E;AAEA,OAAO,SAAS+B,eACdC,MAA4D,EAC5DhC,OAAoC;IAEpC,IAAI,CAACV,0BAA0B,OAAOD,WAAW2C,QAAQJ,UAAU5B;IACnE,OAAOiC,QAAQC,OAAO,CAAC,OAAOF,WAAW,aAAaA,OAAOjC,cAAcC,YAAYgC;AACzF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli-core",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"description": "Sanity CLI core package",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -113,11 +113,11 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@inquirer/prompts": "^8.5.2",
|
|
115
115
|
"@oclif/core": "^4.11.14",
|
|
116
|
-
"@sanity/client": "^8.
|
|
116
|
+
"@sanity/client": "^8.4.0",
|
|
117
117
|
"boxen": "^8.0.1",
|
|
118
118
|
"empathic": "^2.0.1",
|
|
119
|
-
"get-it": "^9.5.
|
|
120
|
-
"get-tsconfig": "^4.14.
|
|
119
|
+
"get-it": "^9.5.2",
|
|
120
|
+
"get-tsconfig": "^4.14.3",
|
|
121
121
|
"import-meta-resolve": "^4.2.0",
|
|
122
122
|
"jiti": "^2.7.0",
|
|
123
123
|
"jsdom": "^29.1.1",
|
|
@@ -127,14 +127,14 @@
|
|
|
127
127
|
"ora": "^9.0.0",
|
|
128
128
|
"rxjs": "^7.8.2",
|
|
129
129
|
"tsx": "^4.23.12",
|
|
130
|
-
"vite": "^8.2.
|
|
130
|
+
"vite": "^8.2.2",
|
|
131
131
|
"vite-node": "^6.0.0",
|
|
132
132
|
"wrap-ansi": "^9.0.2",
|
|
133
133
|
"zod": "^4.4.3"
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@eslint/compat": "^2.1.0",
|
|
137
|
-
"@sanity/pkg-utils": "^12.
|
|
137
|
+
"@sanity/pkg-utils": "^12.3.4",
|
|
138
138
|
"@sanity/telemetry": "^1.1.0",
|
|
139
139
|
"@swc/cli": "^0.8.1",
|
|
140
140
|
"@swc/core": "^1.15.43",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"@types/node": "^22.20.0",
|
|
143
143
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
144
144
|
"eslint": "^10.7.0",
|
|
145
|
-
"oxc-transform-react": "^0.
|
|
145
|
+
"oxc-transform-react": "^0.147.0",
|
|
146
146
|
"publint": "^0.3.21",
|
|
147
147
|
"sanity": "^6.7.0",
|
|
148
148
|
"typescript": "^6.0.3",
|