@b9g/shovel 0.2.0-beta.21 → 0.2.0-beta.22
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-
|
|
62
|
+
const { developCommand } = await import("../src/_chunks/develop-72XACUTR.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-
|
|
70
|
+
const { buildCommand } = await import("../src/_chunks/build-WBR66YEQ.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.
|
|
3
|
+
"version": "0.2.0-beta.22",
|
|
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": {
|
|
@@ -32,17 +32,7 @@ var TRANSPILABLE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
32
32
|
]);
|
|
33
33
|
var CSS_EXTENSIONS = /* @__PURE__ */ new Set([".css"]);
|
|
34
34
|
var logger = getLogger(["shovel"]);
|
|
35
|
-
var DEFAULT_CONFIG = {
|
|
36
|
-
outDir: "dist",
|
|
37
|
-
clientBuild: {}
|
|
38
|
-
};
|
|
39
35
|
var HASH_LENGTH = 16;
|
|
40
|
-
function mergeConfig(userConfig = {}) {
|
|
41
|
-
return {
|
|
42
|
-
...DEFAULT_CONFIG,
|
|
43
|
-
...userConfig
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
36
|
function normalizePath(basePath) {
|
|
47
37
|
if (!basePath.startsWith("/")) {
|
|
48
38
|
basePath = "/" + basePath;
|
|
@@ -53,12 +43,12 @@ function normalizePath(basePath) {
|
|
|
53
43
|
return basePath;
|
|
54
44
|
}
|
|
55
45
|
function assetsPlugin(options = {}) {
|
|
56
|
-
const
|
|
46
|
+
const outDir = options.outDir ?? "dist";
|
|
57
47
|
const manifest = {
|
|
58
48
|
assets: {},
|
|
59
49
|
generated: (/* @__PURE__ */ new Date()).toISOString(),
|
|
60
50
|
config: {
|
|
61
|
-
outDir
|
|
51
|
+
outDir
|
|
62
52
|
}
|
|
63
53
|
};
|
|
64
54
|
const contexts = /* @__PURE__ */ new Map();
|
|
@@ -99,7 +89,6 @@ function assetsPlugin(options = {}) {
|
|
|
99
89
|
let outputExt = ext;
|
|
100
90
|
let mimeType;
|
|
101
91
|
if (needsTranspilation) {
|
|
102
|
-
const clientOpts = config.clientBuild;
|
|
103
92
|
const defaultPlugins = [
|
|
104
93
|
NodeModulesPolyfillPlugin(),
|
|
105
94
|
NodeGlobalsPolyfillPlugin({
|
|
@@ -107,7 +96,7 @@ function assetsPlugin(options = {}) {
|
|
|
107
96
|
buffer: true
|
|
108
97
|
})
|
|
109
98
|
];
|
|
110
|
-
const plugins =
|
|
99
|
+
const plugins = options.plugins ? [...options.plugins, ...defaultPlugins] : defaultPlugins;
|
|
111
100
|
const ctx = await getContext(args.path, {
|
|
112
101
|
entryPoints: [args.path],
|
|
113
102
|
bundle: true,
|
|
@@ -117,18 +106,18 @@ function assetsPlugin(options = {}) {
|
|
|
117
106
|
write: false,
|
|
118
107
|
minify: true,
|
|
119
108
|
// outdir is required for esbuild to know where to put extracted CSS
|
|
120
|
-
outdir:
|
|
121
|
-
// Apply polyfills and user-provided
|
|
109
|
+
outdir: outDir,
|
|
110
|
+
// Apply polyfills and user-provided build options
|
|
122
111
|
plugins,
|
|
123
|
-
define:
|
|
124
|
-
inject:
|
|
125
|
-
external:
|
|
126
|
-
alias:
|
|
112
|
+
define: options.define,
|
|
113
|
+
inject: options.inject,
|
|
114
|
+
external: options.external,
|
|
115
|
+
alias: options.alias,
|
|
127
116
|
// Apply JSX configuration (defaults to @b9g/crank automatic runtime)
|
|
128
|
-
jsx:
|
|
129
|
-
jsxFactory:
|
|
130
|
-
jsxFragment:
|
|
131
|
-
jsxImportSource:
|
|
117
|
+
jsx: options.jsx ?? "automatic",
|
|
118
|
+
jsxFactory: options.jsxFactory,
|
|
119
|
+
jsxFragment: options.jsxFragment,
|
|
120
|
+
jsxImportSource: options.jsxImportSource ?? "@b9g/crank"
|
|
132
121
|
});
|
|
133
122
|
const result = await ctx.rebuild();
|
|
134
123
|
if (!result.outputFiles) {
|
|
@@ -185,14 +174,18 @@ function assetsPlugin(options = {}) {
|
|
|
185
174
|
});
|
|
186
175
|
}
|
|
187
176
|
};
|
|
177
|
+
const plugins = [
|
|
178
|
+
...options.plugins || [],
|
|
179
|
+
externalAbsolutePathsPlugin
|
|
180
|
+
];
|
|
188
181
|
const ctx = await getContext(entryPath, {
|
|
189
182
|
entryPoints: [entryPath],
|
|
190
183
|
bundle: true,
|
|
191
184
|
write: false,
|
|
192
185
|
minify: true,
|
|
193
186
|
// outdir required for esbuild to generate output paths
|
|
194
|
-
outdir:
|
|
195
|
-
plugins
|
|
187
|
+
outdir: outDir,
|
|
188
|
+
plugins,
|
|
196
189
|
// Loaders for web assets referenced in CSS via url()
|
|
197
190
|
loader: {
|
|
198
191
|
// Fonts
|
|
@@ -225,7 +218,7 @@ function assetsPlugin(options = {}) {
|
|
|
225
218
|
};
|
|
226
219
|
}
|
|
227
220
|
const basePath2 = normalizePath(args.with.assetBase);
|
|
228
|
-
const cssOutputDir = join(
|
|
221
|
+
const cssOutputDir = join(outDir, "public", basePath2);
|
|
229
222
|
if (!existsSync(cssOutputDir)) {
|
|
230
223
|
mkdirSync(cssOutputDir, { recursive: true });
|
|
231
224
|
}
|
|
@@ -262,7 +255,7 @@ function assetsPlugin(options = {}) {
|
|
|
262
255
|
}
|
|
263
256
|
const basePath = normalizePath(args.with.assetBase);
|
|
264
257
|
const publicURL = `${basePath}${filename}`;
|
|
265
|
-
const outputDir = join(
|
|
258
|
+
const outputDir = join(outDir, "public", basePath);
|
|
266
259
|
if (!existsSync(outputDir)) {
|
|
267
260
|
mkdirSync(outputDir, { recursive: true });
|
|
268
261
|
}
|
|
@@ -299,7 +292,7 @@ function assetsPlugin(options = {}) {
|
|
|
299
292
|
}
|
|
300
293
|
contexts.clear();
|
|
301
294
|
try {
|
|
302
|
-
const manifestPath = join(
|
|
295
|
+
const manifestPath = join(outDir, "server", "assets.json");
|
|
303
296
|
const manifestDir = dirname(manifestPath);
|
|
304
297
|
if (!existsSync(manifestDir)) {
|
|
305
298
|
mkdirSync(manifestDir, { recursive: true });
|
|
@@ -687,12 +680,11 @@ var ServerBundler = class {
|
|
|
687
680
|
importMetaPlugin(),
|
|
688
681
|
assetsPlugin({
|
|
689
682
|
outDir: outputDir,
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
}
|
|
683
|
+
plugins: userPlugins,
|
|
684
|
+
jsx: jsxOptions.jsx,
|
|
685
|
+
jsxFactory: jsxOptions.jsxFactory,
|
|
686
|
+
jsxFragment: jsxOptions.jsxFragment,
|
|
687
|
+
jsxImportSource: jsxOptions.jsxImportSource
|
|
696
688
|
})
|
|
697
689
|
];
|
|
698
690
|
if (watch2) {
|