@cloudflare/autoconfig 0.5.1 → 0.6.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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WorkerConfigInput } from '@cloudflare/config';
1
+ import { WorkerConfig } from '@cloudflare/config';
2
2
  import { PackageManager, PackageJSON, RawConfig, Config, FatalError, TelemetryMessage, UserError } from '@cloudflare/workers-utils';
3
3
  export { getInstalledPackageVersion } from '@cloudflare/workers-utils';
4
4
 
@@ -177,7 +177,7 @@ type ConfigurationResults = {
177
177
  /** The tool that cf should delegate build and development commands to. */
178
178
  buildTool?: "vite" | "wrangler";
179
179
  /** Worker configuration generated by the framework. `null` if an external tool generates it. */
180
- workerConfig: Partial<WorkerConfigInput> | null;
180
+ workerConfig: Partial<WorkerConfig> | null;
181
181
  /** Build configuration that complements the Worker configuration. */
182
182
  buildConfig?: BuildConfig;
183
183
  packageJsonScriptsOverrides?: PackageJsonScriptsOverrides;
@@ -245,7 +245,7 @@ type AutoConfigOptions = {
245
245
  };
246
246
  type AutoConfigSummary = {
247
247
  scripts: Record<string, string>;
248
- workerConfig?: WorkerConfigInput;
248
+ workerConfig?: WorkerConfig;
249
249
  buildConfig?: BuildConfig;
250
250
  wranglerConfig?: RawConfig;
251
251
  frameworkConfiguration?: string;
@@ -322,7 +322,7 @@ declare function runAutoConfig(autoConfigDetails: AutoConfigDetails, autoConfigO
322
322
  */
323
323
  declare function buildOperationsSummary(autoConfigDetails: AutoConfigDetailsForNonConfiguredProject & {
324
324
  outputDir: NonNullable<AutoConfigDetails["outputDir"]>;
325
- }, workerConfig: WorkerConfigInput | null, configurationResults: ConfigurationResults, projectCommands: {
325
+ }, workerConfig: WorkerConfig | null, configurationResults: ConfigurationResults, projectCommands: {
326
326
  build?: string;
327
327
  deploy: string;
328
328
  version?: string;
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import { fileURLToPath } from 'node:url';
17
17
  import os from 'node:os';
18
18
  import tty from 'node:tty';
19
19
  import { maybeAppendWranglerToGitIgnore, maybeAppendWranglerToGitIgnoreLikeFile } from '@cloudflare/cli-shared-helpers/gitignore';
20
- import { InputWorkerSchema, convertToWranglerConfig } from '@cloudflare/config';
20
+ import { InputConfigSchema, convertToWranglerConfig } from '@cloudflare/config';
21
21
 
22
22
  // ../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
23
23
  var tslib_es6_exports = {};
@@ -52784,11 +52784,8 @@ function getWranglerConfig(workerConfig, configurationResults) {
52784
52784
  if (workerConfig === null) {
52785
52785
  return null;
52786
52786
  }
52787
- const parsedWorkerConfig = InputWorkerSchema.parse({
52788
- type: "worker",
52789
- ...workerConfig
52790
- });
52791
- const convertedWranglerConfig = convertToWranglerConfig(parsedWorkerConfig);
52787
+ const parsedConfig = InputConfigSchema.parse({ worker: workerConfig });
52788
+ const convertedWranglerConfig = convertToWranglerConfig(parsedConfig);
52792
52789
  const wranglerConfig = ensureNodejsCompatIsEnabled({
52793
52790
  $schema: "node_modules/wrangler/config-schema.json",
52794
52791
  ...convertedWranglerConfig,
@@ -52851,9 +52848,11 @@ async function saveWranglerConfigTs(projectPath, buildConfig) {
52851
52848
  }
52852
52849
  __name(saveWranglerConfigTs, "saveWranglerConfigTs");
52853
52850
  function renderCloudflareConfig(workerConfig) {
52854
- return `import { defineWorker } from "cf/config";
52851
+ return `import { defineConfig } from "cf/config";
52855
52852
 
52856
- export default defineWorker(${JSON.stringify(workerConfig, null, 2)});
52853
+ export default defineConfig({
52854
+ worker: ${JSON.stringify(workerConfig, null, 2).replaceAll("\n", "\n ")}
52855
+ });
52857
52856
  `;
52858
52857
  }
52859
52858
  __name(renderCloudflareConfig, "renderCloudflareConfig");