@devvit/build-pack 0.11.19-next-2025-07-22-23-31-05-5dbdec031.0 → 0.11.19
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-spec-util.d.ts","sourceRoot":"","sources":["../../src/esbuild/dependency-spec-util.ts"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,EACzC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAC7B,cAAc,
|
|
1
|
+
{"version":3,"file":"dependency-spec-util.d.ts","sourceRoot":"","sources":["../../src/esbuild/dependency-spec-util.ts"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAC9B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,EACzC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAC7B,cAAc,CAsGhB"}
|
|
@@ -36,11 +36,9 @@ export function createDependencySpec(actorSpec, config, namespace) {
|
|
|
36
36
|
use(spec, FlairDefinition, GraphQLDefinition, LinksAndCommentsDefinition, ListingsDefinition, ModerationDefinition, ModNoteDefinition, NewModmailDefinition, PrivateMessagesDefinition, SubredditsDefinition, UsersDefinition, WidgetsDefinition, WikiDefinition);
|
|
37
37
|
if (config.permissions.reddit.scope === 'moderator')
|
|
38
38
|
use(spec, ModlogDefinition);
|
|
39
|
-
if (config.permissions.reddit.
|
|
39
|
+
if (config.permissions.reddit.asUser.length > 0) {
|
|
40
40
|
use(spec, UserActionsDefinition);
|
|
41
|
-
|
|
42
|
-
permissions.asUserScopes.push(...config.permissions.reddit.asUser);
|
|
43
|
-
}
|
|
41
|
+
permissions.asUserScopes.push(...config.permissions.reddit.asUser);
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
if (config.permissions.redis)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.template.d.ts","sourceRoot":"","sources":["../../../src/esbuild/templatizer/blocks.template.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,MAAM,EACN,KAAK,OAAO,EAKb,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"blocks.template.d.ts","sourceRoot":"","sources":["../../../src/esbuild/templatizer/blocks.template.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,MAAM,EACN,KAAK,OAAO,EAKb,MAAM,oBAAoB,CAAC;AAK5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAiBtE,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;CAAO,CAAC;AA8F7D,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CA4D/D;AA+JD,eAAe,MAAM,CAAC"}
|
|
@@ -3,11 +3,9 @@ import { Devvit, useWebView, } from '@devvit/public-api';
|
|
|
3
3
|
import { getServerPort } from '@devvit/server';
|
|
4
4
|
import { getDevvitConfig } from '@devvit/server/get-devvit-config.js';
|
|
5
5
|
import { StringUtil } from '@devvit/shared-types/StringUtil.js';
|
|
6
|
-
// Hack: rename config2 to workaround declaration in
|
|
7
|
-
// packages/runtime-lite/src/runtime/SandboxedRuntimeLite.ts.
|
|
8
6
|
// __devvit__ is undefined in tests only.
|
|
9
7
|
// @ts-expect-error no type.
|
|
10
|
-
const
|
|
8
|
+
const config = globalThis.__devvit__?.config;
|
|
11
9
|
/** @internal [state] Map of devvit.json form keys to Devvit-singleton form keys. */
|
|
12
10
|
export const formKeyMap = {};
|
|
13
11
|
function configurePermissions(permissions) {
|
|
@@ -37,8 +35,8 @@ function configurePost(post) {
|
|
|
37
35
|
height: 'tall',
|
|
38
36
|
});
|
|
39
37
|
}
|
|
40
|
-
function
|
|
41
|
-
for (const action of
|
|
38
|
+
function configureMenuActions(menuActions) {
|
|
39
|
+
for (const action of menuActions) {
|
|
42
40
|
const menuItem = {
|
|
43
41
|
label: action.label,
|
|
44
42
|
location: action.location,
|
|
@@ -97,7 +95,7 @@ export function validateUiResponse(uiResponse) {
|
|
|
97
95
|
const validKeys = ['showToast', 'navigateTo', 'showForm'];
|
|
98
96
|
const invalidKeys = Object.keys(uiResponse).filter((key) => !validKeys.includes(key));
|
|
99
97
|
if (invalidKeys.length > 0) {
|
|
100
|
-
throw new Error(`Invalid fields found in UiResponse:
|
|
98
|
+
throw new Error(`Invalid fields found in UiResponse: ${invalidKeys.join(', ')}. Valid fields are: ${validKeys.join(', ')}`);
|
|
101
99
|
}
|
|
102
100
|
// (2) showForm must have a name that exists in the formKeyMap.
|
|
103
101
|
if (uiResponse.showForm) {
|
|
@@ -105,7 +103,7 @@ export function validateUiResponse(uiResponse) {
|
|
|
105
103
|
throw new Error('showForm must have a name');
|
|
106
104
|
}
|
|
107
105
|
if (!formKeyMap[uiResponse.showForm.name]) {
|
|
108
|
-
throw new Error(`Form with name
|
|
106
|
+
throw new Error(`Form with name ${uiResponse.showForm.name} not found in devvit.json. Consider adding '"forms"."${uiResponse.showForm.name}"="/internal/your/endpoint"'.`);
|
|
109
107
|
}
|
|
110
108
|
}
|
|
111
109
|
// (3) showToast must be a string or an object with only fields [text, appearance]
|
|
@@ -120,7 +118,7 @@ export function validateUiResponse(uiResponse) {
|
|
|
120
118
|
const validToastKeys = ['text', 'appearance'];
|
|
121
119
|
const invalidToastKeys = toastKeys.filter((key) => !validToastKeys.includes(key));
|
|
122
120
|
if (invalidToastKeys.length > 0) {
|
|
123
|
-
throw new Error(`Invalid fields found in showToast:
|
|
121
|
+
throw new Error(`Invalid fields found in showToast: ${invalidToastKeys.join(', ')}. Valid fields are: ${validToastKeys.join(', ')}`);
|
|
124
122
|
}
|
|
125
123
|
if (typeof uiResponse.showToast.text !== 'string') {
|
|
126
124
|
throw new Error('showToast.text is required and must be a string');
|
|
@@ -191,6 +189,8 @@ async function callWebbitEndpoint(endpoint, body, metadata) {
|
|
|
191
189
|
}
|
|
192
190
|
}
|
|
193
191
|
function configureScheduler(schedulerConfig) {
|
|
192
|
+
const config = getDevvitConfig();
|
|
193
|
+
const logger = config.use(LoggerDefinition);
|
|
194
194
|
const cronTasks = {};
|
|
195
195
|
for (const [name, task] of Object.entries(schedulerConfig.tasks)) {
|
|
196
196
|
Devvit.addSchedulerJob({
|
|
@@ -221,7 +221,6 @@ function configureScheduler(schedulerConfig) {
|
|
|
221
221
|
await Promise.all(jobsToCancel.map((job) => context.scheduler.cancelJob(job.id)));
|
|
222
222
|
// Schedule all the cron tasks we were given in the config
|
|
223
223
|
await Promise.all(Object.entries(cronTasks).map(async ([name, task]) => {
|
|
224
|
-
const logger = getDevvitConfig().use(LoggerDefinition);
|
|
225
224
|
try {
|
|
226
225
|
await context.scheduler.runJob({
|
|
227
226
|
name: name,
|
|
@@ -249,18 +248,17 @@ function renderModal(path) {
|
|
|
249
248
|
Devvit.createElement("button", { onPress: webView.mount }, "Launch App"),
|
|
250
249
|
";"));
|
|
251
250
|
}
|
|
252
|
-
if (
|
|
253
|
-
configurePermissions(
|
|
254
|
-
if (
|
|
255
|
-
configurePost(
|
|
256
|
-
if (
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
configureTriggers(config2.triggers);
|
|
251
|
+
if (config) {
|
|
252
|
+
configurePermissions(config.permissions);
|
|
253
|
+
if (config.post)
|
|
254
|
+
configurePost(config.post);
|
|
255
|
+
if (config.menuActions)
|
|
256
|
+
configureMenuActions(config.menuActions);
|
|
257
|
+
if (config.scheduler)
|
|
258
|
+
configureScheduler(config.scheduler);
|
|
259
|
+
if (config.forms)
|
|
260
|
+
configureForms(config.forms);
|
|
261
|
+
if (config.triggers)
|
|
262
|
+
configureTriggers(config.triggers);
|
|
265
263
|
}
|
|
266
264
|
export default Devvit;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/build-pack",
|
|
3
|
-
"version": "0.11.19
|
|
3
|
+
"version": "0.11.19",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"types": "./index.d.ts",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@devvit/protos": "0.11.19
|
|
27
|
-
"@devvit/shared-types": "0.11.19
|
|
26
|
+
"@devvit/protos": "0.11.19",
|
|
27
|
+
"@devvit/shared-types": "0.11.19",
|
|
28
28
|
"esbuild": "0.23.0",
|
|
29
29
|
"rxjs": "7.8.1",
|
|
30
30
|
"tsv": "0.2.0",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@devvit/shared": "*"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@devvit/public-api": "0.11.19
|
|
39
|
-
"@devvit/repo-tools": "0.11.19
|
|
40
|
-
"@devvit/scheduler": "0.11.19
|
|
41
|
-
"@devvit/server": "0.11.19
|
|
42
|
-
"@devvit/shared": "0.11.19
|
|
43
|
-
"@devvit/tsconfig": "0.11.19
|
|
38
|
+
"@devvit/public-api": "0.11.19",
|
|
39
|
+
"@devvit/repo-tools": "0.11.19",
|
|
40
|
+
"@devvit/scheduler": "0.11.19",
|
|
41
|
+
"@devvit/server": "0.11.19",
|
|
42
|
+
"@devvit/shared": "0.11.19",
|
|
43
|
+
"@devvit/tsconfig": "0.11.19",
|
|
44
44
|
"@types/tsv": "0.2.1",
|
|
45
45
|
"eslint": "9.11.1",
|
|
46
46
|
"vitest": "1.6.1"
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"directory": "dist"
|
|
50
50
|
},
|
|
51
51
|
"source": "./src/index.ts",
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f730f695127ca675c4c651e691b9475e35e91ca2"
|
|
53
53
|
}
|