@devvit/cli 0.11.1 → 0.11.2-next-2024-10-21-6031c79bc.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.
@@ -1 +1 @@
1
- {"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/actor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAKvE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;;IACrD,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAAsC;IAE9D,OAAgB,IAAI;;MAOlB;IAEF,OAAgB,MAAM,UAAQ;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8C3B"}
1
+ {"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/actor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAKvE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;;IACrD,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAAsC;IAE9D,OAAgB,IAAI;;MAOlB;IAEF,OAAgB,MAAM,UAAQ;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0D3B"}
@@ -3,11 +3,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _BundleActor_instances, _BundleActor_getOwnerUsername;
6
+ var _BundleActor_instances, _BundleActor_makeBundles, _BundleActor_getOwnerUsername;
7
7
  import { mkdir, writeFile } from 'node:fs/promises';
8
8
  import path from 'node:path';
9
9
  import { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
10
- import { ActorSpec } from '@devvit/protos/types/devvit/runtime/bundle.js';
10
+ import { ActorSpec, TargetRuntime } from '@devvit/protos/types/devvit/runtime/bundle.js';
11
11
  import { Args } from '@oclif/core';
12
12
  import { getAccessToken } from '../../util/auth.js';
13
13
  import { Bundler } from '../../util/Bundler.js';
@@ -25,20 +25,29 @@ class BundleActor extends ProjectCommand {
25
25
  const { args } = await this.parse(BundleActor);
26
26
  const username = await __classPrivateFieldGet(this, _BundleActor_instances, "m", _BundleActor_getOwnerUsername).call(this);
27
27
  const config = await readDevvitConfig(this.projectRoot, this.configFile);
28
- const actorName = args.name;
29
- const actorBundler = new Bundler();
30
- const bundle = await actorBundler.bundle(this.projectRoot, ActorSpec.fromPartial({
31
- name: actorName,
28
+ const actorSpec = ActorSpec.fromPartial({
29
+ name: args.name,
32
30
  owner: username,
33
31
  version: config.version,
34
- }));
35
- await readAndInjectBundleProducts(this.projectRoot, bundle, false);
36
- await mkdir(path.join(this.projectRoot, distDirFilename), { recursive: true });
37
- await writeFile(path.join(this.projectRoot, distDirFilename, `${actorName}.bundle.json`), JSON.stringify(Bundle.toJSON(bundle)));
38
- this.log(`Successfully bundled actor: ${actorName}`);
32
+ });
33
+ await __classPrivateFieldGet(this, _BundleActor_instances, "m", _BundleActor_makeBundles).call(this, actorSpec);
34
+ this.log(`Successfully bundled actor: ${actorSpec.name}`);
39
35
  }
40
36
  }
