@sanity/runtime-cli 17.0.0 → 17.1.0-next.gcfbd613
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 +24 -23
- package/dist/actions/blueprints/assets.d.ts +2 -1
- package/dist/actions/blueprints/assets.js +2 -2
- package/dist/actions/blueprints/blueprint.d.ts +1 -1
- package/dist/actions/blueprints/wait-for-operation.js +4 -0
- package/dist/actions/functions/test.js +1 -1
- package/dist/actions/sanity/examples.d.ts +4 -4
- package/dist/baseCommands.d.ts +4 -4
- package/dist/baseCommands.js +13 -2
- package/dist/commands/blueprints/add.d.ts +1 -1
- package/dist/commands/blueprints/config.d.ts +1 -1
- package/dist/commands/blueprints/deploy.d.ts +1 -1
- package/dist/commands/blueprints/destroy.d.ts +1 -1
- package/dist/commands/blueprints/doctor.d.ts +0 -1
- package/dist/commands/blueprints/doctor.js +3 -7
- package/dist/commands/blueprints/info.d.ts +1 -1
- package/dist/commands/blueprints/logs.d.ts +1 -1
- package/dist/commands/blueprints/mint-deploy-token.d.ts +1 -1
- package/dist/commands/blueprints/plan.d.ts +1 -1
- package/dist/commands/blueprints/promote.d.ts +1 -1
- package/dist/commands/blueprints/stacks.d.ts +1 -1
- package/dist/commands/functions/add.d.ts +1 -1
- package/dist/commands/functions/build.d.ts +1 -1
- package/dist/commands/functions/dev.d.ts +1 -1
- package/dist/commands/functions/env/add.d.ts +1 -1
- package/dist/commands/functions/env/list.d.ts +1 -1
- package/dist/commands/functions/env/remove.d.ts +1 -1
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/test.d.ts +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +7 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/cores/blueprints/deploy.js +5 -4
- package/dist/cores/blueprints/doctor.js +15 -12
- package/dist/cores/functions/build.js +3 -2
- package/dist/cores/functions/test.js +48 -2
- package/dist/server/app.js +39 -5
- package/dist/server/handlers/invoke.d.ts +2 -2
- package/dist/server/handlers/invoke.js +7 -4
- package/dist/server/static/components/console-panel.js +59 -8
- package/dist/server/static/components/rule-panel.js +11 -8
- package/dist/server/static/components/shared-styles.js +24 -21
- package/dist/server/static/favicon-dark.svg +1 -0
- package/dist/server/static/favicon.svg +1 -0
- package/dist/server/static/index.html +2 -2
- package/dist/server/static/vendor/vendor.bundle.js +115 -61
- package/dist/server/static/web-socket.js +41 -0
- package/dist/utils/functions/child-process-wrapper.js +62 -7
- package/dist/utils/functions/find-entry-point.d.ts +1 -1
- package/dist/utils/functions/find-entry-point.js +10 -12
- package/dist/utils/functions/{invoke-local.d.ts → invoke/local.d.ts} +1 -1
- package/dist/utils/functions/invoke/local.js +306 -0
- package/dist/utils/functions/invoke/nested.d.ts +25 -0
- package/dist/utils/functions/invoke/nested.js +41 -0
- package/dist/utils/functions/invoke/prepare.d.ts +20 -0
- package/dist/utils/functions/invoke/prepare.js +101 -0
- package/dist/utils/functions/package-json.d.ts +1 -2
- package/dist/utils/functions/package-json.js +4 -6
- package/dist/utils/functions/prepare-asset.d.ts +2 -2
- package/dist/utils/functions/prepare-asset.js +18 -7
- package/dist/utils/functions/resolve-dependencies.d.ts +4 -1
- package/dist/utils/functions/resolve-dependencies.js +5 -6
- package/dist/utils/functions/resource-to-arc.d.ts +1 -1
- package/dist/utils/functions/resource-to-arc.js +4 -5
- package/dist/utils/functions/should-transpile.d.ts +7 -1
- package/dist/utils/functions/should-transpile.js +10 -10
- package/dist/utils/functions/transpile/function.d.ts +4 -1
- package/dist/utils/functions/transpile/function.js +9 -14
- package/dist/utils/functions/transpile/verify-handler.js +1 -1
- package/dist/utils/isTrueish.d.ts +6 -0
- package/dist/utils/isTrueish.js +9 -0
- package/dist/utils/logger.d.ts +7 -5
- package/dist/utils/logger.js +33 -1
- package/dist/utils/progress.d.ts +5 -0
- package/dist/utils/progress.js +40 -0
- package/dist/utils/types.d.ts +67 -5
- package/oclif.manifest.json +5 -4
- package/package.json +28 -23
- package/dist/server/static/hot-reload.js +0 -16
- package/dist/utils/functions/invoke-local.js +0 -185
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { findFunctionEntryPoint } from './find-entry-point.js';
|
|
2
|
-
export async function shouldTranspileFunction(resource) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (!resource.src) {
|
|
7
|
-
// Cannot determine without a source path
|
|
8
|
-
return false;
|
|
2
|
+
export async function shouldTranspileFunction(resource, functionPath) {
|
|
3
|
+
const hasTranspile = 'transpile' in resource && typeof resource.transpile === 'boolean';
|
|
4
|
+
if (!functionPath || (hasTranspile && resource.transpile === false)) {
|
|
5
|
+
return { transpile: false };
|
|
9
6
|
}
|
|
10
7
|
try {
|
|
11
8
|
// 2. Find the actual entry point
|
|
12
|
-
const entryPoint = await findFunctionEntryPoint(
|
|
9
|
+
const entryPoint = await findFunctionEntryPoint(functionPath, resource.displayName ?? resource.name);
|
|
13
10
|
// 3. Check if the resolved entry point is a TypeScript file
|
|
14
|
-
return
|
|
11
|
+
return {
|
|
12
|
+
entryPoint,
|
|
13
|
+
transpile: hasTranspile ? resource.transpile === true : entryPoint.endsWith('.ts'),
|
|
14
|
+
};
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
17
|
// If we cannot find the entry point, we cannot determine if it's TS.
|
|
18
18
|
// Log a warning and default to false (don't bundle).
|
|
19
19
|
console.warn(`[warn] Could not determine entry point for function "${resource.displayName ?? resource.name}" while checking if transpiling is needed: ${err instanceof Error ? err.message : err}`);
|
|
20
|
-
return false;
|
|
20
|
+
return { transpile: false };
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { FunctionResource, InstallerType } from '../../types.js';
|
|
2
2
|
export declare const resolveViteRoot: (entry: string) => string;
|
|
3
|
-
export declare function transpileFunction(resource
|
|
3
|
+
export declare function transpileFunction({ resource, functionPath, entryPoint, installer, }: {
|
|
4
|
+
resource: FunctionResource;
|
|
5
|
+
functionPath: string;
|
|
6
|
+
entryPoint: string;
|
|
4
7
|
installer?: InstallerType;
|
|
5
8
|
}): Promise<{
|
|
6
9
|
type: string;
|
|
@@ -3,9 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
4
|
import { cwd } from 'node:process';
|
|
5
5
|
import * as find from 'empathic/find';
|
|
6
|
+
import stripAnsi from 'strip-ansi';
|
|
6
7
|
import { build as viteBuild } from 'vite';
|
|
7
8
|
import { detectNativeModulesPlugin } from '../detect-native-modules.js';
|
|
8
|
-
import { findFunctionEntryPoint } from '../find-entry-point.js';
|
|
9
9
|
import { cleanupSourceMaps } from './cleanup-source-maps.js';
|
|
10
10
|
import { createPnpmRequire } from './pnpm.js';
|
|
11
11
|
import { verifyHandler } from './verify-handler.js';
|
|
@@ -13,23 +13,18 @@ export const resolveViteRoot = (entry) => {
|
|
|
13
13
|
const nodeModulesDir = find.dir('node_modules', { cwd: entry });
|
|
14
14
|
return nodeModulesDir ? path.dirname(nodeModulesDir) : entry;
|
|
15
15
|
};
|
|
16
|
-
export async function transpileFunction(resource,
|
|
16
|
+
export async function transpileFunction({ resource, functionPath, entryPoint, installer, }) {
|
|
17
17
|
if (!resource.src)
|
|
18
18
|
throw new Error('Resource src is required');
|
|
19
19
|
if (!resource.name)
|
|
20
20
|
throw new Error('Resource name is required');
|
|
21
21
|
const timings = {};
|
|
22
22
|
const transpileStart = performance.now();
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const fnDisplayName = resource.displayName ?? resource.name;
|
|
26
|
-
const findEntryStart = performance.now();
|
|
27
|
-
const entry = await findFunctionEntryPoint(sourcePath, fnDisplayName);
|
|
28
|
-
timings['transpile:findEntry'] = performance.now() - findEntryStart;
|
|
29
|
-
const entryDir = stats.isFile() ? path.dirname(sourcePath) : sourcePath;
|
|
23
|
+
const stats = await stat(functionPath);
|
|
24
|
+
const entryDir = stats.isFile() ? path.dirname(functionPath) : functionPath;
|
|
30
25
|
const outputPathStart = performance.now();
|
|
31
26
|
const outputDir = await getTranspileOutputPath(entryDir, resource.name);
|
|
32
|
-
const outputFile = path.join(outputDir, getOutputFilename(
|
|
27
|
+
const outputFile = path.join(outputDir, getOutputFilename(entryPoint));
|
|
33
28
|
const fnRootDir = resolveViteRoot(entryDir);
|
|
34
29
|
timings['transpile:setupOutput'] = performance.now() - outputPathStart;
|
|
35
30
|
async function cleanupTmpDir() {
|
|
@@ -51,10 +46,10 @@ export async function transpileFunction(resource, { installer } = {}) {
|
|
|
51
46
|
sourcemap: true,
|
|
52
47
|
ssr: true,
|
|
53
48
|
rolldownOptions: {
|
|
54
|
-
input:
|
|
49
|
+
input: entryPoint,
|
|
55
50
|
output: {
|
|
56
51
|
format: 'esm',
|
|
57
|
-
entryFileNames: getOutputFilename(
|
|
52
|
+
entryFileNames: getOutputFilename(entryPoint),
|
|
58
53
|
...(bundle
|
|
59
54
|
? {}
|
|
60
55
|
: {
|
|
@@ -86,7 +81,7 @@ export async function transpileFunction(resource, { installer } = {}) {
|
|
|
86
81
|
await writeTranspiledPackageJson(entryDir, outputFile);
|
|
87
82
|
timings['transpile:writePackage'] = performance.now() - pkgStart;
|
|
88
83
|
const cleanupStart = performance.now();
|
|
89
|
-
await cleanupSourceMaps(
|
|
84
|
+
await cleanupSourceMaps(functionPath, outputDir);
|
|
90
85
|
timings['transpile:cleanupMaps'] = performance.now() - cleanupStart;
|
|
91
86
|
timings.bundle = performance.now() - transpileStart;
|
|
92
87
|
return {
|
|
@@ -100,7 +95,7 @@ export async function transpileFunction(resource, { installer } = {}) {
|
|
|
100
95
|
}
|
|
101
96
|
catch (err) {
|
|
102
97
|
await cleanupTmpDir();
|
|
103
|
-
throw new Error(`Transpiling of function failed: ${formatBuildError(err)}`, {
|
|
98
|
+
throw new Error(`Transpiling of function failed: ${stripAnsi(formatBuildError(err))}`, {
|
|
104
99
|
cause: err,
|
|
105
100
|
});
|
|
106
101
|
}
|
|
@@ -4,7 +4,7 @@ export async function verifyHandler(result) {
|
|
|
4
4
|
}
|
|
5
5
|
const outputs = (Array.isArray(result) ? result : [result]).flatMap(({ output }) => output);
|
|
6
6
|
const bundledIndex = outputs.find((output) => output.type === 'chunk' && output.isEntry && output.fileName === 'index.js');
|
|
7
|
-
if (
|
|
7
|
+
if (bundledIndex?.type !== 'chunk') {
|
|
8
8
|
throw new Error('Unexpected build output, no bundled index found');
|
|
9
9
|
}
|
|
10
10
|
if (!bundledIndex.exports.includes('handler')) {
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -6,11 +6,13 @@ export declare function Logger(log: (msg: string) => void, flags?: {
|
|
|
6
6
|
}): {
|
|
7
7
|
(msg: string): void;
|
|
8
8
|
isTraceEnabled: boolean;
|
|
9
|
-
trace(formatter: unknown, ...args: unknown[])
|
|
10
|
-
verbose(formatter: unknown, ...args: unknown[])
|
|
11
|
-
info(formatter: unknown, ...args: unknown[])
|
|
12
|
-
warn(formatter: unknown, ...args: unknown[])
|
|
13
|
-
error(formatter: unknown, ...args: unknown[])
|
|
9
|
+
trace: (formatter: unknown, ...args: unknown[]) => void | false;
|
|
10
|
+
verbose: (formatter: unknown, ...args: unknown[]) => void | false;
|
|
11
|
+
info: (formatter: unknown, ...args: unknown[]) => void | false;
|
|
12
|
+
warn: (formatter: unknown, ...args: unknown[]) => void | false;
|
|
13
|
+
error: (formatter: unknown, ...args: unknown[]) => void | false;
|
|
14
|
+
showProgress: (percent?: number) => void;
|
|
15
|
+
clearProgress: () => void;
|
|
14
16
|
ora: typeof ora;
|
|
15
17
|
};
|
|
16
18
|
export type Logger = ReturnType<typeof Logger>;
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { format } from 'node:util';
|
|
2
2
|
import ora from 'ora';
|
|
3
|
+
import { clearProgress, showBusy, showError, showProgress } from './progress.js';
|
|
3
4
|
var LogLevel;
|
|
4
5
|
(function (LogLevel) {
|
|
5
6
|
LogLevel[LogLevel["TRACE"] = 0] = "TRACE";
|
|
@@ -19,16 +20,47 @@ export function Logger(log, flags = {}) {
|
|
|
19
20
|
logger.info = (formatter, ...args) => level <= LogLevel.INFO && logger(format(formatter, ...args));
|
|
20
21
|
logger.warn = (formatter, ...args) => level <= LogLevel.WARN && logger(format(formatter, ...args));
|
|
21
22
|
logger.error = (formatter, ...args) => level <= LogLevel.ERROR && logger(format(formatter, ...args));
|
|
23
|
+
logger.showProgress = (percent) => {
|
|
24
|
+
if (flags.json)
|
|
25
|
+
return;
|
|
26
|
+
if (percent === undefined)
|
|
27
|
+
showBusy();
|
|
28
|
+
else
|
|
29
|
+
showProgress(percent);
|
|
30
|
+
};
|
|
31
|
+
logger.clearProgress = () => {
|
|
32
|
+
if (flags.json)
|
|
33
|
+
return;
|
|
34
|
+
clearProgress();
|
|
35
|
+
};
|
|
22
36
|
const oraWrapper = (opts) => {
|
|
23
37
|
if (flags.json)
|
|
24
38
|
return createOraLineLoggingWrapper(opts, logger);
|
|
25
39
|
if (level >= LogLevel.INFO)
|
|
26
|
-
return ora(opts);
|
|
40
|
+
return withTerminalProgress(ora(opts));
|
|
27
41
|
return createOraLineLoggingWrapper(opts, logger);
|
|
28
42
|
};
|
|
29
43
|
logger.ora = oraWrapper;
|
|
30
44
|
return logger;
|
|
31
45
|
}
|
|
46
|
+
function withTerminalProgress(spinner) {
|
|
47
|
+
const wrap = (name, effect) => {
|
|
48
|
+
if (typeof spinner[name] !== 'function')
|
|
49
|
+
return;
|
|
50
|
+
const original = spinner[name].bind(spinner);
|
|
51
|
+
spinner[name] = (...args) => {
|
|
52
|
+
const result = original(...args);
|
|
53
|
+
effect();
|
|
54
|
+
return result;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
wrap('start', showBusy);
|
|
58
|
+
wrap('fail', showError);
|
|
59
|
+
for (const name of ['stop', 'succeed', 'warn', 'info', 'stopAndPersist']) {
|
|
60
|
+
wrap(name, clearProgress);
|
|
61
|
+
}
|
|
62
|
+
return spinner;
|
|
63
|
+
}
|
|
32
64
|
/**
|
|
33
65
|
* An ora-like wrapper that uses standard line output logging instead of rendering a spinner; used in verbose and trace modes.
|
|
34
66
|
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { stderr } from 'node:process';
|
|
2
|
+
import { onExit } from 'signal-exit';
|
|
3
|
+
const ST = '\x1b\\';
|
|
4
|
+
const STATES = {
|
|
5
|
+
clear: 0,
|
|
6
|
+
normal: 1,
|
|
7
|
+
error: 2,
|
|
8
|
+
paused: 4,
|
|
9
|
+
busy: 3,
|
|
10
|
+
};
|
|
11
|
+
let exitHookRegistered = false;
|
|
12
|
+
function write(state, value = 0) {
|
|
13
|
+
if (!stderr.isTTY)
|
|
14
|
+
return;
|
|
15
|
+
if (!exitHookRegistered) {
|
|
16
|
+
exitHookRegistered = true;
|
|
17
|
+
function clear() {
|
|
18
|
+
stderr.write(`\x1b]9;4;0;0${ST}`);
|
|
19
|
+
}
|
|
20
|
+
// arc/utils SIGINT handler clobbers our signal-exit; luckily it then calls process.exit()
|
|
21
|
+
process.once('exit', clear); // triggered by arc/utils SIGINT handler
|
|
22
|
+
onExit(clear); // triggered by all other exit paths
|
|
23
|
+
}
|
|
24
|
+
stderr.write(`\x1b]9;4;${STATES[state]};${Math.round(value)}${ST}`);
|
|
25
|
+
}
|
|
26
|
+
export function showProgress(percent) {
|
|
27
|
+
write('normal', Math.max(0, Math.min(100, percent)));
|
|
28
|
+
}
|
|
29
|
+
export function showBusy() {
|
|
30
|
+
write('busy');
|
|
31
|
+
}
|
|
32
|
+
export function showError() {
|
|
33
|
+
write('error', 100);
|
|
34
|
+
}
|
|
35
|
+
export function showPaused(percent) {
|
|
36
|
+
write('paused', Math.max(0, Math.min(100, percent)));
|
|
37
|
+
}
|
|
38
|
+
export function clearProgress() {
|
|
39
|
+
write('clear');
|
|
40
|
+
}
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -98,13 +98,14 @@ export interface InvokeGroqPayloadOptions {
|
|
|
98
98
|
before: Record<string, unknown> | null;
|
|
99
99
|
after: Record<string, unknown> | null;
|
|
100
100
|
}
|
|
101
|
-
export interface
|
|
101
|
+
export interface InvokeNonGroqPayloadOptions {
|
|
102
102
|
payload?: Record<string, unknown>;
|
|
103
|
-
event:
|
|
103
|
+
event: NonGroqEventType;
|
|
104
104
|
}
|
|
105
|
-
export type InvokePayloadOptions = InvokeGroqPayloadOptions |
|
|
106
|
-
export type InvokePayloadMetadata = Pick<InvokeGroqPayloadOptions, 'event' | 'before' | 'after'> | Pick<
|
|
105
|
+
export type InvokePayloadOptions = InvokeGroqPayloadOptions | InvokeNonGroqPayloadOptions;
|
|
106
|
+
export type InvokePayloadMetadata = Pick<InvokeGroqPayloadOptions, 'event' | 'before' | 'after'> | Pick<InvokeNonGroqPayloadOptions, 'event'>;
|
|
107
107
|
export type EventType = 'create' | 'update' | 'delete';
|
|
108
|
+
export type NonGroqEventType = 'scheduled' | 'nested';
|
|
108
109
|
export declare function isEventType(arg: string): arg is EventType;
|
|
109
110
|
/** @internal */
|
|
110
111
|
export interface InvokeGroqContextOptions {
|
|
@@ -125,6 +126,8 @@ export interface InvokeGroqContextOptions {
|
|
|
125
126
|
functionResourceId: string;
|
|
126
127
|
/** All resources declared by the blueprint, used to populate `context.resources` at invoke time. */
|
|
127
128
|
resources?: BlueprintResource[];
|
|
129
|
+
/** The directory where the blueprint manifest is located. */
|
|
130
|
+
blueprintFileDir: string;
|
|
128
131
|
}
|
|
129
132
|
/** @internal */
|
|
130
133
|
export interface InvokeScheduleContextOptions {
|
|
@@ -133,6 +136,8 @@ export interface InvokeScheduleContextOptions {
|
|
|
133
136
|
};
|
|
134
137
|
/** All resources declared by the blueprint, used to populate `context.resources` at invoke time. */
|
|
135
138
|
resources?: BlueprintResource[];
|
|
139
|
+
/** The directory where the blueprint manifest is located. */
|
|
140
|
+
blueprintFileDir: string;
|
|
136
141
|
}
|
|
137
142
|
export type InvokeContextOptions = InvokeGroqContextOptions | InvokeScheduleContextOptions;
|
|
138
143
|
export declare function isGroqContextOptions(context: InvokeContextOptions): context is InvokeGroqContextOptions;
|
|
@@ -140,7 +145,64 @@ export declare function isGroqContextOptions(context: InvokeContextOptions): con
|
|
|
140
145
|
export interface InvokeExecutionOptions {
|
|
141
146
|
forceColor?: boolean;
|
|
142
147
|
timeout?: number;
|
|
148
|
+
/**
|
|
149
|
+
* Callback used to resolve a nested `context.invoke(name, payload)` made from
|
|
150
|
+
* within a running function. When absent, nested invokes are rejected.
|
|
151
|
+
* @internal
|
|
152
|
+
*/
|
|
153
|
+
onNestedInvoke?: NestedInvoke;
|
|
154
|
+
/** Current invocation depth, used to bound nested `context.invoke` recursion. @internal */
|
|
155
|
+
depth?: number;
|
|
156
|
+
/** Function names already on the invoke call stack (innermost last), used to detect cycles. @internal */
|
|
157
|
+
callStack?: string[];
|
|
143
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Re-entrant callback that executes a named function from the blueprint on behalf
|
|
161
|
+
* of a nested `context.invoke(name, payload)` and returns its invocation result.
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
export type NestedInvoke = (name: string, payload: Record<string, unknown>, context: InvokeContextOptions, depth: number, callStack: string[]) => Promise<InvocationResponse & {
|
|
165
|
+
timings: Record<string, number>;
|
|
166
|
+
}>;
|
|
167
|
+
/**
|
|
168
|
+
* IPC messages sent from the parent (invoke-local) down to a function child process.
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
export type ParentToChildMessage = {
|
|
172
|
+
type: 'start';
|
|
173
|
+
srcPath: string;
|
|
174
|
+
payload: unknown;
|
|
175
|
+
} | {
|
|
176
|
+
type: 'invoke-response';
|
|
177
|
+
id: string;
|
|
178
|
+
ok: true;
|
|
179
|
+
result: {
|
|
180
|
+
json: JsonInvocationResponse | undefined;
|
|
181
|
+
};
|
|
182
|
+
} | {
|
|
183
|
+
type: 'invoke-response';
|
|
184
|
+
id: string;
|
|
185
|
+
ok: false;
|
|
186
|
+
error: InvocationError;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* IPC messages sent from a function child process back up to the parent.
|
|
190
|
+
* `result` is terminal and triggers shutdown; `invoke-request` is a nested
|
|
191
|
+
* `context.invoke` awaiting a correlated `invoke-response`.
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
export type ChildToParentMessage = {
|
|
195
|
+
type: 'invoke-request';
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
payload: Record<string, unknown>;
|
|
199
|
+
} | {
|
|
200
|
+
type: 'result';
|
|
201
|
+
json?: JsonInvocationResponse;
|
|
202
|
+
logs?: string;
|
|
203
|
+
errorLogs?: string;
|
|
204
|
+
error?: InvocationError;
|
|
205
|
+
};
|
|
144
206
|
/** @internal */
|
|
145
207
|
export interface InvocationResponse {
|
|
146
208
|
error: InvocationError | undefined;
|
|
@@ -207,7 +269,7 @@ export declare interface FetchConfig {
|
|
|
207
269
|
apiHost?: string;
|
|
208
270
|
apiVersion?: string;
|
|
209
271
|
}
|
|
210
|
-
export declare const INSTALLER_OPTIONS: readonly [
|
|
272
|
+
export declare const INSTALLER_OPTIONS: readonly ['npm', 'pnpm', 'yarn'];
|
|
211
273
|
export type InstallerType = 'npm' | 'pnpm' | 'yarn';
|
|
212
274
|
export type AssetPrepResult = {
|
|
213
275
|
success: true;
|
package/oclif.manifest.json
CHANGED
|
@@ -656,7 +656,7 @@
|
|
|
656
656
|
"blueprints:doctor": {
|
|
657
657
|
"aliases": [],
|
|
658
658
|
"args": {},
|
|
659
|
-
"description": "Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.\n\nRun this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.",
|
|
659
|
+
"description": "Analyzes your local Blueprint and remote Stack configuration for common issues, such as missing authentication, invalid project references, or misconfigured resources.\n\nRun this command when encountering errors with other Blueprint commands. Use --fix to interactively resolve detected issues.\n\nSupports --json for programmatic consumption of diagnostic results.",
|
|
660
660
|
"examples": [
|
|
661
661
|
"<%= config.bin %> <%= command.id %>",
|
|
662
662
|
"<%= config.bin %> <%= command.id %> --fix"
|
|
@@ -695,9 +695,10 @@
|
|
|
695
695
|
"type": "boolean"
|
|
696
696
|
},
|
|
697
697
|
"verbose": {
|
|
698
|
-
"description": "Verbose output
|
|
698
|
+
"description": "Verbose output",
|
|
699
|
+
"hidden": true,
|
|
699
700
|
"name": "verbose",
|
|
700
|
-
"allowNo":
|
|
701
|
+
"allowNo": false,
|
|
701
702
|
"type": "boolean"
|
|
702
703
|
},
|
|
703
704
|
"fix": {
|
|
@@ -2997,5 +2998,5 @@
|
|
|
2997
2998
|
]
|
|
2998
2999
|
}
|
|
2999
3000
|
},
|
|
3000
|
-
"version": "17.0.
|
|
3001
|
+
"version": "17.1.0-next.gcfbd613"
|
|
3001
3002
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/runtime-cli",
|
|
3
3
|
"description": "Sanity's Runtime CLI for Blueprints and Functions",
|
|
4
|
-
"version": "17.0.
|
|
4
|
+
"version": "17.1.0-next.gcfbd613",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,56 +58,57 @@
|
|
|
58
58
|
"watch": "tsc --watch"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@architect/hydrate": "~6.0.
|
|
62
|
-
"@architect/inventory": "~6.
|
|
61
|
+
"@architect/hydrate": "~6.0.2",
|
|
62
|
+
"@architect/inventory": "~6.1.0",
|
|
63
63
|
"@inquirer/prompts": "^8.5.2",
|
|
64
|
-
"@oclif/core": "^4.11.
|
|
65
|
-
"@oclif/plugin-help": "^6.2.
|
|
64
|
+
"@oclif/core": "^4.11.14",
|
|
65
|
+
"@oclif/plugin-help": "^6.2.53",
|
|
66
66
|
"@sanity-labs/design-tokens": "^0.0.2-alpha.2",
|
|
67
|
-
"@sanity/blueprints": "^0.
|
|
67
|
+
"@sanity/blueprints": "^0.22.0",
|
|
68
68
|
"@sanity/blueprints-parser": "^0.4.0",
|
|
69
|
-
"@sanity/client": "^7.
|
|
70
|
-
"adm-zip": "^0.
|
|
69
|
+
"@sanity/client": "^7.23.1",
|
|
70
|
+
"adm-zip": "^0.6.0",
|
|
71
71
|
"array-treeify": "^0.1.5",
|
|
72
72
|
"cardinal": "^2.1.1",
|
|
73
73
|
"empathic": "^2.0.1",
|
|
74
74
|
"eventsource": "^4.1.0",
|
|
75
|
-
"groq-js": "^1.30.
|
|
75
|
+
"groq-js": "^1.30.3",
|
|
76
76
|
"jiti": "^2.7.0",
|
|
77
77
|
"mime-types": "^3.0.2",
|
|
78
|
-
"ora": "^9.4.
|
|
78
|
+
"ora": "^9.4.1",
|
|
79
|
+
"signal-exit": "^4.1.0",
|
|
80
|
+
"strip-ansi": "^7.2.0",
|
|
79
81
|
"tar-stream": "^3.2.0",
|
|
80
|
-
"vite": "^8.
|
|
81
|
-
"ws": "^8.21.
|
|
82
|
+
"vite": "^8.1.4",
|
|
83
|
+
"ws": "^8.21.1",
|
|
82
84
|
"xdg-basedir": "^5.1.0"
|
|
83
85
|
},
|
|
84
86
|
"devDependencies": {
|
|
85
|
-
"@biomejs/biome": "2.
|
|
87
|
+
"@biomejs/biome": "2.5.3",
|
|
86
88
|
"@codemirror/lang-json": "^6.0.2",
|
|
87
|
-
"@codemirror/state": "^6.
|
|
89
|
+
"@codemirror/state": "^6.7.1",
|
|
88
90
|
"@enhance/store": "^1.0.2",
|
|
89
91
|
"@lezer/highlight": "^1.2.3",
|
|
90
|
-
"@oclif/test": "^4.1.
|
|
91
|
-
"@playwright/test": "^1.
|
|
92
|
+
"@oclif/test": "^4.1.20",
|
|
93
|
+
"@playwright/test": "^1.61.1",
|
|
92
94
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
93
|
-
"@sanity/functions": "^1.
|
|
95
|
+
"@sanity/functions": "^1.4.0",
|
|
94
96
|
"@types/adm-zip": "^0.5.8",
|
|
95
97
|
"@types/cardinal": "^2.1.1",
|
|
96
98
|
"@types/mime-types": "^3.0.1",
|
|
97
99
|
"@types/node": "^22",
|
|
98
100
|
"@types/tar-stream": "^3.1.4",
|
|
99
101
|
"@types/ws": "^8.18.1",
|
|
100
|
-
"@vitest/coverage-v8": "4.1.
|
|
102
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
101
103
|
"codemirror": "^6.0.2",
|
|
102
104
|
"mentoss": "^0.13.0",
|
|
103
|
-
"oclif": "^4.23.
|
|
105
|
+
"oclif": "^4.23.27",
|
|
104
106
|
"pretty-bytes": "^7.1.0",
|
|
105
107
|
"pretty-ms": "^9.3.0",
|
|
106
|
-
"rollup": "^4.
|
|
108
|
+
"rollup": "^4.62.2",
|
|
107
109
|
"shx": "^0.4.0",
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"vitest": "4.1.9"
|
|
110
|
+
"typescript": "^7.0.2",
|
|
111
|
+
"vitest": "4.1.10"
|
|
111
112
|
},
|
|
112
113
|
"oclif": {
|
|
113
114
|
"bin": "sanity-run",
|
|
@@ -129,5 +130,9 @@
|
|
|
129
130
|
"publishConfig": {
|
|
130
131
|
"access": "public",
|
|
131
132
|
"provenance": false
|
|
133
|
+
},
|
|
134
|
+
"allowScripts": {
|
|
135
|
+
"fsevents@2.3.2": true,
|
|
136
|
+
"fsevents@2.3.3": true
|
|
132
137
|
}
|
|
133
138
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import apiConstructor from '../api.js'
|
|
2
|
-
|
|
3
|
-
const api = apiConstructor()
|
|
4
|
-
|
|
5
|
-
// Create WebSocket connection.
|
|
6
|
-
const socket = new WebSocket('ws://localhost:8974')
|
|
7
|
-
|
|
8
|
-
// Connection opened
|
|
9
|
-
socket.addEventListener('open', () => {
|
|
10
|
-
console.log('Watching for Blueprint changes')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
// Listen for messages
|
|
14
|
-
socket.addEventListener('message', (event) => {
|
|
15
|
-
if (event.data === 'reload-blueprint') api.blueprint()
|
|
16
|
-
})
|