@sanity/runtime-cli 6.2.1 → 6.2.2

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 CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
20
20
  $ sanity-run COMMAND
21
21
  running command...
22
22
  $ sanity-run (--version)
23
- @sanity/runtime-cli/6.2.1 linux-x64 node-v22.15.0
23
+ @sanity/runtime-cli/6.2.2 linux-x64 node-v22.15.0
24
24
  $ sanity-run --help [COMMAND]
25
25
  USAGE
26
26
  $ sanity-run COMMAND
@@ -77,7 +77,7 @@ EXAMPLES
77
77
  $ sanity-run blueprints add function --name my-function --fn-type document-publish --lang js
78
78
  ```
79
79
 
80
- _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/add.ts)_
80
+ _See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/add.ts)_
81
81
 
82
82
  ## `sanity-run blueprints config`
83
83
 
@@ -105,7 +105,7 @@ EXAMPLES
105
105
  $ sanity-run blueprints config --edit --project-id <projectId>
106
106
  ```
107
107
 
108
- _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/config.ts)_
108
+ _See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/config.ts)_
109
109
 
110
110
  ## `sanity-run blueprints deploy`
111
111
 
@@ -127,7 +127,7 @@ EXAMPLES
127
127
  $ sanity-run blueprints deploy --no-wait
128
128
  ```
129
129
 
130
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/deploy.ts)_
130
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/deploy.ts)_
131
131
 
132
132
  ## `sanity-run blueprints destroy`
133
133
 
@@ -148,7 +148,7 @@ EXAMPLES
148
148
  $ sanity-run blueprints destroy
149
149
  ```
150
150
 
151
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/destroy.ts)_
151
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/destroy.ts)_
152
152
 
153
153
  ## `sanity-run blueprints info`
154
154
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ sanity-run blueprints info
166
166
  ```
167
167
 
168
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/info.ts)_
168
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/info.ts)_
169
169
 
170
170
  ## `sanity-run blueprints init [DIR]`
171
171
 
@@ -197,7 +197,7 @@ EXAMPLES
197
197
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --project-id <projectId>
198
198
  ```
199
199
 
200
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/init.ts)_
200
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/init.ts)_
201
201
 
202
202
  ## `sanity-run blueprints logs`
203
203
 
@@ -219,7 +219,7 @@ EXAMPLES
219
219
  $ sanity-run blueprints logs --watch
220
220
  ```
221
221
 
222
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/logs.ts)_
222
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/logs.ts)_
223
223
 
224
224
  ## `sanity-run blueprints plan`
225
225
 
@@ -236,7 +236,7 @@ EXAMPLES
236
236
  $ sanity-run blueprints plan
237
237
  ```
238
238
 
239
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/blueprints/plan.ts)_
239
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/blueprints/plan.ts)_
240
240
 
241
241
  ## `sanity-run functions dev`
242
242
 
@@ -256,7 +256,7 @@ EXAMPLES
256
256
  $ sanity-run functions dev --port 8974
257
257
  ```
258
258
 
259
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/dev.ts)_
259
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/dev.ts)_
260
260
 
261
261
  ## `sanity-run functions env add NAME KEY VALUE`
262
262
 
@@ -278,7 +278,7 @@ EXAMPLES
278
278
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
279
279
  ```
280
280
 
281
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/add.ts)_
281
+ _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/env/add.ts)_
282
282
 
283
283
  ## `sanity-run functions env list NAME`
284
284
 
@@ -298,7 +298,7 @@ EXAMPLES
298
298
  $ sanity-run functions env list MyFunction
299
299
  ```
300
300
 
301
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/list.ts)_
301
+ _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/env/list.ts)_
302
302
 
303
303
  ## `sanity-run functions env remove NAME KEY`
304
304
 
@@ -319,7 +319,7 @@ EXAMPLES
319
319
  $ sanity-run functions env remove MyFunction API_URL
320
320
  ```
321
321
 
322
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/env/remove.ts)_
322
+ _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/env/remove.ts)_
323
323
 
324
324
  ## `sanity-run functions logs NAME`
325
325
 
@@ -352,7 +352,7 @@ EXAMPLES
352
352
  $ sanity-run functions logs <name> --delete
353
353
  ```
354
354
 
355
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/logs.ts)_
355
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/logs.ts)_
356
356
 
357
357
  ## `sanity-run functions test NAME`
358
358
 
@@ -385,7 +385,7 @@ EXAMPLES
385
385
  $ sanity-run functions test <name> --data '{ "id": 1 }' --timeout 60
386
386
  ```
387
387
 
388
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.1/src/commands/functions/test.ts)_
388
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v6.2.2/src/commands/functions/test.ts)_
389
389
 
390
390
  ## `sanity-run help [COMMAND]`
391
391
 
