@sanity/runtime-cli 17.16.0-next.gfe46ad0 → 17.17.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 +19 -19
- package/dist/config.js +4 -1
- package/dist/cores/functions/logs.d.ts +7 -0
- package/dist/cores/functions/logs.js +29 -16
- package/dist/server/static/vendor/vendor.bundle.js +21 -42
- package/dist/utils/bundles/prepare-asset.js +38 -5
- package/dist/utils/functions/transpile/function.js +3 -0
- package/dist/utils/types.d.ts +2 -1
- package/oclif.manifest.json +1002 -1002
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ EXAMPLES
|
|
|
90
90
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
93
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/add.ts)_
|
|
94
94
|
|
|
95
95
|
## `sanity-run blueprints config`
|
|
96
96
|
|
|
@@ -127,7 +127,7 @@ EXAMPLES
|
|
|
127
127
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
130
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/config.ts)_
|
|
131
131
|
|
|
132
132
|
## `sanity-run blueprints deploy`
|
|
133
133
|
|
|
@@ -183,7 +183,7 @@ EXAMPLES
|
|
|
183
183
|
$ sanity-run blueprints deploy --new-stack-name <new-name>
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
186
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/deploy.ts)_
|
|
187
187
|
|
|
188
188
|
## `sanity-run blueprints destroy`
|
|
189
189
|
|
|
@@ -221,7 +221,7 @@ EXAMPLES
|
|
|
221
221
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
222
222
|
```
|
|
223
223
|
|
|
224
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
224
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/destroy.ts)_
|
|
225
225
|
|
|
226
226
|
## `sanity-run blueprints doctor`
|
|
227
227
|
|
|
@@ -253,7 +253,7 @@ EXAMPLES
|
|
|
253
253
|
$ sanity-run blueprints doctor --fix
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
256
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/doctor.ts)_
|
|
257
257
|
|
|
258
258
|
## `sanity-run blueprints info`
|
|
259
259
|
|
|
@@ -291,7 +291,7 @@ EXAMPLES
|
|
|
291
291
|
$ sanity-run blueprints info --organization-id <orgId> --stack <name-or-id>
|
|
292
292
|
```
|
|
293
293
|
|
|
294
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
294
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/info.ts)_
|
|
295
295
|
|
|
296
296
|
## `sanity-run blueprints init [DIR]`
|
|
297
297
|
|
|
@@ -355,7 +355,7 @@ EXAMPLES
|
|
|
355
355
|
$ sanity-run blueprints init old-stack --type <json|js|ts> --project-id <projectId> --stack-id <existingStackId>
|
|
356
356
|
```
|
|
357
357
|
|
|
358
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
358
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/init.ts)_
|
|
359
359
|
|
|
360
360
|
## `sanity-run blueprints logs`
|
|
361
361
|
|
|
@@ -401,7 +401,7 @@ EXAMPLES
|
|
|
401
401
|
$ sanity-run blueprints logs --before 2026-05-01T00:00:00Z
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
404
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/logs.ts)_
|
|
405
405
|
|
|
406
406
|
## `sanity-run blueprints mint-deploy-token`
|
|
407
407
|
|
|
@@ -446,7 +446,7 @@ EXAMPLES
|
|
|
446
446
|
$ sanity-run blueprints mint-deploy-token --organization-id <orgId>
|
|
447
447
|
```
|
|
448
448
|
|
|
449
|
-
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
449
|
+
_See code: [src/commands/blueprints/mint-deploy-token.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/mint-deploy-token.ts)_
|
|
450
450
|
|
|
451
451
|
## `sanity-run blueprints plan`
|
|
452
452
|
|
|
@@ -479,7 +479,7 @@ EXAMPLES
|
|
|
479
479
|
$ sanity-run blueprints plan --organization-id <orgId> --stack <name-or-id>
|
|
480
480
|
```
|
|
481
481
|
|
|
482
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
482
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/plan.ts)_
|
|
483
483
|
|
|
484
484
|
## `sanity-run blueprints promote`
|
|
485
485
|
|
|
@@ -515,7 +515,7 @@ EXAMPLES
|
|
|
515
515
|
$ sanity-run blueprints promote --new-stack-name <new-name>
|
|
516
516
|
```
|
|
517
517
|
|
|
518
|
-
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
518
|
+
_See code: [src/commands/blueprints/promote.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/promote.ts)_
|
|
519
519
|
|
|
520
520
|
## `sanity-run blueprints stacks`
|
|
521
521
|
|
|
@@ -556,7 +556,7 @@ EXAMPLES
|
|
|
556
556
|
$ sanity-run blueprints stacks --organization-id <organizationId> --include-projects
|
|
557
557
|
```
|
|
558
558
|
|
|
559
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
559
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/blueprints/stacks.ts)_
|
|
560
560
|
|
|
561
561
|
## `sanity-run functions add`
|
|
562
562
|
|
|
@@ -608,7 +608,7 @@ EXAMPLES
|
|
|
608
608
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
609
609
|
```
|
|
610
610
|
|
|
611
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
611
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/add.ts)_
|
|
612
612
|
|
|
613
613
|
## `sanity-run functions dev`
|
|
614
614
|
|
|
@@ -643,7 +643,7 @@ EXAMPLES
|
|
|
643
643
|
$ sanity-run functions dev --timeout 60
|
|
644
644
|
```
|
|
645
645
|
|
|
646
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
646
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/dev.ts)_
|
|
647
647
|
|
|
648
648
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
649
649
|
|
|
@@ -676,7 +676,7 @@ EXAMPLES
|
|
|
676
676
|
$ sanity-run functions env add --stack <name-or-id> MyFunction API_URL https://api.example.com/
|
|
677
677
|
```
|
|
678
678
|
|
|
679
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
679
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/env/add.ts)_
|
|
680
680
|
|
|
681
681
|
## `sanity-run functions env list NAME`
|
|
682
682
|
|
|
@@ -706,7 +706,7 @@ EXAMPLES
|
|
|
706
706
|
$ sanity-run functions env list --stack <name-or-id> MyFunction
|
|
707
707
|
```
|
|
708
708
|
|
|
709
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
709
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/env/list.ts)_
|
|
710
710
|
|
|
711
711
|
## `sanity-run functions env remove NAME KEY`
|
|
712
712
|
|
|
@@ -738,7 +738,7 @@ EXAMPLES
|
|
|
738
738
|
$ sanity-run functions env remove --stack <name-or-id> MyFunction API_URL
|
|
739
739
|
```
|
|
740
740
|
|
|
741
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
741
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/env/remove.ts)_
|
|
742
742
|
|
|
743
743
|
## `sanity-run functions logs [NAME]`
|
|
744
744
|
|
|
@@ -778,7 +778,7 @@ EXAMPLES
|
|
|
778
778
|
$ sanity-run functions logs <name> --delete
|
|
779
779
|
```
|
|
780
780
|
|
|
781
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
781
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/logs.ts)_
|
|
782
782
|
|
|
783
783
|
## `sanity-run functions test [NAME]`
|
|
784
784
|
|
|
@@ -836,7 +836,7 @@ EXAMPLES
|
|
|
836
836
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
837
837
|
```
|
|
838
838
|
|
|
839
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.
|
|
839
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v17.17.0/src/commands/functions/test.ts)_
|
|
840
840
|
|
|
841
841
|
## `sanity-run help [COMMAND]`
|
|
842
842
|
|
package/dist/config.js
CHANGED
|
@@ -38,7 +38,10 @@ const apiUrls = {
|
|
|
38
38
|
staging: 'https://api.sanity.work/',
|
|
39
39
|
default: 'http://api.sanity/',
|
|
40
40
|
};
|
|
41
|
-
const
|
|
41
|
+
const ensureTrailingSlash = (url) => (url.endsWith('/') ? url : `${url}/`);
|
|
42
|
+
const apiUrl = sanityEnv
|
|
43
|
+
? (apiUrls[sanityEnv] ?? ensureTrailingSlash(sanityEnv))
|
|
44
|
+
: apiUrls.default;
|
|
42
45
|
const studioDomains = {
|
|
43
46
|
production: 'sanity.studio',
|
|
44
47
|
staging: 'studio.sanity.work',
|
|
@@ -15,3 +15,10 @@ export interface FunctionLogsOptions extends DeployedBlueprintConfig {
|
|
|
15
15
|
helpText: string;
|
|
16
16
|
}
|
|
17
17
|
export declare function functionLogsCore(options: FunctionLogsOptions): Promise<CoreResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Formats a date as `[YYYY-MM-DD, HH:mm:ss]` in either UTC or local time.
|
|
20
|
+
* The shape is identical in both cases so `--utc` only changes the timezone.
|
|
21
|
+
* @param date
|
|
22
|
+
* @param utc
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatTimestamp(date: Date, utc: boolean | undefined): [string, string];
|
|
@@ -45,7 +45,7 @@ async function deleteLogs({ name, externalId, auth, force, log, }) {
|
|
|
45
45
|
spinner.succeed('Logs deleted');
|
|
46
46
|
return { success: true };
|
|
47
47
|
}
|
|
48
|
-
async function streamLogs({ name, externalId, auth, log, }) {
|
|
48
|
+
async function streamLogs({ name, externalId, auth, utc, log, }) {
|
|
49
49
|
const spinner = log.ora(`Setting up streaming logs session for function ${niceId(name)}`).start();
|
|
50
50
|
try {
|
|
51
51
|
spinner.stop();
|
|
@@ -58,7 +58,7 @@ async function streamLogs({ name, externalId, auth, log, }) {
|
|
|
58
58
|
alreadyOpened = true;
|
|
59
59
|
};
|
|
60
60
|
const renderLog = (logEntry) => {
|
|
61
|
-
log(formatLog(logEntry,
|
|
61
|
+
log(formatLog(logEntry, utc));
|
|
62
62
|
};
|
|
63
63
|
streamLogsAction(externalId, auth, renderLog, onOpen, (error) => log.error(`${styleText('red', 'Error:')} ${error}`), log);
|
|
64
64
|
// Return a special key for streaming mode
|
|
@@ -96,8 +96,8 @@ async function getLogs({ name, externalId, auth, limit, json, utc, log, }) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
const cleaned = filteredLogs.map(({ time, level, message, operationName, attempt, requestId, executionArn, }) => {
|
|
100
|
-
const isDurable = executionArn !== undefined;
|
|
99
|
+
const cleaned = filteredLogs.map(({ time, level, message, operationName, attempt, requestId, executionArn, executionId, }) => {
|
|
100
|
+
const isDurable = executionArn !== undefined || executionId !== undefined;
|
|
101
101
|
const isStep = operationName !== undefined || attempt !== undefined;
|
|
102
102
|
const durableContext = isDurable ? (isStep ? 'step' : 'handler') : undefined;
|
|
103
103
|
return {
|
|
@@ -120,12 +120,10 @@ async function getLogs({ name, externalId, auth, limit, json, utc, log, }) {
|
|
|
120
120
|
* @param utc
|
|
121
121
|
*/
|
|
122
122
|
function formatLog(entry, utc) {
|
|
123
|
-
const { time, level, message, operationName, attempt, executionArn } = entry;
|
|
124
|
-
const
|
|
125
|
-
const [dateString, timeString] = utc
|
|
126
|
-
|
|
127
|
-
: [date.toLocaleDateString(), date.toLocaleTimeString()];
|
|
128
|
-
const durableAnnotation = durableLogAnnotation({ operationName, attempt, executionArn });
|
|
123
|
+
const { time, level, message, operationName, attempt, executionArn, executionId } = entry;
|
|
124
|
+
const execId = executionId || executionArn;
|
|
125
|
+
const [dateString, timeString] = formatTimestamp(new Date(time), utc);
|
|
126
|
+
const durableAnnotation = durableLogAnnotation({ operationName, attempt, executionId: execId });
|
|
129
127
|
return [
|
|
130
128
|
styleText('bold', dateString),
|
|
131
129
|
styleText(['bold', 'blue'], timeString),
|
|
@@ -134,20 +132,35 @@ function formatLog(entry, utc) {
|
|
|
134
132
|
message,
|
|
135
133
|
].join(' ');
|
|
136
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Formats a date as `[YYYY-MM-DD, HH:mm:ss]` in either UTC or local time.
|
|
137
|
+
* The shape is identical in both cases so `--utc` only changes the timezone.
|
|
138
|
+
* @param date
|
|
139
|
+
* @param utc
|
|
140
|
+
*/
|
|
141
|
+
export function formatTimestamp(date, utc) {
|
|
142
|
+
if (utc)
|
|
143
|
+
return date.toISOString().slice(0, 19).split('T');
|
|
144
|
+
const pad = (n) => n.toString().padStart(2, '0');
|
|
145
|
+
const dateString = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
146
|
+
const timeString = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
|
|
147
|
+
return [dateString, timeString];
|
|
148
|
+
}
|
|
137
149
|
/**
|
|
138
150
|
* Log annotation for durable functions.
|
|
139
151
|
* @param operationName
|
|
140
152
|
* @param attempt
|
|
141
|
-
* @param
|
|
153
|
+
* @param executionId
|
|
142
154
|
*/
|
|
143
|
-
function durableLogAnnotation({ operationName, attempt, executionArn, }) {
|
|
155
|
+
function durableLogAnnotation({ operationName, attempt, executionArn, executionId, }) {
|
|
144
156
|
/**
|
|
145
|
-
*
|
|
146
|
-
* If
|
|
147
|
-
* If
|
|
157
|
+
* executionId is included on durable function logs, but not on regular function logs.
|
|
158
|
+
* If executionId is defined, we can assume the log is from a durable function.
|
|
159
|
+
* If executionId is defined and operationName and attempt are undefined, the logger is in the handler context
|
|
148
160
|
*/
|
|
161
|
+
const execId = executionId || executionArn;
|
|
149
162
|
const annotationParts = [
|
|
150
|
-
|
|
163
|
+
execId !== undefined && operationName === undefined && attempt === undefined
|
|
151
164
|
? 'handler'
|
|
152
165
|
: undefined,
|
|
153
166
|
...(operationName ? [operationName] : []),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// node_modules/@lezer/common/dist/index.js
|
|
2
2
|
/**
|
|
3
3
|
The default maximum length of a `TreeBuffer` node.
|
|
4
4
|
*/
|
|
@@ -1517,8 +1517,7 @@ var StringInput = class {
|
|
|
1517
1517
|
}
|
|
1518
1518
|
};
|
|
1519
1519
|
new NodeProp({ perNode: true });
|
|
1520
|
-
|
|
1521
|
-
//#region node_modules/@lezer/lr/dist/index.js
|
|
1520
|
+
// node_modules/@lezer/lr/dist/index.js
|
|
1522
1521
|
/**
|
|
1523
1522
|
A parse stack. These are used internally by the parser to track
|
|
1524
1523
|
parsing progress. They also provide some properties and methods
|
|
@@ -2963,8 +2962,7 @@ function getSpecializer(spec) {
|
|
|
2963
2962
|
}
|
|
2964
2963
|
return spec.get;
|
|
2965
2964
|
}
|
|
2966
|
-
|
|
2967
|
-
//#region node_modules/@lezer/highlight/dist/index.js
|
|
2965
|
+
// node_modules/@lezer/highlight/dist/index.js
|
|
2968
2966
|
var nextTagID = 0;
|
|
2969
2967
|
/**
|
|
2970
2968
|
Highlighting tags are markers that denote a highlighting category.
|
|
@@ -3836,8 +3834,7 @@ tagHighlighter([
|
|
|
3836
3834
|
class: "tok-punctuation"
|
|
3837
3835
|
}
|
|
3838
3836
|
]);
|
|
3839
|
-
|
|
3840
|
-
//#region node_modules/@lezer/json/dist/index.js
|
|
3837
|
+
// node_modules/@lezer/json/dist/index.js
|
|
3841
3838
|
var jsonHighlighting = styleTags({
|
|
3842
3839
|
String: tags.string,
|
|
3843
3840
|
Number: tags.number,
|
|
@@ -3886,8 +3883,7 @@ var parser = LRParser.deserialize({
|
|
|
3886
3883
|
topRules: { "JsonText": [0, 1] },
|
|
3887
3884
|
tokenPrec: 0
|
|
3888
3885
|
});
|
|
3889
|
-
|
|
3890
|
-
//#region node_modules/@marijn/find-cluster-break/src/index.js
|
|
3886
|
+
// node_modules/@marijn/find-cluster-break/src/index.js
|
|
3891
3887
|
var rangeFrom = [];
|
|
3892
3888
|
var rangeTo = [];
|
|
3893
3889
|
(() => {
|
|
@@ -3957,8 +3953,7 @@ function surrogateHigh$1(ch) {
|
|
|
3957
3953
|
function codePointSize$1(code) {
|
|
3958
3954
|
return code < 65536 ? 1 : 2;
|
|
3959
3955
|
}
|
|
3960
|
-
|
|
3961
|
-
//#region node_modules/@codemirror/state/dist/index.js
|
|
3956
|
+
// node_modules/@codemirror/state/dist/index.js
|
|
3962
3957
|
/**
|
|
3963
3958
|
The data structure for documents. @nonabstract
|
|
3964
3959
|
*/
|
|
@@ -7368,8 +7363,7 @@ function findColumn(string, col, tabSize, strict) {
|
|
|
7368
7363
|
}
|
|
7369
7364
|
return strict === true ? -1 : string.length;
|
|
7370
7365
|
}
|
|
7371
|
-
|
|
7372
|
-
//#region node_modules/style-mod/src/style-mod.js
|
|
7366
|
+
// node_modules/style-mod/src/style-mod.js
|
|
7373
7367
|
var C = "ͼ";
|
|
7374
7368
|
var COUNT = typeof Symbol == "undefined" ? "__ͼ" : Symbol.for(C);
|
|
7375
7369
|
var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : Symbol("styleSet");
|
|
@@ -7460,8 +7454,7 @@ var StyleSet = class {
|
|
|
7460
7454
|
if (this.styleTag && this.styleTag.getAttribute("nonce") != nonce) this.styleTag.setAttribute("nonce", nonce);
|
|
7461
7455
|
}
|
|
7462
7456
|
};
|
|
7463
|
-
|
|
7464
|
-
//#region node_modules/w3c-keyname/index.js
|
|
7457
|
+
// node_modules/w3c-keyname/index.js
|
|
7465
7458
|
var base = {
|
|
7466
7459
|
8: "Backspace",
|
|
7467
7460
|
9: "Tab",
|
|
@@ -7561,8 +7554,7 @@ function keyName(event) {
|
|
|
7561
7554
|
if (name == "Down") name = "ArrowDown";
|
|
7562
7555
|
return name;
|
|
7563
7556
|
}
|
|
7564
|
-
|
|
7565
|
-
//#region node_modules/crelt/index.js
|
|
7557
|
+
// node_modules/crelt/index.js
|
|
7566
7558
|
function crelt() {
|
|
7567
7559
|
var elt = arguments[0];
|
|
7568
7560
|
if (typeof elt == "string") elt = document.createElement(elt);
|
|
@@ -7584,8 +7576,7 @@ function add(elt, child) {
|
|
|
7584
7576
|
else if (Array.isArray(child)) for (var i = 0; i < child.length; i++) add(elt, child[i]);
|
|
7585
7577
|
else throw new RangeError("Unsupported child node: " + child);
|
|
7586
7578
|
}
|
|
7587
|
-
|
|
7588
|
-
//#region node_modules/@codemirror/view/dist/index.js
|
|
7579
|
+
// node_modules/@codemirror/view/dist/index.js
|
|
7589
7580
|
var nav = typeof navigator != "undefined" ? navigator : {
|
|
7590
7581
|
userAgent: "",
|
|
7591
7582
|
vendor: "",
|
|
@@ -17373,8 +17364,7 @@ line](https://codemirror.net/6/docs/ref/#view.highlightActiveLine).
|
|
|
17373
17364
|
function highlightActiveLineGutter() {
|
|
17374
17365
|
return activeLineGutterHighlighter;
|
|
17375
17366
|
}
|
|
17376
|
-
|
|
17377
|
-
//#region node_modules/@codemirror/language/dist/index.js
|
|
17367
|
+
// node_modules/@codemirror/language/dist/index.js
|
|
17378
17368
|
var _a;
|
|
17379
17369
|
/**
|
|
17380
17370
|
Node prop stored in a parser's top syntax node to provide the
|
|
@@ -19120,8 +19110,7 @@ function createTokenType(extra, tagStr) {
|
|
|
19120
19110
|
return type.id;
|
|
19121
19111
|
}
|
|
19122
19112
|
Direction.RTL, Direction.LTR;
|
|
19123
|
-
|
|
19124
|
-
//#region node_modules/@codemirror/lang-json/dist/index.js
|
|
19113
|
+
// node_modules/@codemirror/lang-json/dist/index.js
|
|
19125
19114
|
/**
|
|
19126
19115
|
A language provider that provides JSON parsing.
|
|
19127
19116
|
*/
|
|
@@ -19146,8 +19135,7 @@ JSON language support.
|
|
|
19146
19135
|
function json() {
|
|
19147
19136
|
return new LanguageSupport(jsonLanguage);
|
|
19148
19137
|
}
|
|
19149
|
-
|
|
19150
|
-
//#region node_modules/@enhance/store/index.mjs
|
|
19138
|
+
// node_modules/@enhance/store/index.mjs
|
|
19151
19139
|
var _state = {};
|
|
19152
19140
|
var dirtyProps = [];
|
|
19153
19141
|
var listeners = [];
|
|
@@ -19217,8 +19205,7 @@ function notify() {
|
|
|
19217
19205
|
});
|
|
19218
19206
|
dirtyProps.length = 0;
|
|
19219
19207
|
}
|
|
19220
|
-
|
|
19221
|
-
//#region node_modules/@codemirror/commands/dist/index.js
|
|
19208
|
+
// node_modules/@codemirror/commands/dist/index.js
|
|
19222
19209
|
/**
|
|
19223
19210
|
Comment or uncomment the current selection. Will use line comments
|
|
19224
19211
|
if available, otherwise falling back to block comments.
|
|
@@ -20929,8 +20916,7 @@ var defaultKeymap = /*@__PURE__*/ [
|
|
|
20929
20916
|
run: toggleTabFocusMode
|
|
20930
20917
|
}
|
|
20931
20918
|
].concat(standardKeymap);
|
|
20932
|
-
|
|
20933
|
-
//#region node_modules/@codemirror/search/dist/index.js
|
|
20919
|
+
// node_modules/@codemirror/search/dist/index.js
|
|
20934
20920
|
var basicNormalize = typeof String.prototype.normalize == "function" ? (x) => x.normalize("NFKD") : (x) => x;
|
|
20935
20921
|
/**
|
|
20936
20922
|
A search cursor provides an iterator over text matches in a
|
|
@@ -22070,8 +22056,7 @@ var searchExtensions = [
|
|
|
22070
22056
|
/*@__PURE__*/ Prec.low(searchHighlighter),
|
|
22071
22057
|
baseTheme$2
|
|
22072
22058
|
];
|
|
22073
|
-
|
|
22074
|
-
//#region node_modules/@codemirror/autocomplete/dist/index.js
|
|
22059
|
+
// node_modules/@codemirror/autocomplete/dist/index.js
|
|
22075
22060
|
/**
|
|
22076
22061
|
An instance of this is passed to completion source functions.
|
|
22077
22062
|
*/
|
|
@@ -23549,8 +23534,7 @@ var completionKeymap = [
|
|
|
23549
23534
|
}
|
|
23550
23535
|
];
|
|
23551
23536
|
var completionKeymapExt = /*@__PURE__*/ Prec.highest(/*@__PURE__*/ keymap.computeN([completionConfig], (state) => state.facet(completionConfig).defaultKeymap ? [completionKeymap] : []));
|
|
23552
|
-
|
|
23553
|
-
//#region node_modules/@codemirror/lint/dist/index.js
|
|
23537
|
+
// node_modules/@codemirror/lint/dist/index.js
|
|
23554
23538
|
var SelectedDiagnostic = class {
|
|
23555
23539
|
constructor(from, to, diagnostic) {
|
|
23556
23540
|
this.from = from;
|
|
@@ -24112,8 +24096,7 @@ var lintExtensions = [
|
|
|
24112
24096
|
lintHover,
|
|
24113
24097
|
baseTheme
|
|
24114
24098
|
];
|
|
24115
|
-
|
|
24116
|
-
//#region node_modules/codemirror/dist/index.js
|
|
24099
|
+
// node_modules/codemirror/dist/index.js
|
|
24117
24100
|
/**
|
|
24118
24101
|
This is an extension value that just pulls together a number of
|
|
24119
24102
|
extensions that you might want in a basic editor. It is meant as a
|
|
@@ -24179,8 +24162,7 @@ var basicSetup = /*@__PURE__*/ (() => [
|
|
|
24179
24162
|
...lintKeymap
|
|
24180
24163
|
])
|
|
24181
24164
|
])();
|
|
24182
|
-
|
|
24183
|
-
//#region node_modules/pretty-bytes/index.js
|
|
24165
|
+
// node_modules/pretty-bytes/index.js
|
|
24184
24166
|
var BYTE_UNITS = [
|
|
24185
24167
|
"B",
|
|
24186
24168
|
"kB",
|
|
@@ -24296,8 +24278,7 @@ function prettyBytes(number, options) {
|
|
|
24296
24278
|
}
|
|
24297
24279
|
return applyFixedWidth(prefix + toLocaleString(number, options.locale, localeOptions) + separator + UNITS[exponent], options.fixedWidth);
|
|
24298
24280
|
}
|
|
24299
|
-
|
|
24300
|
-
//#region node_modules/parse-ms/index.js
|
|
24281
|
+
// node_modules/parse-ms/index.js
|
|
24301
24282
|
var toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;
|
|
24302
24283
|
function parseNumber(milliseconds) {
|
|
24303
24284
|
return {
|
|
@@ -24330,8 +24311,7 @@ function parseMilliseconds(milliseconds) {
|
|
|
24330
24311
|
}
|
|
24331
24312
|
throw new TypeError("Expected a finite number or bigint");
|
|
24332
24313
|
}
|
|
24333
|
-
|
|
24334
|
-
//#region node_modules/pretty-ms/index.js
|
|
24314
|
+
// node_modules/pretty-ms/index.js
|
|
24335
24315
|
var isZero = (value) => value === 0 || value === 0n;
|
|
24336
24316
|
var pluralize = (word, count) => count === 1 || count === 1n ? word : `${word}s`;
|
|
24337
24317
|
var SECOND_ROUNDING_EPSILON = 1e-7;
|
|
@@ -24410,5 +24390,4 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
24410
24390
|
if (typeof options.unitCount === "number") result = result.slice(0, Math.max(options.unitCount, 1));
|
|
24411
24391
|
return sign + result.join(separator);
|
|
24412
24392
|
}
|
|
24413
|
-
//#endregion
|
|
24414
24393
|
export { Compartment, EditorState, EditorView, HighlightStyle, Store, basicSetup, json, prettyBytes, prettyMilliseconds, syntaxHighlighting, tags };
|
|
@@ -5,6 +5,7 @@ import path, { basename, dirname, join } from 'node:path';
|
|
|
5
5
|
import { pipeline } from 'node:stream/promises';
|
|
6
6
|
import { createGzip } from 'node:zlib';
|
|
7
7
|
import { buildApp, buildStudio, compareDependencyVersions, } from '@sanity/cli-build/_internal/build';
|
|
8
|
+
import { buildStudioSchemasAndManifests } from '@sanity/cli-build/_internal/extract';
|
|
8
9
|
import { getLocalPackageVersion } from '@sanity/cli-core';
|
|
9
10
|
import { pack } from 'tar-fs';
|
|
10
11
|
export const BUNDLE_SPECS = {
|
|
@@ -105,8 +106,15 @@ export async function prepareBundleAsset({ blueprintFileDir, resolvedResource, }
|
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
async function buildStudioBundle({ resource, appId, workDir, outDir, output, eventListener, }) {
|
|
109
|
+
// this has been checked before we got here but this helps the type checker
|
|
110
|
+
if (!appId)
|
|
111
|
+
throw new Error(`Unable to determine appId for ${resource.type} resource '${resource.name}'`);
|
|
112
|
+
// currently we only support hard-coded project, support for dynamic project id to be added
|
|
113
|
+
const projectId = resource.project;
|
|
114
|
+
if (!projectId || projectId.startsWith('$.'))
|
|
115
|
+
throw new Error(`Unable to determine project for ${resource.type} resource '${resource.name}'`);
|
|
108
116
|
let mismatchedPackages;
|
|
109
|
-
await buildStudio({
|
|
117
|
+
const { mfManifest } = await buildStudio({
|
|
110
118
|
appId,
|
|
111
119
|
autoUpdatesEnabled: resource.autoUpdates.enabled,
|
|
112
120
|
checkAppId() { },
|
|
@@ -118,10 +126,12 @@ async function buildStudioBundle({ resource, appId, workDir, outDir, output, eve
|
|
|
118
126
|
determineBasePath() {
|
|
119
127
|
return resource.basePath ?? '/';
|
|
120
128
|
},
|
|
121
|
-
// a studio is a standalone app, not a workbench module-federation app
|
|
122
129
|
isApp: false,
|
|
123
130
|
isBlueprints: true,
|
|
124
|
-
|
|
131
|
+
// federated so the build emits mf-manifest.json for Brett; like `sanity build` for a
|
|
132
|
+
// `defineApplication` studio, this drops the auto-updates import map
|
|
133
|
+
isWorkbenchApp: true,
|
|
134
|
+
workbenchAppId: appId,
|
|
125
135
|
minify: resource.minify ?? true,
|
|
126
136
|
outDir,
|
|
127
137
|
output,
|
|
@@ -135,6 +145,21 @@ async function buildStudioBundle({ resource, appId, workDir, outDir, output, eve
|
|
|
135
145
|
workDir,
|
|
136
146
|
eventListener,
|
|
137
147
|
});
|
|
148
|
+
if (mfManifest) {
|
|
149
|
+
resource.mfManifest = mfManifest;
|
|
150
|
+
}
|
|
151
|
+
const { schemaInputs } = await buildStudioSchemasAndManifests(appId, {
|
|
152
|
+
configPath: resource.root,
|
|
153
|
+
isExternal: false,
|
|
154
|
+
outPath: outDir,
|
|
155
|
+
projectId,
|
|
156
|
+
schemaRequired: false,
|
|
157
|
+
verbose: false,
|
|
158
|
+
workDir,
|
|
159
|
+
});
|
|
160
|
+
if (schemaInputs) {
|
|
161
|
+
resource.schemaInputs = schemaInputs;
|
|
162
|
+
}
|
|
138
163
|
return { mismatchedPackages };
|
|
139
164
|
}
|
|
140
165
|
async function buildApplicationBundle({ resource, appId, workDir, outDir, output, eventListener, }) {
|
|
@@ -143,7 +168,7 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
|
|
|
143
168
|
if (extraWindow) {
|
|
144
169
|
throw new Error(`Application resource '${resource.name}' declares more than one window view; at most one is allowed`);
|
|
145
170
|
}
|
|
146
|
-
await buildApp({
|
|
171
|
+
const { mfManifest } = await buildApp({
|
|
147
172
|
...sharedBuildAppOptions({ appId, workDir, outDir, output, eventListener }),
|
|
148
173
|
appId,
|
|
149
174
|
appTitle: resource.title,
|
|
@@ -154,11 +179,14 @@ async function buildApplicationBundle({ resource, appId, workDir, outDir, output
|
|
|
154
179
|
webWorkers: resource.webWorkers,
|
|
155
180
|
},
|
|
156
181
|
});
|
|
182
|
+
if (mfManifest) {
|
|
183
|
+
resource.mfManifest = mfManifest;
|
|
184
|
+
}
|
|
157
185
|
// a workbench app never auto-updates, so no dependency mismatches are compared
|
|
158
186
|
return {};
|
|
159
187
|
}
|
|
160
188
|
async function buildInstallationConfigBundle({ resource, workDir, outDir, output, eventListener, }) {
|
|
161
|
-
await buildApp({
|
|
189
|
+
const { mfManifest } = await buildApp({
|
|
162
190
|
...sharedBuildAppOptions({ appId: undefined, workDir, outDir, output, eventListener }),
|
|
163
191
|
appId: undefined,
|
|
164
192
|
appTitle: undefined,
|
|
@@ -166,6 +194,9 @@ async function buildInstallationConfigBundle({ resource, workDir, outDir, output
|
|
|
166
194
|
workbenchAppId: undefined,
|
|
167
195
|
exposes: { config: { appType: resource.appType, fields: resource.fields } },
|
|
168
196
|
});
|
|
197
|
+
if (mfManifest) {
|
|
198
|
+
resource.mfManifest = mfManifest;
|
|
199
|
+
}
|
|
169
200
|
return {};
|
|
170
201
|
}
|
|
171
202
|
// Options a workbench build (application or installation config) always sets the
|
|
@@ -248,6 +279,8 @@ function createSilentOutput() {
|
|
|
248
279
|
return undefined;
|
|
249
280
|
},
|
|
250
281
|
log() { },
|
|
282
|
+
logDiagnostic(_message) { },
|
|
283
|
+
logJson(_json) { },
|
|
251
284
|
warn(input) {
|
|
252
285
|
return input;
|
|
253
286
|
},
|
|
@@ -37,6 +37,9 @@ export async function transpileFunction({ resource, functionPath, entryPoint, in
|
|
|
37
37
|
const bundle = !!find.file('pnpm-workspace.yaml') || installer === 'pnpm';
|
|
38
38
|
const result = await viteBuild({
|
|
39
39
|
root: fnRootDir,
|
|
40
|
+
// Don't pick up the surrounding project's public/ folder or vite.config.*
|
|
41
|
+
publicDir: false,
|
|
42
|
+
configFile: false,
|
|
40
43
|
logLevel: 'silent',
|
|
41
44
|
build: {
|
|
42
45
|
target: 'node20',
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -294,9 +294,10 @@ export interface FunctionLog {
|
|
|
294
294
|
attempt?: number;
|
|
295
295
|
operationId?: string;
|
|
296
296
|
executionArn?: string;
|
|
297
|
+
executionId?: string;
|
|
297
298
|
}
|
|
298
299
|
/** @internal */
|
|
299
|
-
export type FunctionLogJson = Omit<FunctionLog, 'executionArn' | 'operationId' | 'operationName'> & {
|
|
300
|
+
export type FunctionLogJson = Omit<FunctionLog, 'executionArn' | 'executionId' | 'operationId' | 'operationName'> & {
|
|
300
301
|
durableContext?: 'handler' | 'step';
|
|
301
302
|
step?: string;
|
|
302
303
|
};
|