41
- _BundleActor_instances = new WeakSet(), _BundleActor_getOwnerUsername = async function _BundleActor_getOwnerUsername() {
37
+ _BundleActor_instances = new WeakSet(), _BundleActor_makeBundles = async function _BundleActor_makeBundles(actorSpec) {
38
+ const actorBundler = new Bundler();
39
+ const bundles = await actorBundler.bundle(this.projectRoot, actorSpec);
40
+ await Promise.all(bundles.map(async (bundle) => {
41
+ const target = bundle.buildInfo?.targetRuntime ?? TargetRuntime.UNIVERSAL;
42
+ let type = '';
43
+ if (target === TargetRuntime.CLIENT) {
44
+ type = '.client';
45
+ }
46
+ await readAndInjectBundleProducts(this.projectRoot, bundle, false);
47
+ await mkdir(path.join(this.projectRoot, distDirFilename), { recursive: true });
48
+ await writeFile(path.join(this.projectRoot, distDirFilename, `${actorSpec.name}.bundle${type}.json`), JSON.stringify(Bundle.toJSON(bundle)));
49
+ }));
50
+ }, _BundleActor_getOwnerUsername = async function _BundleActor_getOwnerUsername() {
42
51
  let username = '';
43
52
  try {
44
53
  const token = await getAccessToken();
@@ -1,5 +1,6 @@
1
1
  import { DevvitCommand } from '../util/commands/DevvitCommand.js';
2
2
  export default class Login extends DevvitCommand {
3
+ #private;
3
4
  static description: string;
4
5
  static flags: {
5
6
  'copy-paste': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,aAAa;IAC9C,OAAgB,WAAW,SAAqC;IAEhE,OAAgB,KAAK;;MAOnB;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAe3B"}
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,aAAa;;IAC9C,OAAgB,WAAW,SAAqC;IAEhE,OAAgB,KAAK;;MAOnB;IAaI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB3B"}
@@ -1,16 +1,38 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var _Login_event;
1
7
  import { Flags } from '@oclif/core';
2
8
  import { getAccessTokenAndLoginIfNeeded, getOAuthSvc } from '../util/auth.js';
3
9
  import { DevvitCommand } from '../util/commands/DevvitCommand.js';
10
+ import { sendEvent } from '../util/metrics.js';
4
11
  class Login extends DevvitCommand {
12
+ constructor() {
13
+ super(...arguments);
14
+ _Login_event.set(this, {
15
+ source: 'devplatform_cli',
16
+ action: 'ran',
17
+ noun: 'login',
18
+ devplatform: {
19
+ cli_raw_command_line: 'devvit ' + process.argv.slice(2).join(' '),
20
+ cli_is_valid_command: true,
21
+ cli_command: 'login',
22
+ },
23
+ });
24
+ }
5
25
  async run() {
6
26
  const { flags: { 'copy-paste': copyPaste }, } = await this.parse(Login);
7
27
  // Clearing a local token before attempting to login (in case the token has expired, for example)
8
28
  await getOAuthSvc().Logout({});
9
29
  const token = await getAccessTokenAndLoginIfNeeded(copyPaste);
10
30
  const username = await this.getUserDisplayName(token);
31
+ await sendEvent(__classPrivateFieldGet(this, _Login_event, "f"));
11
32
  this.log(`Logged in as ${username}\n\n\`devvit new\` to create a new project\n\`devvit --help\` for more commands\n`);
12
33
  }
13
34
  }
35
+ _Login_event = new WeakMap();
14
36
  Login.description = 'Log in to Devvit via reddit.com';
15
37
  Login.flags = {
16
38
  'copy-paste': Flags.boolean({
@@ -13,5 +13,5 @@ export default class Playtest extends Upload {
13
13
  checkVersionBuildStatus(appVersionInfo: AppVersionInfo): Promise<boolean>;
14
14
  run(): Promise<void>;
15
15
  }
16
- export declare function modifyBundleVersion(bundle: Bundle, version: string): void;
16
+ export declare function modifyBundleVersions(bundles: Bundle[], version: string): void;
17
17
  //# sourceMappingURL=playtest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"playtest.d.ts","sourceRoot":"","sources":["../../src/commands/playtest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,6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E"}
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- var _Playtest_instances, _a, _Playtest_installationsClient, _Playtest_appLogSub, _Playtest_bundler, _Playtest_existingInstallInfo, _Playtest_appInfo, _Playtest_version, _Playtest_lastBundle, _Playtest_lastQueuedBundle, _Playtest_isOnWatchExecuting, _Playtest_server, _Playtest_flags, _Playtest_watchAssets, _Playtest_getExistingInstallInfo, _Playtest_newAppLogSub, _Playtest_onWatch, _Playtest_onWatchError, _Playtest_onExit;
12
+ var _Playtest_instances, _a, _Playtest_installationsClient, _Playtest_appLogSub, _Playtest_bundler, _Playtest_existingInstallInfo, _Playtest_appInfo, _Playtest_version, _Playtest_lastBundles, _Playtest_lastQueuedBundles, _Playtest_isOnWatchExecuting, _Playtest_server, _Playtest_flags, _Playtest_watchAssets, _Playtest_getExistingInstallInfo, _Playtest_newAppLogSub, _Playtest_onWatch, _Playtest_onWatchError, _Playtest_onExit;
13
13
  import { BuildStatus, GetAllWithInstallLocationRequest, InstallationCreationRequest, InstallationType, InstallationUpgradeRequest, UUID, VersionVisibility, } from '@devvit/protos/community.js';
14
14
  import { Severity } from '@devvit/protos/types/devvit/plugin/logger/logger.js';
15
15
  import { RemoteLogType } from '@devvit/protos/types/devvit/remote_logger/remote_logger.js';
@@ -47,13 +47,13 @@ class Playtest extends Upload {
47
47
  _Playtest_existingInstallInfo.set(this, void 0);
48
48
  _Playtest_appInfo.set(this, void 0);
49
49
  _Playtest_version.set(this, void 0);
50
- _Playtest_lastBundle.set(this, void 0);
51
- _Playtest_lastQueuedBundle.set(this, void 0);
50
+ _Playtest_lastBundles.set(this, void 0);
51
+ _Playtest_lastQueuedBundles.set(this, void 0);
52
52
  _Playtest_isOnWatchExecuting.set(this, false);
53
53
  _Playtest_server.set(this, void 0);
54
54
  _Playtest_flags.set(this, void 0);
55
55
  _Playtest_watchAssets.set(this, void 0);
56
- _Playtest_onWatch.set(this, async (bundle, subreddit) => {
56
+ _Playtest_onWatch.set(this, async (result, subreddit) => {
57
57
  /* We have to do this here because none of the rxjs functions fit this use case perfectly. What
58
58
  * we need is something that serializes this whole pipeline, but also discards all but the most
59
59
  * recent value once we resume processing. We would love to use one of these, but...
@@ -67,13 +67,16 @@ class Playtest extends Upload {
67
67
  */
68
68
  if (__classPrivateFieldGet(this, _Playtest_isOnWatchExecuting, "f")) {
69
69
  // if we're already executing, queue this watch to be executed after we're done
70
- __classPrivateFieldSet(this, _Playtest_lastQueuedBundle, bundle, "f");
70
+ __classPrivateFieldSet(this, _Playtest_lastQueuedBundles, result.bundles, "f");
71
71
  return;
72
72
  }
73
- if (!bundle) {
73
+ if (!result.bundles) {
74
+ return;
75
+ }
76
+ __classPrivateFieldSet(this, _Playtest_lastBundles, result.bundles, "f");
77
+ if (!__classPrivateFieldGet(this, _Playtest_lastBundles, "f")) {
74
78
  return;
75
79
  }
76
- __classPrivateFieldSet(this, _Playtest_lastBundle, bundle, "f");
77
80
  if (!__classPrivateFieldGet(this, _Playtest_appInfo, "f")?.app) {
78
81
  this.error(`Something went wrong: App is not found`);
79
82
  }
@@ -88,11 +91,11 @@ class Playtest extends Upload {
88
91
  version: __classPrivateFieldGet(this, _Playtest_version, "f").toString(),
89
92
  });
90
93
  // 3. update bundle version:
91
- modifyBundleVersion(bundle, __classPrivateFieldGet(this, _Playtest_version, "f").toString());
94
+ modifyBundleVersions(__classPrivateFieldGet(this, _Playtest_lastBundles, "f"), __classPrivateFieldGet(this, _Playtest_version, "f").toString());
92
95
  // 4. create new playtest version:
93
96
  let appVersionInfo;
94
97
  try {
95
- appVersionInfo = await this.createVersion(__classPrivateFieldGet(this, _Playtest_appInfo, "f").app, __classPrivateFieldGet(this, _Playtest_version, "f"), [bundle], VersionVisibility.PRIVATE);
98
+ appVersionInfo = await this.createVersion(__classPrivateFieldGet(this, _Playtest_appInfo, "f").app, __classPrivateFieldGet(this, _Playtest_version, "f"), __classPrivateFieldGet(this, _Playtest_lastBundles, "f"), VersionVisibility.PRIVATE);
96
99
  }
97
100
  catch (err) {
98
101
  if (err instanceof Error) {
@@ -123,10 +126,10 @@ class Playtest extends Upload {
123
126
  ux.action.stop(`✅\nSuccess! Please visit your test subreddit and refresh to see your latest changes:\n✨ ${playtestUrl}\n`);
124
127
  __classPrivateFieldSet(this, _Playtest_isOnWatchExecuting, false, "f");
125
128
  // If there's a queued watch, execute it now.
126
- if (__classPrivateFieldGet(this, _Playtest_lastQueuedBundle, "f")) {
127
- const newerBundle = __classPrivateFieldGet(this, _Playtest_lastQueuedBundle, "f");
128
- __classPrivateFieldSet(this, _Playtest_lastQueuedBundle, undefined, "f");
129
- await __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, newerBundle, subreddit); // subreddit won't change between calls!
129
+ if (__classPrivateFieldGet(this, _Playtest_lastQueuedBundles, "f")) {
130
+ const newerBundles = __classPrivateFieldGet(this, _Playtest_lastQueuedBundles, "f");
131
+ __classPrivateFieldSet(this, _Playtest_lastQueuedBundles, undefined, "f");
132
+ await __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, { bundles: newerBundles }, subreddit); // subreddit won't change between calls!
130
133
  }
131
134
  });
132
135
  _Playtest_onWatchError.set(this, (err) => {
@@ -231,8 +234,8 @@ class Playtest extends Upload {
231
234
  const assetPaths = [assetDir, webviewAssetDir, productsJSON];
232
235
  __classPrivateFieldSet(this, _Playtest_watchAssets, chokidar.watch(assetPaths, { ignoreInitial: true }), "f");
233
236
  __classPrivateFieldGet(this, _Playtest_watchAssets, "f").on('all', () => {
234
- // asset changes don't result in a code change, so just re-send the last bundle
235
- void __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, __classPrivateFieldGet(this, _Playtest_lastBundle, "f"), subreddit);
237
+ // asset changes don't result in a code change, so just re-send the last bundles
238
+ void __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, { bundles: __classPrivateFieldGet(this, _Playtest_lastBundles, "f") }, subreddit);
236
239
  });
237
240
  // before starting playtest session, make sure app has been installed to the test subreddit:
238
241
  const appWithVersion = `${appName}@${__classPrivateFieldGet(this, _Playtest_version, "f")}`;
@@ -264,7 +267,7 @@ class Playtest extends Upload {
264
267
  // bundles through an asynchronous observable and only open a subscription
265
268
  // for errors. We just dispose the source (bundler) to unsubscribe.
266
269
  watchSrc
267
- .pipe(map((bundle) => __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, bundle, subreddit)))
270
+ .pipe(map((result) => __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, result, subreddit)))
268
271
  .subscribe({ error: __classPrivateFieldGet(this, _Playtest_onWatchError, "f") });
269
272
  // We don't know when the user is done. If connected to a terminal, end when
270
273
  // stdin is closed. Otherwise, close immediately to avoid the chance that
@@ -275,7 +278,7 @@ class Playtest extends Upload {
275
278
  }
276
279
  }
277
280
  }
278
- _a = Playtest, _Playtest_installationsClient = new WeakMap(), _Playtest_appLogSub = new WeakMap(), _Playtest_bundler = new WeakMap(), _Playtest_existingInstallInfo = new WeakMap(), _Playtest_appInfo = new WeakMap(), _Playtest_version = new WeakMap(), _Playtest_lastBundle = new WeakMap(), _Playtest_lastQueuedBundle = new WeakMap(), _Playtest_isOnWatchExecuting = new WeakMap(), _Playtest_server = new WeakMap(), _Playtest_flags = new WeakMap(), _Playtest_watchAssets = new WeakMap(), _Playtest_onWatch = new WeakMap(), _Playtest_onWatchError = new WeakMap(), _Playtest_instances = new WeakSet(), _Playtest_getExistingInstallInfo = async function _Playtest_getExistingInstallInfo(subreddit) {
281
+ _a = Playtest, _Playtest_installationsClient = new WeakMap(), _Playtest_appLogSub = new WeakMap(), _Playtest_bundler = new WeakMap(), _Playtest_existingInstallInfo = new WeakMap(), _Playtest_appInfo = new WeakMap(), _Playtest_version = new WeakMap(), _Playtest_lastBundles = new WeakMap(), _Playtest_lastQueuedBundles = new WeakMap(), _Playtest_isOnWatchExecuting = new WeakMap(), _Playtest_server = new WeakMap(), _Playtest_flags = new WeakMap(), _Playtest_watchAssets = new WeakMap(), _Playtest_onWatch = new WeakMap(), _Playtest_onWatchError = new WeakMap(), _Playtest_instances = new WeakSet(), _Playtest_getExistingInstallInfo = async function _Playtest_getExistingInstallInfo(subreddit) {
279
282
  const existingInstalls = await __classPrivateFieldGet(this, _Playtest_installationsClient, "f").GetAllWithInstallLocation(GetAllWithInstallLocationRequest.fromPartial({
280
283
  type: InstallationType.SUBREDDIT,
281
284
  location: subreddit,
@@ -336,11 +339,13 @@ Playtest.args = {
336
339
  }),
337
340
  };
338
341
  export default Playtest;
339
- export function modifyBundleVersion(bundle, version) {
342
+ export function modifyBundleVersions(bundles, version) {
340
343
  var _b;
341
- bundle.dependencies ?? (bundle.dependencies = DependencySpec.fromPartial({}));
342
- (_b = bundle.dependencies).actor ?? (_b.actor = ActorSpec.fromPartial({}));
343
- bundle.dependencies.actor.version = version.toString();
344
+ for (const bundle of bundles) {
345
+ bundle.dependencies ?? (bundle.dependencies = DependencySpec.fromPartial({}));
346
+ (_b = bundle.dependencies).actor ?? (_b.actor = ActorSpec.fromPartial({}));
347
+ bundle.dependencies.actor.version = version.toString();
348
+ }
344
349
  }
345
350
  function sleep(ms) {
346
351
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -1,5 +1,4 @@
1
- import type { AppInfo, AppVersionInfo } from '@devvit/protos/community.js';
2
- import { FullAppInfo, VersionVisibility } from '@devvit/protos/community.js';
1
+ import { type AppInfo, AppVersionInfo, FullAppInfo, VersionVisibility } from '@devvit/protos/community.js';
3
2
  import type { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
4
3
  import { DevvitVersion, VersionBumpType } from '@devvit/shared-types/Version.js';
5
4
  import type { CommandError } from '@oclif/core/lib/interfaces/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"upload.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7 @@ import { exec } from 'node:child_process';
14
14
  import fs from 'node:fs';
15
15
  import fsp from 'node:fs/promises';
16
16
  import path from 'node:path';
17
- import { AppCapability, AppCreationRequest, FullAppInfo, InstallationType, UploadNewMediaRequest, VersionVisibility, } from '@devvit/protos/community.js';
17
+ import { AppCapability, AppCreationRequest, AppVersionInfo, Categories, FullAppInfo, InstallationType, MediaSignature, UploadNewMediaRequest, UploadNewMediaResponse, VersionVisibility, } from '@devvit/protos/community.js';
18
18
  import { ALLOWED_ASSET_EXTENSIONS, ASSET_DIRNAME, MAX_ASSET_FOLDER_SIZE_BYTES, MAX_ASSET_GIF_SIZE, MAX_ASSET_NON_GIF_SIZE, prettyPrintSize, WEBVIEW_ASSET_DIRNAME, } from '@devvit/shared-types/Assets.js';
19
19
  import { ACTOR_SRC_PRIMARY_NAME, ASSET_HASHING_ALGO, ASSET_UPLOAD_BATCH_SIZE, MAX_ALLOWED_SUBSCRIBER_COUNT, } from '@devvit/shared-types/constants.js';
20
20
  import { APP_SLUG_BASE_MAX_LENGTH, makeSlug, sluggable } from '@devvit/shared-types/slug.js';
@@ -345,14 +345,13 @@ _Upload_event = new WeakMap(), _Upload_eventSent = new WeakMap(), _Upload_verbos
345
345
  ])).isNSFW;
346
346
  }, _Upload_bundleActors = async function _Upload_bundleActors(username, version, typecheck = true) {
347
347
  const bundler = new Bundler(typecheck);
348
+ const actorSpec = {
349
+ name: ACTOR_SRC_PRIMARY_NAME,
350
+ owner: username,
351
+ version: version,
352
+ };
348
353
  try {
349
- return [
350
- await bundler.bundle(this.projectRoot, {
351
- name: ACTOR_SRC_PRIMARY_NAME,
352
- owner: username,
353
- version: version,
354
- }),
355
- ];
354
+ return await bundler.bundle(this.projectRoot, actorSpec);
356
355
  }
357
356
  catch (err) {
358
357
  this.error(StringUtil.caughtToString(err));
@@ -2,11 +2,14 @@ import type { ProjectRootDir } from '@devvit/build-pack/lib/BuildPack.js';
2
2
  import { type Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
3
3
  import type { ActorSpec } from '@devvit/protos/types/devvit/runtime/bundle.js';
4
4
  import type { Observable } from 'rxjs';
5
+ export type BundlerResult = {
6
+ bundles: Bundle[] | undefined;
7
+ };
5
8
  export declare class Bundler {
6
9
  #private;
7
10
  constructor(typecheckEnabled?: boolean);
8
- bundle(root: ProjectRootDir, actorSpec: ActorSpec): Promise<Bundle>;
11
+ bundle(root: ProjectRootDir, actorSpec: ActorSpec): Promise<Bundle[]>;
9
12
  dispose(): Promise<void>;
10
- watch(root: ProjectRootDir, actorSpec: ActorSpec): Observable<Bundle | undefined>;
13
+ watch(root: ProjectRootDir, actorSpec: ActorSpec): Observable<BundlerResult>;
11
14
  }
12
15
  //# sourceMappingURL=Bundler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Bundler.d.ts","sourceRoot":"","sources":["../../src/util/Bundler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EACL,KAAK,MAAM,EAEZ,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,qBAAa,OAAO;;gBAGN,gBAAgB,GAAE,OAAc;IAUtC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBnE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;CAWlF"}
1
+ {"version":3,"file":"Bundler.d.ts","sourceRoot":"","sources":["../../src/util/Bundler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EACL,KAAK,MAAM,EAEZ,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,qBAAa,OAAO;;gBAGN,gBAAgB,GAAE,OAAc;IAUtC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAqBrE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC;CAW7E"}
@@ -33,10 +33,10 @@ export class Bundler {
33
33
  if (compiledRes.errors.length > 0) {
34
34
  throw new Error(formatLogs(compiledRes.errors));
35
35
  }
36
- if (compiledRes.bundle == null) {
36
+ if (compiledRes.bundles.length === 0) {
37
37
  throw new Error('Missing bundle');
38
38
  }
39
- return compiledRes.bundle;
39
+ return compiledRes.bundles;
40
40
  }
41
41
  async dispose() {
42
42
  await __classPrivateFieldGet(this, _Bundler_buildPack, "f").dispose();
@@ -49,7 +49,7 @@ export class Bundler {
49
49
  console.warn(formatLogs(rsp.warnings));
50
50
  if (rsp.errors.length > 0)
51
51
  console.error(formatLogs(rsp.errors));
52
- return rsp.bundle;
52
+ return { bundles: rsp.bundles };
53
53
  }));
54
54
  }
55
55
  }
@@ -19,9 +19,10 @@ test('watch touched source', async () => {
19
19
  });
20
20
  const [init, first] = await lastValueFrom(observable.pipe(take(2), toArray()));
21
21
  // An empty message is sent initially.
22
- expect(init).toBeUndefined();
22
+ expect(init).not.toBeUndefined();
23
+ expect(init.bundles).toHaveLength(0);
23
24
  expect(first).toBeDefined();
24
- expect(first.code.length).toBeGreaterThan(0);
25
+ expect(first.bundles[0].code.length).toBeGreaterThan(0);
25
26
  // Observe a second bundle.
26
27
  const second = lastValueFrom(observable.pipe(take(1)));
27
28
  // Touch.
@@ -1,7 +1,7 @@
1
1
  import { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
2
- import { modifyBundleVersion } from '../commands/playtest.js';
2
+ import { modifyBundleVersions } from '../commands/playtest.js';
3
3
  test('bundle has a version and is modified', () => {
4
4
  const bundle = Bundle.fromPartial({});
5
- modifyBundleVersion(bundle, '1.2.3.4');
5
+ modifyBundleVersions([bundle], '1.2.3.4');
6
6
  expect(bundle?.dependencies?.actor?.version).toBe('1.2.3.4');
7
7
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/cli",
3
- "version": "0.11.1",
3
+ "version": "0.11.2-next-2024-10-21-6031c79bc.0",
4
4
  "description": "Reddit's Dev Platform CLI Tool",
5
5
  "license": "BSD-3-Clause",
6
6
  "author": "@reddit/dev-platform",
@@ -42,11 +42,11 @@
42
42
  },
43
43
  "types": "dist/index.d.ts",
44
44
  "dependencies": {
45
- "@devvit/build-pack": "0.11.1",
45
+ "@devvit/build-pack": "0.11.2-next-2024-10-21-6031c79bc.0",
46
46
  "@devvit/play": "0.0.43",
47
- "@devvit/protos": "0.11.1",
48
- "@devvit/public-api": "0.11.1",
49
- "@devvit/shared-types": "0.11.1",
47
+ "@devvit/protos": "0.11.2-next-2024-10-21-6031c79bc.0",
48
+ "@devvit/public-api": "0.11.2-next-2024-10-21-6031c79bc.0",
49
+ "@devvit/shared-types": "0.11.2-next-2024-10-21-6031c79bc.0",
50
50
  "@improbable-eng/grpc-web": "0.15.0",
51
51
  "@improbable-eng/grpc-web-node-http-transport": "0.15.0",
52
52
  "@oclif/core": "2.9.4",
@@ -78,8 +78,8 @@
78
78
  "ws": "8.18.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@devvit/repo-tools": "0.11.1",
82
- "@devvit/tsconfig": "0.11.1",
81
+ "@devvit/repo-tools": "0.11.2-next-2024-10-21-6031c79bc.0",
82
+ "@devvit/tsconfig": "0.11.2-next-2024-10-21-6031c79bc.0",
83
83
  "@types/file-type": "10.9.1",
84
84
  "@types/inquirer": "9.0.3",
85
85
  "@types/js-yaml": "4.0.5",
@@ -120,5 +120,5 @@
120
120
  ]
121
121
  }
122
122
  },
123
- "gitHead": "b7e0214655df6dcdd70c7944b9a14b0d752577ae"
123
+ "gitHead": "64bf8365618211a456e19a130f1352a6ff7692dc"
124
124
  }