devflare 1.0.0-next.11 → 1.0.0-next.12

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.
Files changed (38) hide show
  1. package/LLM.md +67 -73
  2. package/README.md +11 -9
  3. package/dist/{build-ezksv2dd.js → build-rfh8cgh3.js} +39 -10
  4. package/dist/bundler/index.d.ts +1 -0
  5. package/dist/bundler/index.d.ts.map +1 -1
  6. package/dist/bundler/worker-bundler.d.ts +14 -0
  7. package/dist/bundler/worker-bundler.d.ts.map +1 -0
  8. package/dist/cli/commands/build.d.ts.map +1 -1
  9. package/dist/cli/commands/deploy.d.ts.map +1 -1
  10. package/dist/cli/commands/dev.d.ts.map +1 -1
  11. package/dist/config/compiler.d.ts.map +1 -1
  12. package/dist/config/index.d.ts +1 -0
  13. package/dist/config/index.d.ts.map +1 -1
  14. package/dist/config/resolve.d.ts +3 -0
  15. package/dist/config/resolve.d.ts.map +1 -0
  16. package/dist/{deploy-jdpy21t6.js → deploy-k0fcgt3d.js} +39 -10
  17. package/dist/{dev-9mq7zhww.js → dev-d4wabqyf.js} +64 -461
  18. package/dist/dev-server/server.d.ts.map +1 -1
  19. package/dist/index-1xqeptt2.js +623 -0
  20. package/dist/{index-51s1hkw4.js → index-rfhx0yd5.js} +10 -6
  21. package/dist/{index-xqfbd9fx.js → index-twpgq9k9.js} +4 -4
  22. package/dist/index-zbvmtcn2.js +795 -0
  23. package/dist/src/browser.js +1 -1
  24. package/dist/src/cli/index.js +1 -1
  25. package/dist/src/index.js +10 -11
  26. package/dist/src/sveltekit/index.js +2 -3
  27. package/dist/src/test/index.js +4 -5
  28. package/dist/src/vite/index.js +19 -399
  29. package/dist/{types-nq5acrwh.js → types-sffr9681.js} +5 -6
  30. package/dist/vite/config-file.d.ts +25 -0
  31. package/dist/vite/config-file.d.ts.map +1 -0
  32. package/dist/vite/index.d.ts +1 -0
  33. package/dist/vite/index.d.ts.map +1 -1
  34. package/dist/worker-entry/composed-worker.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/index-k7r18na8.js +0 -0
  37. package/dist/index-ws68xvq2.js +0 -311
  38. package/dist/{index-53xcakh8.js → index-0kzg8wed.js} +3 -3
@@ -1,3 +1,6 @@
1
+ import {
2
+ bundleWorkerEntry
3
+ } from "./index-1xqeptt2.js";
1
4
  import {
2
5
  detectViteProject
3
6
  } from "./index-y1d8za14.js";
@@ -5,21 +8,26 @@ import {
5
8
  getDependencies
6
9
  } from "./index-1xpj0m4r.js";
7
10
  import {
8
- prepareComposedWorkerEntrypoint
9
- } from "./index-ws68xvq2.js";
11
+ prepareComposedWorkerEntrypoint,
12
+ resolveEffectiveViteProject,
13
+ writeGeneratedViteConfig
14
+ } from "./index-zbvmtcn2.js";
10
15
  import"./index-1p814k7s.js";
11
16
  import"./index-rbht7m9r.js";
17
+ import"./index-9wt9x09k.js";
12
18
  import {
13
19
  compileConfig,
14
20
  stringifyConfig,
15
21
  writeWranglerConfig
16
- } from "./index-51s1hkw4.js";
22
+ } from "./index-rfhx0yd5.js";
17
23
  import {
18
24
  loadConfig
19
25
  } from "./index-wyf3s77s.js";
26
+ import"./index-v8vvsn9x.js";
20
27
  import"./index-37x76zdn.js";
21
28
 
22
29
  // src/cli/commands/deploy.ts
30
+ import { relative, resolve } from "pathe";
23
31
  async function runDeployCommand(parsed, logger, options) {
24
32
  const cwd = options.cwd || process.cwd();
25
33
  const configPath = parsed.options.config;
@@ -31,9 +39,26 @@ async function runDeployCommand(parsed, logger, options) {
31
39
  logger.info(`Deploying: ${config.name}`);
32
40
  const composedMainEntry = await prepareComposedWorkerEntrypoint(cwd, config, environment);
33
41
  const wranglerConfig = compileConfig(config, environment);
34
- if (composedMainEntry) {
35
- wranglerConfig.main = composedMainEntry;
36
- logger.info(`Generated composed worker entry: ${composedMainEntry}`);
42
+ const deps = await getDependencies();
43
+ const viteProject = resolveEffectiveViteProject(await detectViteProject(cwd, deps.fs), config, environment);
44
+ if (viteProject.shouldStartVite) {
45
+ if (composedMainEntry) {
46
+ wranglerConfig.main = composedMainEntry;
47
+ logger.info(`Generated composed worker entry: ${composedMainEntry}`);
48
+ }
49
+ } else if (composedMainEntry) {
50
+ const bundledMainEntryPath = await bundleWorkerEntry({
51
+ cwd,
52
+ inputFile: resolve(cwd, composedMainEntry),
53
+ outFile: resolve(cwd, ".devflare", "worker-entrypoints", "main.js"),
54
+ rolldownOptions: config.rolldown?.options,
55
+ sourcemap: config.rolldown?.sourcemap,
56
+ minify: config.rolldown?.minify,
57
+ target: config.rolldown?.target,
58
+ logger
59
+ });
60
+ wranglerConfig.main = relative(cwd, bundledMainEntryPath).replace(/\\/g, "/");
61
+ logger.info(`Generated bundled worker entry: ${wranglerConfig.main}`);
37
62
  }
38
63
  if (dryRun) {
39
64
  logger.info("Dry run - skipping actual deployment");
@@ -43,11 +68,15 @@ async function runDeployCommand(parsed, logger, options) {
43
68
  }
44
69
  await writeWranglerConfig(cwd, wranglerConfig);
45
70
  logger.debug("Generated wrangler.jsonc");
46
- const deps = await getDependencies();
47
- const viteProject = await detectViteProject(cwd, deps.fs);
48
71
  if (viteProject.shouldStartVite) {
72
+ const generatedViteConfigPath = await writeGeneratedViteConfig({
73
+ cwd,
74
+ configPath,
75
+ environment,
76
+ localConfigPath: viteProject.viteConfigPath
77
+ });
49
78
  logger.info("Building...");
50
- const buildProc = await deps.exec.exec("bunx", ["vite", "build"], {
79
+ const buildProc = await deps.exec.exec("bunx", ["vite", "build", "--config", generatedViteConfigPath], {
51
80
  cwd,
52
81
  stdio: "inherit"
53
82
  });
@@ -56,7 +85,7 @@ async function runDeployCommand(parsed, logger, options) {
56
85
  return { exitCode: 1 };
57
86
  }
58
87
  } else {
59
- logger.info("Skipping Vite build (no local vite.config.* found for this package)");
88
+ logger.info("Skipping Vite build (no effective Vite config found for this package)");
60
89
  }
61
90
  logger.info("Deploying with wrangler...");
62
91
  const wranglerArgs = ["wrangler", "deploy"];