@devvit/build-pack 0.12.1-next-2025-08-14-22-00-58-0f16e3242.0 → 0.12.1-next-2025-08-14-23-26-23-9bf33eb27.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/esbuild/dependency-spec-util.d.ts +6 -0
- package/esbuild/dependency-spec-util.d.ts.map +1 -1
- package/esbuild/dependency-spec-util.js +28 -26
- package/esbuild/templatizer/blocks.template.d.ts +8 -0
- package/esbuild/templatizer/blocks.template.d.ts.map +1 -1
- package/esbuild/templatizer/blocks.template.js +7 -2
- package/package.json +11 -11
|
@@ -5,6 +5,12 @@ import type { AppConfig } from '@devvit/shared-types/schemas/config-file.v1.js';
|
|
|
5
5
|
* Convert a static `AppConfig` to a `DependencySpec`. Similar to the classic
|
|
6
6
|
* `Devvit` singleton, `ConfigImpl`, `addPaymentHandler()`, and
|
|
7
7
|
* `paymentsPlugin`.
|
|
8
|
+
*
|
|
9
|
+
* Consider the config objects to determine uses / provides since the config
|
|
10
|
+
* objects have more granularity (eg, triggers). If a config and a permission
|
|
11
|
+
* exists, only the config needs to be consulted.
|
|
12
|
+
*
|
|
13
|
+
* The `provide()` / `use()` helpers deduplicate.
|
|
8
14
|
*/
|
|
9
15
|
export declare function createDependencySpec(actorSpec: Readonly<ActorSpec>, config: Readonly<Omit<AppConfig, 'json'>>, namespace: Readonly<Namespace>): DependencySpec;
|
|
10
16
|
//# sourceMappingURL=dependency-spec-util.d.ts.map
|
|
@@ -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
|
|
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;;;;;;;;;;GAUG;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,CAyGhB"}
|
|
@@ -7,6 +7,12 @@ import { PLUGIN_NAME, resolveActorHostname } from '@devvit/shared-types/Hostname
|
|
|
7
7
|
* Convert a static `AppConfig` to a `DependencySpec`. Similar to the classic
|
|
8
8
|
* `Devvit` singleton, `ConfigImpl`, `addPaymentHandler()`, and
|
|
9
9
|
* `paymentsPlugin`.
|
|
10
|
+
*
|
|
11
|
+
* Consider the config objects to determine uses / provides since the config
|
|
12
|
+
* objects have more granularity (eg, triggers). If a config and a permission
|
|
13
|
+
* exists, only the config needs to be consulted.
|
|
14
|
+
*
|
|
15
|
+
* The `provide()` / `use()` helpers deduplicate.
|
|
10
16
|
*/
|
|
11
17
|
export function createDependencySpec(actorSpec, config, namespace) {
|
|
12
18
|
const spec = {
|
|
@@ -46,64 +52,60 @@ export function createDependencySpec(actorSpec, config, namespace) {
|
|
|
46
52
|
if (permissions.requestedFetchDomains.length > 0 || permissions.asUserScopes.length > 0) {
|
|
47
53
|
spec.permissions.push(permissions);
|
|
48
54
|
}
|
|
49
|
-
if (config.post)
|
|
55
|
+
if (config.post)
|
|
50
56
|
provide(spec, CustomPostDefinition, UIEventHandlerDefinition);
|
|
51
|
-
}
|
|
52
57
|
if (config.server)
|
|
53
58
|
provide(spec, WebbitServerDefinition);
|
|
54
|
-
if (config.
|
|
59
|
+
if (config.menu)
|
|
55
60
|
provide(spec, ContextActionDefinition);
|
|
56
|
-
if (config.permissions.settings) {
|
|
57
|
-
use(spec, SettingsDefinition);
|
|
58
|
-
provide(spec, AppSettingsDefinition, InstallationSettingsDefinition);
|
|
59
|
-
}
|
|
60
61
|
if (config.forms)
|
|
61
62
|
provide(spec, UIEventHandlerDefinition);
|
|
62
63
|
if (config.scheduler) {
|
|
63
64
|
provide(spec, SchedulerHandlerDefinition);
|
|
64
65
|
if (Object.values(config.scheduler.tasks).some((task) => task.cron)) {
|
|
66
|
+
// `blocks.template.tsx` resets tasks on install and upgrade triggers.
|
|
65
67
|
provide(spec, OnAppInstallDefinition);
|
|
66
68
|
provide(spec, OnAppUpgradeDefinition);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
if (config.triggers) {
|
|
70
|
-
if (config.triggers.onAppInstall)
|
|
72
|
+
if (config.triggers.onAppInstall != null)
|
|
71
73
|
provide(spec, OnAppInstallDefinition);
|
|
72
|
-
if (config.triggers.onAppUpgrade)
|
|
74
|
+
if (config.triggers.onAppUpgrade != null)
|
|
73
75
|
provide(spec, OnAppUpgradeDefinition);
|
|
74
|
-
if (config.triggers.onAutomoderatorFilterComment)
|
|
76
|
+
if (config.triggers.onAutomoderatorFilterComment != null)
|
|
75
77
|
provide(spec, OnAutomoderatorFilterCommentDefinition);
|
|
76
|
-
if (config.triggers.onAutomoderatorFilterPost)
|
|
78
|
+
if (config.triggers.onAutomoderatorFilterPost != null)
|
|
77
79
|
provide(spec, OnAutomoderatorFilterPostDefinition);
|
|
78
|
-
if (config.triggers.onCommentCreate)
|
|
80
|
+
if (config.triggers.onCommentCreate != null)
|
|
79
81
|
provide(spec, OnCommentCreateDefinition);
|
|
80
|
-
if (config.triggers.onCommentDelete)
|
|
82
|
+
if (config.triggers.onCommentDelete != null)
|
|
81
83
|
provide(spec, OnCommentDeleteDefinition);
|
|
82
|
-
if (config.triggers.onCommentReport)
|
|
84
|
+
if (config.triggers.onCommentReport != null)
|
|
83
85
|
provide(spec, OnCommentReportDefinition);
|
|
84
|
-
if (config.triggers.onCommentSubmit)
|
|
86
|
+
if (config.triggers.onCommentSubmit != null)
|
|
85
87
|
provide(spec, OnCommentSubmitDefinition);
|
|
86
|
-
if (config.triggers.onCommentUpdate)
|
|
88
|
+
if (config.triggers.onCommentUpdate != null)
|
|
87
89
|
provide(spec, OnCommentUpdateDefinition);
|
|
88
|
-
if (config.triggers.onModAction)
|
|
90
|
+
if (config.triggers.onModAction != null)
|
|
89
91
|
provide(spec, OnModActionDefinition);
|
|
90
|
-
if (config.triggers.onModMail)
|
|
92
|
+
if (config.triggers.onModMail != null)
|
|
91
93
|
provide(spec, OnModMailDefinition);
|
|
92
|
-
if (config.triggers.onPostCreate)
|
|
94
|
+
if (config.triggers.onPostCreate != null)
|
|
93
95
|
provide(spec, OnPostCreateDefinition);
|
|
94
|
-
if (config.triggers.onPostDelete)
|
|
96
|
+
if (config.triggers.onPostDelete != null)
|
|
95
97
|
provide(spec, OnPostDeleteDefinition);
|
|
96
|
-
if (config.triggers.onPostFlairUpdate)
|
|
98
|
+
if (config.triggers.onPostFlairUpdate != null)
|
|
97
99
|
provide(spec, OnPostFlairUpdateDefinition);
|
|
98
|
-
if (config.triggers.onPostNsfwUpdate)
|
|
100
|
+
if (config.triggers.onPostNsfwUpdate != null)
|
|
99
101
|
provide(spec, OnPostNsfwUpdateDefinition);
|
|
100
|
-
if (config.triggers.onPostReport)
|
|
102
|
+
if (config.triggers.onPostReport != null)
|
|
101
103
|
provide(spec, OnPostReportDefinition);
|
|
102
|
-
if (config.triggers.onPostSpoilerUpdate)
|
|
104
|
+
if (config.triggers.onPostSpoilerUpdate != null)
|
|
103
105
|
provide(spec, OnPostSpoilerUpdateDefinition);
|
|
104
|
-
if (config.triggers.onPostSubmit)
|
|
106
|
+
if (config.triggers.onPostSubmit != null)
|
|
105
107
|
provide(spec, OnPostSubmitDefinition);
|
|
106
|
-
if (config.triggers.onPostUpdate)
|
|
108
|
+
if (config.triggers.onPostUpdate != null)
|
|
107
109
|
provide(spec, OnPostUpdateDefinition);
|
|
108
110
|
}
|
|
109
111
|
if (config.settings) {
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { Devvit, type FormKey } from '@devvit/public-api';
|
|
2
2
|
import type { UiResponse } from '@devvit/shared';
|
|
3
|
+
declare module '@devvit/public-api' {
|
|
4
|
+
namespace Devvit {
|
|
5
|
+
function _initForms(): void;
|
|
6
|
+
function _initMenu(): void;
|
|
7
|
+
function _initScheduler(): void;
|
|
8
|
+
function _initSettings(global: boolean, sub: boolean): void;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
3
11
|
/** @internal [state] Map of devvit.json form keys to Devvit-singleton form keys. */
|
|
4
12
|
export declare const formKeyMap: {
|
|
5
13
|
[formKey: string]: FormKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.template.d.ts","sourceRoot":"","sources":["../../../src/esbuild/templatizer/blocks.template.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,MAAM,EACN,KAAK,OAAO,EAOb,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAA8C,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"blocks.template.d.ts","sourceRoot":"","sources":["../../../src/esbuild/templatizer/blocks.template.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,MAAM,EACN,KAAK,OAAO,EAOb,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAA8C,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAkB7F,OAAO,QAAQ,oBAAoB,CAAC;IAGlC,UAAU,MAAM,CAAC;QACf,SAAS,UAAU,IAAI,IAAI,CAAC;QAC5B,SAAS,SAAS,IAAI,IAAI,CAAC;QAC3B,SAAS,cAAc,IAAI,IAAI,CAAC;QAChC,SAAS,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;KAC7D;CACF;AAQD,oFAAoF;AACpF,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAA;CAAO,CAAC;AAiI7D,gBAAgB;AAChB,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CA4D/D;AA4OD,eAAe,MAAM,CAAC"}
|
|
@@ -57,6 +57,7 @@ function configurePost(name, post) {
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
function configureMenuItems(menuItems) {
|
|
60
|
+
Devvit._initMenu();
|
|
60
61
|
for (const action of menuItems) {
|
|
61
62
|
const menuItem = {
|
|
62
63
|
label: action.label,
|
|
@@ -82,6 +83,7 @@ function configureMenuItems(menuItems) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
function configureForms(forms) {
|
|
86
|
+
Devvit._initForms();
|
|
85
87
|
for (const [name, endpoint] of Object.entries(forms)) {
|
|
86
88
|
formKeyMap[name] = Devvit.createForm({ fields: [] }, (ev, ctx) => handleFormResponse(endpoint, ev, ctx));
|
|
87
89
|
}
|
|
@@ -92,6 +94,8 @@ function configureTriggers(triggers) {
|
|
|
92
94
|
Devvit.addTrigger({
|
|
93
95
|
event: ev,
|
|
94
96
|
async onEvent(ev, ctx) {
|
|
97
|
+
if (!endpoint)
|
|
98
|
+
return; // Implementation provided by Blocks.
|
|
95
99
|
// Convert the hydrated old Protobuf to JSON. Don't use
|
|
96
100
|
// Protobuf.toJSON() which would omit default values.
|
|
97
101
|
const body = JSON.parse(JSON.stringify(ev));
|
|
@@ -230,6 +234,7 @@ async function callWebbitEndpoint(endpoint, body, metadata) {
|
|
|
230
234
|
}
|
|
231
235
|
}
|
|
232
236
|
function configureScheduler(schedulerConfig) {
|
|
237
|
+
Devvit._initScheduler();
|
|
233
238
|
const cronTasks = {};
|
|
234
239
|
for (const [name, task] of Object.entries(schedulerConfig.tasks)) {
|
|
235
240
|
Devvit.addSchedulerJob({
|
|
@@ -284,6 +289,7 @@ function configureScheduler(schedulerConfig) {
|
|
|
284
289
|
}
|
|
285
290
|
function configureSettings(settings) {
|
|
286
291
|
const classicSettings = [];
|
|
292
|
+
Devvit._initSettings(!!settings?.global, !!settings?.subreddit);
|
|
287
293
|
for (const config of Object.values(settings?.global || {})) {
|
|
288
294
|
classicSettings.push(coerceSettingForClassic(config, SettingScope.App));
|
|
289
295
|
}
|
|
@@ -334,9 +340,8 @@ if (config2) {
|
|
|
334
340
|
configurePermissions(config2.permissions);
|
|
335
341
|
if (config2.post)
|
|
336
342
|
configurePost(config2.name, config2.post);
|
|
337
|
-
if (config2.menu
|
|
343
|
+
if (config2.menu)
|
|
338
344
|
configureMenuItems(config2.menu.items);
|
|
339
|
-
}
|
|
340
345
|
if (config2.scheduler)
|
|
341
346
|
configureScheduler(config2.scheduler);
|
|
342
347
|
if (config2.forms)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/build-pack",
|
|
3
|
-
"version": "0.12.1-next-2025-08-14-
|
|
3
|
+
"version": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"types": "./dist/index.d.ts",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@devvit/protos": "0.12.1-next-2025-08-14-
|
|
35
|
-
"@devvit/shared-types": "0.12.1-next-2025-08-14-
|
|
36
|
-
"@devvit/splash": "0.12.1-next-2025-08-14-
|
|
34
|
+
"@devvit/protos": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
35
|
+
"@devvit/shared-types": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
36
|
+
"@devvit/splash": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
37
37
|
"esbuild": "0.23.0",
|
|
38
38
|
"rxjs": "7.8.1",
|
|
39
39
|
"tsv": "0.2.0",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"@devvit/shared": "*"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@devvit/public-api": "0.12.1-next-2025-08-14-
|
|
48
|
-
"@devvit/repo-tools": "0.12.1-next-2025-08-14-
|
|
49
|
-
"@devvit/scheduler": "0.12.1-next-2025-08-14-
|
|
50
|
-
"@devvit/server": "0.12.1-next-2025-08-14-
|
|
51
|
-
"@devvit/shared": "0.12.1-next-2025-08-14-
|
|
52
|
-
"@devvit/tsconfig": "0.12.1-next-2025-08-14-
|
|
47
|
+
"@devvit/public-api": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
48
|
+
"@devvit/repo-tools": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
49
|
+
"@devvit/scheduler": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
50
|
+
"@devvit/server": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
51
|
+
"@devvit/shared": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
52
|
+
"@devvit/tsconfig": "0.12.1-next-2025-08-14-23-26-23-9bf33eb27.0",
|
|
53
53
|
"@types/tsv": "0.2.1",
|
|
54
54
|
"eslint": "9.11.1",
|
|
55
55
|
"vitest": "1.6.1"
|
|
56
56
|
},
|
|
57
57
|
"source": "./src/index.ts",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "08a6b90ab86947770cc8deb8facb020599f64065"
|
|
59
59
|
}
|