Skip to content

Commit

Permalink
[DX-7170] Migrate @devvit/protos imports to paths (#30)
Browse files Browse the repository at this point in the history
Stop using the @devvit/protos barrel for imports. This is intended only
for code executed within apps. If app code isn't using an export, we
want the ability to delete it from the barrel.
  • Loading branch information
niedzielski authored Jul 30, 2024
1 parent baa9c0d commit aff219c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
3 changes: 2 additions & 1 deletion src/bundler/linker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {LinkedBundle, SerializableServiceDefinition} from '@devvit/protos'
import type {LinkedBundle} from '@devvit/protos/types/devvit/runtime/bundle.js'
import type {SerializableServiceDefinition} from '@devvit/protos/types/devvit/runtime/serializable.js'
import type {AssetMap} from '@devvit/shared-types/Assets.js'

type LinkerAssetMaps = {
Expand Down
19 changes: 10 additions & 9 deletions src/elements/play-pen/play-pen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type {Empty, LinkedBundle} from '@devvit/protos'
import type {LinkedBundle} from '@devvit/protos/types/devvit/runtime/bundle.js'
import {type Empty} from '@devvit/protos/types/google/protobuf/empty.js'
import {throttle} from '@devvit/shared-types/throttle.js'
import type {DevvitUIError} from '@devvit/ui-renderer/client/devvit-custom-post.js'
import type {VirtualTypeScriptEnvironment} from '@typescript/vfs'
Expand Down Expand Up @@ -37,6 +38,14 @@ import type {ColorScheme} from '../../types/color-scheme.js'
import type {Diagnostics} from '../../types/diagnostics.js'
import {newHostname} from '../../utils/compute-util.js'
import {cssReset} from '../../utils/css-reset.js'
import {
type AssetsFilesystemChange,
type AssetsFilesystemType,
type AssetsState,
type AssetsVirtualFileChange,
emptyAssetsState,
PlayAssets
} from '../play-assets/play-assets.js'
import type {OpenLine} from '../play-console.js'
import type {PlayEditor} from '../play-editor/play-editor.js'
import type {PlayToast} from '../play-toast.js'
Expand All @@ -49,14 +58,6 @@ import '../play-pen-header.js'
import '../play-preview-controls.js'
import '../play-preview.js'
import '../play-toast.js'
import {
type AssetsFilesystemChange,
type AssetsFilesystemType,
type AssetsState,
type AssetsVirtualFileChange,
emptyAssetsState,
PlayAssets
} from '../play-assets/play-assets.js'

declare global {
interface HTMLElementTagNameMap {
Expand Down
4 changes: 3 additions & 1 deletion src/elements/play-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import * as sandboxedRuntimeScript from '@devvit/previews/dist/sandboxed-pen.wor
// @ts-expect-error
import * as unsandboxedRuntimeScript from '@devvit/previews/dist/unsandboxed-pen.worker.min.js'

import type {Empty, LinkedBundle, Metadata} from '@devvit/protos'
import {type Metadata} from '@devvit/protos/lib/Types.js'
import type {LinkedBundle} from '@devvit/protos/types/devvit/runtime/bundle.js'
import {type Empty} from '@devvit/protos/types/google/protobuf/empty.js'
import {
LitElement,
css,
Expand Down
8 changes: 3 additions & 5 deletions src/runtime/bundle-store.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {
BundleServiceDefinition,
type Empty,
type LinkedBundle
} from '@devvit/protos'
import type {LinkedBundle} from '@devvit/protos/types/devvit/runtime/bundle.js'
import {BundleServiceDefinition} from '@devvit/protos/types/devvit/service/bundle_service.js'
import {type Empty} from '@devvit/protos/types/google/protobuf/empty.js'
import {createChannel, createClient} from 'nice-grpc-web'

export type BundleStore = {
Expand Down
18 changes: 11 additions & 7 deletions src/runtime/remote-app.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import {type Metadata} from '@devvit/protos/lib/Types.js'
import {
CustomPostDefinition,
UIEventHandlerDefinition,
type Empty,
type HandleUIEventRequest,
type HandleUIEventResponse,
type Metadata,
type RenderPostRequest,
type RenderPostResponse,
type RenderPostResponse
} from '@devvit/protos/types/devvit/reddit/custom_post/v1alpha/custom_post.js'
import {
type UIRequest,
type UIResponse
} from '@devvit/protos'
} from '@devvit/protos/types/devvit/ui/block_kit/v1beta/ui.js'
import {
UIEventHandlerDefinition,
type HandleUIEventRequest,
type HandleUIEventResponse
} from '@devvit/protos/types/devvit/ui/events/v1alpha/handle_ui.js'
import {type Empty} from '@devvit/protos/types/google/protobuf/empty.js'
import type {UIApp} from '@devvit/ui-renderer/client/remote-app.js'
import {
Metadata as NiceMeta,
Expand Down

0 comments on commit aff219c

Please sign in to comment.