Skip to content

Export config types/utils#7256

Merged
petebacondarwin merged 7 commits intomainfrom
james/export-config-types
Dec 4, 2024
Merged

Export config types/utils#7256
petebacondarwin merged 7 commits intomainfrom
james/export-config-types

Conversation

@jamesopstad
Copy link
Copy Markdown
Contributor

@jamesopstad jamesopstad commented Nov 14, 2024

In the Vite plugin we are looking at generating wrangler.json files as part of the build process. Exporting these utils and types enables us to do this.

  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: type exports only
  • E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because: type exports only
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: not currently for general usage

@jamesopstad jamesopstad requested a review from a team as a code owner November 14, 2024 10:46
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 14, 2024

🦋 Changeset detected

Latest commit: 49df280

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Patch
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jamesopstad jamesopstad force-pushed the james/export-config-types branch from 2b60169 to fa4cd2b Compare November 28, 2024 10:15
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 28, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-wrangler-7256

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/7256/npm-package-wrangler-7256

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-wrangler-7256 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-create-cloudflare-7256 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-kv-asset-handler-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-miniflare-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-pages-shared-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-vitest-pool-workers-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-workers-editor-shared-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-workers-shared-7256
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/12158931737/npm-package-cloudflare-workflows-shared-7256

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.92.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20241106.2
workerd 1.20241106.2 1.20241106.2
workerd --version 1.20241106.2 2024-11-06

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

@jamesopstad jamesopstad marked this pull request as draft November 28, 2024 10:28
@jamesopstad jamesopstad changed the title Export RawConfig and RawEnvironment types Export config types/utils Nov 28, 2024
configPath: string,
env?: string
): {
interface MiniflareWorkerOptions {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should export this interface too.

Comment thread .changeset/breezy-cats-matter.md Outdated
@penalosa
Copy link
Copy Markdown
Contributor

penalosa commented Dec 3, 2024

Can we export these with an experimental/unstable name (or at least a comment to that effect)? We're about to work on a first-class API for doing this (DEVX-1423 & DEVX-1424) which is probably what we'd want frameworks to be using longer term

@jamesopstad jamesopstad force-pushed the james/export-config-types branch from e4f872e to 145d6c0 Compare December 4, 2024 11:10
@jamesopstad jamesopstad force-pushed the james/export-config-types branch from 145d6c0 to 49df280 Compare December 4, 2024 11:37
@jamesopstad jamesopstad marked this pull request as ready for review December 4, 2024 11:37

export { readConfig as unstable_readConfig };
export type {
Config as UnstableConfig,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question, should we use Unstable_Config, etc. similar to unstable_readConfig?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future there might actually be a type that starts with Unstable...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to do that but noticed there are already some types named like this without the underscore e.g. UnstableDevOptions, UnstableDevWorker. Thought it was better to keep it consistent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... 😢
I think that was probably a bad idea. But I guess it's best to stick with the convention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change them all if you like (they're called unstable so people can't exactly say they haven't been warned). That should probably be in a separate PR though.

@petebacondarwin
Copy link
Copy Markdown
Contributor

We're going to land this and then follow up today with a PR to rename all unstable types to be prefixed with Unstable_...

@petebacondarwin petebacondarwin merged commit 415e5b5 into main Dec 4, 2024
@petebacondarwin petebacondarwin deleted the james/export-config-types branch December 4, 2024 16:10
@workers-devprod workers-devprod mentioned this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants