@b9g/shovel 0.2.0-beta.15 → 0.2.0-beta.17

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/bin/cli.js CHANGED
@@ -59,7 +59,7 @@ program.command("develop <entrypoint>").description("Start development server wi
59
59
  DEFAULTS.WORKERS
60
60
  ).option("--platform <name>", "Runtime platform (node, cloudflare, bun)").action(async (entrypoint, options) => {
61
61
  checkPlatformReexec(options);
62
- const { developCommand } = await import("../src/_chunks/develop-2R6YVDI7.js");
62
+ const { developCommand } = await import("../src/_chunks/develop-KQQ3NY74.js");
63
63
  await developCommand(entrypoint, options, config);
64
64
  });
65
65
  program.command("build <entrypoint>").description("Build app for production").option("--platform <name>", "Runtime platform (node, cloudflare, bun)").option(
@@ -67,7 +67,7 @@ program.command("build <entrypoint>").description("Build app for production").op
67
67
  "Run ServiceWorker lifecycle after build (install or activate, default: activate)"
68
68
  ).action(async (entrypoint, options) => {
69
69
  checkPlatformReexec(options);
70
- const { buildCommand } = await import("../src/_chunks/build-CZHJ4EAF.js");
70
+ const { buildCommand } = await import("../src/_chunks/build-JA5KVC4L.js");
71
71
  await buildCommand(entrypoint, options, config);
72
72
  process.exit(0);
73
73
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b9g/shovel",
3
- "version": "0.2.0-beta.15",
3
+ "version": "0.2.0-beta.17",
4
4
  "description": "ServiceWorker-first universal deployment platform. Write ServiceWorker apps once, deploy anywhere (Node/Bun/Cloudflare). Registry-based multi-app orchestration.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -13,6 +13,7 @@
13
13
  "@b9g/async-context": "^0.2.0-beta.0",
14
14
  "@b9g/zen": "^0.1.6",
15
15
  "@clack/prompts": "^0.7.0",
16
+ "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
16
17
  "@esbuild-plugins/node-modules-polyfill": "^0.2.2",
17
18
  "@logtape/logtape": "^1.2.0",
18
19
  "commander": "^13.1.0",
@@ -31,7 +32,7 @@
31
32
  "@b9g/filesystem": "^0.1.8",
32
33
  "@b9g/http-errors": "^0.2.0-beta.0",
33
34
  "@b9g/libuild": "^0.1.22",
34
- "@b9g/platform": "^0.1.14-beta.0",
35
+ "@b9g/platform": "^0.1.14-beta.1",
35
36
  "@b9g/platform-bun": "^0.1.12-beta.0",
36
37
  "@b9g/platform-cloudflare": "^0.1.12-beta.0",
37
38
  "@b9g/platform-node": "^0.1.14-beta.0",
@@ -47,7 +48,7 @@
47
48
  },
48
49
  "peerDependencies": {
49
50
  "@b9g/node-webworker": "^0.2.0-beta.1",
50
- "@b9g/platform": "^0.1.14-beta.0",
51
+ "@b9g/platform": "^0.1.14-beta.1",
51
52
  "@b9g/platform-node": "^0.1.14-beta.0",
52
53
  "@b9g/platform-cloudflare": "^0.1.12-beta.0",
53
54
  "@b9g/platform-bun": "^0.1.12-beta.0",
@@ -1,6 +1,7 @@
1
1
  import {
2
- ServerBundler
3
- } from "./chunk-4DKAY5MA.js";
2
+ ServerBundler,
3
+ createPlatform
4
+ } from "./chunk-SAEF4EA7.js";
4
5
  import {
5
6
  findProjectRoot,
6
7
  findWorkspaceRoot
@@ -9,7 +10,7 @@ import {
9
10
  // src/commands/build.ts
10
11
  import { resolve, join, dirname } from "path";
11
12
  import { getLogger } from "@logtape/logtape";
12
- import * as Platform from "@b9g/platform";
13
+ import { resolvePlatform } from "@b9g/platform";
13
14
  import { readFile, writeFile } from "fs/promises";
14
15
  var logger = getLogger(["shovel"]);
15
16
  async function buildForProduction({
@@ -27,7 +28,7 @@ async function buildForProduction({
27
28
  logger.debug("Output:", { outputDir });
28
29
  logger.debug("Target platform:", { platform });
29
30
  logger.debug("Project root:", { projectRoot });
30
- const platformInstance = await Platform.createPlatform(platform);
31
+ const platformInstance = await createPlatform(platform);
31
32
  const platformESBuildConfig = platformInstance.getESBuildConfig();
32
33
  const bundler = new ServerBundler({
33
34
  entrypoint,
@@ -121,7 +122,7 @@ async function generateExecutablePackageJSON(platform) {
121
122
  return packageJSON;
122
123
  }
123
124
  async function buildCommand(entrypoint, options, config) {
124
- const platform = Platform.resolvePlatform({ ...options, config });
125
+ const platform = resolvePlatform({ ...options, config });
125
126
  let lifecycleOption;
126
127
  if (options.lifecycle) {
127
128
  const stage = typeof options.lifecycle === "string" ? options.lifecycle : "activate";
@@ -1016,6 +1016,29 @@ These modules are not bundled and won't be available at runtime.`
1016
1016
  }
1017
1017
  };
1018
1018
 
1019
+ // src/utils/platform.ts
1020
+ async function createPlatform(platformName, options = {}) {
1021
+ switch (platformName) {
1022
+ case "node": {
1023
+ const { default: NodePlatform } = await import("@b9g/platform-node");
1024
+ return new NodePlatform(options);
1025
+ }
1026
+ case "bun": {
1027
+ const { default: BunPlatform } = await import("@b9g/platform-bun");
1028
+ return new BunPlatform(options);
1029
+ }
1030
+ case "cloudflare": {
1031
+ const { default: CloudflarePlatform } = await import("@b9g/platform-cloudflare");
1032
+ return new CloudflarePlatform(options);
1033
+ }
1034
+ default:
1035
+ throw new Error(
1036
+ `Unknown platform: ${platformName}. Valid platforms: node, bun, cloudflare`
1037
+ );
1038
+ }
1039
+ }
1040
+
1019
1041
  export {
1020
- ServerBundler
1042
+ ServerBundler,
1043
+ createPlatform
1021
1044
  };
@@ -1,23 +1,24 @@
1
1
  import {
2
- ServerBundler
3
- } from "./chunk-4DKAY5MA.js";
2
+ ServerBundler,
3
+ createPlatform
4
+ } from "./chunk-SAEF4EA7.js";
4
5
  import {
5
6
  DEFAULTS
6
7
  } from "./chunk-PTLNYIRW.js";
7
8
 
8
9
  // src/commands/develop.ts
9
10
  import { getLogger } from "@logtape/logtape";
10
- import * as Platform from "@b9g/platform";
11
+ import { resolvePlatform } from "@b9g/platform";
11
12
  var logger = getLogger(["shovel"]);
12
13
  async function developCommand(entrypoint, options, config) {
13
14
  try {
14
- const platformName = Platform.resolvePlatform({ ...options, config });
15
+ const platformName = resolvePlatform({ ...options, config });
15
16
  const workerCount = getWorkerCount(options, config);
16
17
  const port = parseInt(options.port || String(DEFAULTS.SERVER.PORT), 10);
17
18
  const host = options.host || DEFAULTS.SERVER.HOST;
18
19
  logger.debug("Platform: {platform}", { platform: platformName });
19
20
  logger.debug("Worker count: {workerCount}", { workerCount });
20
- const platformInstance = await Platform.createPlatform(platformName, {
21
+ const platformInstance = await createPlatform(platformName, {
21
22
  port,
22
23
  host,
23
24
  workers: workerCount