@@ -59,31 +59,31 @@ export async function readLocalBlueprint(blueprintPath) {
59
59
  const blueprintFile = findBlueprintFile(blueprintPath);
60
60
  if (!blueprintFile)
61
61
  throw Error('Could not find Blueprint file! Use the init command.');
62
- const { blueprintFilePath: foundPath, fileName, extension } = blueprintFile;
62
+ const { blueprintFilePath: foundFilePath, fileName, extension } = blueprintFile;
63
63
  let rawBlueprint;
64
64
  let blueprintModule;
65
65
  try {
66
66
  switch (extension) {
67
67
  case '.json': {
68
- const blueprintString = readFileSync(foundPath, 'utf8').toString();
68
+ const blueprintString = readFileSync(foundFilePath, 'utf8').toString();
69
69
  rawBlueprint = JSON.parse(blueprintString);
70
70
  break;
71
71
  }
72
72
  case '.js':
73
73
  case '.mjs': {
74
- const module = await import(foundPath);
74
+ const module = await import(foundFilePath);
75
75
  blueprintModule = module.default;
76
76
  break;
77
77
  }
78
78
  case '.cjs': {
79
79
  const require = createRequire(import.meta.url);
80
- blueprintModule = require(foundPath);
80
+ blueprintModule = require(foundFilePath);
81
81
  break;
82
82
  }
83
83
  case '.ts': {
84
84
  try {
85
85
  const { tsImport } = await import('tsx/esm/api');
86
- const module = await tsImport(foundPath, dirname(foundPath));
86
+ const module = await tsImport(`file://${foundFilePath}`, dirname(foundFilePath));
87
87
  blueprintModule = module.default;
88
88
  }
89
89
  catch (err) {
@@ -98,7 +98,7 @@ export async function readLocalBlueprint(blueprintPath) {
98
98
  throw Error(`Unsupported blueprint file extension: ${extension}`);
99
99
  }
100
100
  }
101
- catch {
101
+ catch (err) {
102
102
  throw Error(`Error parsing Blueprint file: ${fileName}`);
103
103
  }
104
104
  if (blueprintModule) {
@@ -107,7 +107,7 @@ export async function readLocalBlueprint(blueprintPath) {
107
107
  try {
108
108
  rawBlueprint = blueprintModule();
109
109
  }
110
- catch (err) {
110
+ catch {
111
111
  throw Error(`Error executing Blueprint file: ${fileName}`);
112
112
  }
113
113
  }
@@ -121,7 +121,7 @@ export async function readLocalBlueprint(blueprintPath) {
121
121
  const fnErrors = functionResources.map((r) => validateFunctionResource(r));
122
122
  errors.push(...fnErrors.flat());
123
123
  }
124
- const configIds = readConfigFile(foundPath);
124
+ const configIds = readConfigFile(foundFilePath);
125
125
  const configPath = configIds?.configPath;
126
126
  let projectId;
127
127
  if (configIds?.projectId)
@@ -133,7 +133,7 @@ export async function readLocalBlueprint(blueprintPath) {
133
133
  if (!stackId && projectId)
134
134
  stackId = `ST-${projectId}`;
135
135
  return {
136
- fileInfo: { blueprintFilePath: foundPath, fileName, extension },
136
+ fileInfo: { blueprintFilePath: foundFilePath, fileName, extension },
137
137
  rawBlueprint: rawBlueprint,
138
138
  errors,
139
139
  projectId,
@@ -1 +1 @@
1
- export function getFunctionSource(src: any): any;
1
+ export function getFunctionSource(src: any): string;
@@ -10,9 +10,9 @@ export function getFunctionSource(src) {
10
10
  if (!existsSync(indexPath)) {
11
11
  throw Error(`Function directory ${pathToCheck} has no index.js`)
12
12
  }
13
- return indexPath
13
+ return `file://${indexPath}`
14
14
  }
15
- return pathToCheck
15
+ return `file://${pathToCheck}`
16
16
  }
17
17
 
18
18
  // Start when payload data arrives from parent process
@@ -2,12 +2,13 @@ import { spawn } from 'node:child_process';
2
2
  import { performance } from 'node:perf_hooks';
3
3
  import { cwd } from 'node:process';
4
4
  import { setTimeout } from 'node:timers';
5
+ import { fileURLToPath } from 'node:url';
5
6
  import config from '../config.js';
6
7
  import { bundleFunction } from './bundle/bundle-function.js';
7
8
  import { findFunctionEntryPoint } from './functions/find-entry-point.js';
8
9
  import { shouldBundleFunction } from './functions/should-bundle.js';
9
10
  function getChildProcessWrapperPath() {
10
- return new URL('./child-process-wrapper.js', import.meta.url).pathname;
11
+ return fileURLToPath(new URL('./child-process-wrapper.js', import.meta.url));
11
12
  }
12
13
  export function sanitizeLogs(logs) {
13
14
  return logs.replace(/([a-zA-Z0-9]{10})[a-zA-Z0-9]{65,}/g, '$1**********');
@@ -790,5 +790,5 @@
790
790
  ]
791
791
  }
792
792
  },
793
- "version": "6.2.1"
793
+ "version": "6.2.2"
794
794
  }
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": "6.2.1",
4
+ "version": "6.2.2",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",