@cloudflare/vite-plugin 1.22.0 → 1.22.1

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.mjs CHANGED
@@ -1928,10 +1928,10 @@ var ENVIRONMENT_TAG_PREFIX = "cf:environment=";
1928
1928
  var PATH_TO_DEPLOY_CONFIG = ".wrangler/deploy/config.json";
1929
1929
 
1930
1930
  //#endregion
1931
- //#region ../workers-utils/dist/chunk-4N6XW2IM.mjs
1931
+ //#region ../workers-utils/dist/chunk-4233U5MA.mjs
1932
1932
  function getLocalWorkerdCompatibilityDate({ projectPath = process.cwd() } = {}) {
1933
1933
  try {
1934
- const miniflareEntry = module$1.createRequire(projectPath).resolve("miniflare");
1934
+ const miniflareEntry = module$1.createRequire(path4.join(projectPath, "package.json")).resolve("miniflare");
1935
1935
  const workerdDate = module$1.createRequire(miniflareEntry)("workerd").compatibilityDate;
1936
1936
  return {
1937
1937
  date: toSafeCompatibilityDate(new Date(workerdDate)),
@@ -5604,7 +5604,7 @@ var getWranglerHideBanner = getBooleanEnvironmentVariableFactory({
5604
5604
  });
5605
5605
  var getCloudflareEnv = getEnvironmentVariableFactory({ variableName: "CLOUDFLARE_ENV" });
5606
5606
  var getOpenNextDeployFromEnv = getEnvironmentVariableFactory({ variableName: "OPEN_NEXT_DEPLOY" });
5607
- var getLocalExplorerFromEnv = getBooleanEnvironmentVariableFactory({
5607
+ var getLocalExplorerEnabledFromEnv = getBooleanEnvironmentVariableFactory({
5608
5608
  variableName: "X_LOCAL_EXPLORER",
5609
5609
  defaultValue: false
5610
5610
  });
@@ -6363,6 +6363,7 @@ function normalizeAndValidateEnvironment(diagnostics, configPath, rawEnv, isDisp
6363
6363
  python_modules: inheritable(diagnostics, topLevelEnv, rawEnv, "python_modules", validatePythonModules, { exclude: ["**/*.pyc"] })
6364
6364
  };
6365
6365
  warnIfDurableObjectsHaveNoMigrations(diagnostics, environment.durable_objects, environment.migrations, configPath);
6366
+ if (envName !== "top level") validateAdditionalProperties(diagnostics, "env." + envName, Object.keys(rawEnv), Object.keys(environment));
6366
6367
  return environment;
6367
6368
  }
6368
6369
  __name(normalizeAndValidateEnvironment, "normalizeAndValidateEnvironment");
@@ -7659,7 +7660,7 @@ function warnIfDurableObjectsHaveNoMigrations(diagnostics, durableObjects, migra
7659
7660
  \`\`\`
7660
7661
  ${formatConfigSnippet({ migrations: [{
7661
7662
  tag: "v1",
7662
- new_classes: durableObjectClassnames
7663
+ new_sqlite_classes: durableObjectClassnames
7663
7664
  }] }, configPath)}
7664
7665
  \`\`\`
7665
7666
 
@@ -14171,6 +14172,7 @@ function hasNodeJsAls(workerConfig) {
14171
14172
  function isNodeAlsModule(modulePath) {
14172
14173
  return /^(?:node:)?async_hooks$/.test(modulePath);
14173
14174
  }
14175
+ const nodeBuiltinsRE = /* @__PURE__ */ new RegExp(`^(${nonPrefixedNodeModules.join("|")}|node:.+)$`);
14174
14176
  function assertHasNodeJsCompat(nodeJsCompat) {
14175
14177
  assert(nodeJsCompat, `expected nodeJsCompat to be defined`);
14176
14178
  }
@@ -26110,7 +26112,7 @@ async function getDevMiniflareOptions(ctx, viteDevServer) {
26110
26112
  inspectorPort: inputInspectorPort === false ? void 0 : inputInspectorPort,
26111
26113
  unsafeDevRegistryPath: getDefaultDevRegistryPath(),
26112
26114
  unsafeTriggerHandlers: true,
26113
- unsafeLocalExplorer: getLocalExplorerFromEnv(),
26115
+ unsafeLocalExplorer: getLocalExplorerEnabledFromEnv(),
26114
26116
  handleStructuredLogs: getStructuredLogsLogger(logger),
26115
26117
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
26116
26118
  workers: [
@@ -26213,7 +26215,7 @@ async function getPreviewMiniflareOptions(ctx, vitePreviewServer) {
26213
26215
  inspectorPort: inputInspectorPort === false ? void 0 : inputInspectorPort,
26214
26216
  unsafeDevRegistryPath: getDefaultDevRegistryPath(),
26215
26217
  unsafeTriggerHandlers: true,
26216
- unsafeLocalExplorer: getLocalExplorerFromEnv(),
26218
+ unsafeLocalExplorer: getLocalExplorerEnabledFromEnv(),
26217
26219
  handleStructuredLogs: getStructuredLogsLogger(logger),
26218
26220
  defaultPersistRoot: getPersistenceRoot(resolvedViteConfig.root, resolvedPluginConfig.persistState),
26219
26221
  workers
@@ -26428,16 +26430,26 @@ const nodeJsCompatPlugin = createPlugin("nodejs-compat", (ctx) => {
26428
26430
  const nodeJsCompat = ctx.getNodeJsCompat(name);
26429
26431
  if (nodeJsCompat) return {
26430
26432
  resolve: { builtins: [...nodeJsCompat.externals] },
26431
- optimizeDeps: { exclude: [
26432
- ...nonPrefixedNodeModules,
26433
- ...nonPrefixedNodeModules.map((module$2) => `node:${module$2}`),
26434
- ...[
26435
- "node:sea",
26436
- "node:sqlite",
26437
- "node:test",
26438
- "node:test/reporters"
26439
- ]
26440
- ] }
26433
+ ...isRolldown ? { build: { rolldownOptions: { plugins: [vite.esmExternalRequirePlugin({
26434
+ external: [...nodeJsCompat.externals],
26435
+ skipDuplicateCheck: true
26436
+ })] } } } : {},
26437
+ optimizeDeps: {
26438
+ exclude: [
26439
+ ...nonPrefixedNodeModules,
26440
+ ...nonPrefixedNodeModules.map((module$2) => `node:${module$2}`),
26441
+ ...[
26442
+ "node:sea",
26443
+ "node:sqlite",
26444
+ "node:test",
26445
+ "node:test/reporters"
26446
+ ]
26447
+ ],
26448
+ ...isRolldown ? { rolldownOptions: { plugins: [vite.esmExternalRequirePlugin({
26449
+ external: [nodeBuiltinsRE],
26450
+ skipDuplicateCheck: true
26451
+ })] } } : {}
26452
+ }
26441
26453
  };
26442
26454
  },
26443
26455
  applyToEnvironment(environment) {
@@ -26516,7 +26528,7 @@ const nodeJsCompatWarningsPlugin = createPlugin("nodejs-compat-warnings", (ctx)
26516
26528
  }] } } : { esbuildOptions: { plugins: [{
26517
26529
  name: "vite-plugin-cloudflare:nodejs-compat-warnings-resolver",
26518
26530
  setup(build$8) {
26519
- build$8.onResolve({ filter: /* @__PURE__ */ new RegExp(`^(${nonPrefixedNodeModules.join("|")}|node:.+)$`) }, ({ path: path$1, importer }) => {
26531
+ build$8.onResolve({ filter: nodeBuiltinsRE }, ({ path: path$1, importer }) => {
26520
26532
  if (hasNodeJsAls(workerConfig) && isNodeAlsModule(path$1)) return;
26521
26533
  nodeJsCompatWarningsMap.get(workerConfig)?.registerImport(path$1, importer);
26522
26534
  return {