@shopify/cli-hydrogen 0.33.1 → 0.33.2
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/CHANGELOG.md +8 -0
- package/dist/{package-830cee27.js → Command-fd93d525.js} +56117 -56104
- package/dist/Command-fd93d525.js.map +1 -0
- package/dist/commands/hydrogen/check.js +11 -11
- package/dist/commands/hydrogen/check.js.map +1 -1
- package/dist/commands/hydrogen/init.js +135 -129
- package/dist/commands/hydrogen/init.js.map +1 -1
- package/dist/commands/hydrogen/preview.js +18 -16
- package/dist/commands/hydrogen/preview.js.map +1 -1
- package/package.json +19 -8
- package/dist/package-830cee27.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { path, output, file, error } from '@shopify/cli-kit';
|
|
2
|
-
import { Flags, Command } from '@oclif/core';
|
|
3
1
|
import { Request, MiniflareCore, CorePlugin } from '@miniflare/core';
|
|
4
|
-
import { CachePlugin } from '@miniflare/cache';
|
|
5
|
-
import { VMScriptRunner } from '@miniflare/runner-vm';
|
|
6
|
-
import { Log, LogLevel } from '@miniflare/shared';
|
|
7
|
-
import require$$0$5 from 'path';
|
|
8
|
-
import require$$3 from 'http';
|
|
9
|
-
import require$$0$3 from 'fs';
|
|
10
|
-
import require$$7, { URL } from 'url';
|
|
11
2
|
import require$$0$1 from 'tty';
|
|
12
3
|
import require$$0$2 from 'util';
|
|
4
|
+
import require$$0$3 from 'fs';
|
|
13
5
|
import require$$4 from 'net';
|
|
14
6
|
import require$$0$4 from 'events';
|
|
7
|
+
import require$$7 from 'url';
|
|
8
|
+
import require$$3 from 'http';
|
|
9
|
+
import { path, output, file, error } from '@shopify/cli-kit';
|
|
10
|
+
import { URL } from 'node:url';
|
|
15
11
|
import { MemoryStorage } from '@miniflare/storage-memory';
|
|
12
|
+
import { CachePlugin } from '@miniflare/cache';
|
|
13
|
+
import { VMScriptRunner } from '@miniflare/runner-vm';
|
|
14
|
+
import { Log, LogLevel } from '@miniflare/shared';
|
|
15
|
+
import { Flags, Command } from '@oclif/core';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @param typeMap [Object] Map of MIME type -> Array[extensions]
|
|
@@ -3216,7 +3216,7 @@ function getProtohost(url) {
|
|
|
3216
3216
|
|
|
3217
3217
|
function createAssetMiddleware(assets) {
|
|
3218
3218
|
return (req, res, next) => {
|
|
3219
|
-
const filePath =
|
|
3219
|
+
const filePath = path.join(process.cwd(), "./dist/client", req.url);
|
|
3220
3220
|
if (assets.includes(filePath)) {
|
|
3221
3221
|
const rs = require$$0$3.createReadStream(filePath);
|
|
3222
3222
|
const { size } = require$$0$3.statSync(filePath);
|
|
@@ -3224,7 +3224,7 @@ function createAssetMiddleware(assets) {
|
|
|
3224
3224
|
res.setHeader("Content-Length", size);
|
|
3225
3225
|
return rs.pipe(res);
|
|
3226
3226
|
}
|
|
3227
|
-
next();
|
|
3227
|
+
return next();
|
|
3228
3228
|
};
|
|
3229
3229
|
}
|
|
3230
3230
|
function createRequestMiddleware(mf) {
|
|
@@ -3247,9 +3247,9 @@ function createRequestMiddleware(mf) {
|
|
|
3247
3247
|
}
|
|
3248
3248
|
}
|
|
3249
3249
|
res.end();
|
|
3250
|
-
} catch (
|
|
3250
|
+
} catch (error) {
|
|
3251
3251
|
res.writeHead(500, { "Content-Type": "text/plain; charset=UTF-8" });
|
|
3252
|
-
res.end(
|
|
3252
|
+
res.end(error.stack, "utf8");
|
|
3253
3253
|
}
|
|
3254
3254
|
return response;
|
|
3255
3255
|
};
|
|
@@ -3317,7 +3317,7 @@ async function runPreview({ directory, port }) {
|
|
|
3317
3317
|
});
|
|
3318
3318
|
const app = await mf.createServer({ assets: files });
|
|
3319
3319
|
app.listen(port, () => {
|
|
3320
|
-
output.
|
|
3320
|
+
output.info(`
|
|
3321
3321
|
Started miniOxygen server. Listening at http://localhost:${port}
|
|
3322
3322
|
`);
|
|
3323
3323
|
});
|
|
@@ -3339,13 +3339,15 @@ Preview.description = "Run a Hydrogen storefront locally in a worker environment
|
|
|
3339
3339
|
Preview.flags = {
|
|
3340
3340
|
path: Flags.string({
|
|
3341
3341
|
hidden: true,
|
|
3342
|
-
description: "the path to your hydrogen storefront"
|
|
3342
|
+
description: "the path to your hydrogen storefront",
|
|
3343
|
+
env: "SHOPIFY_FLAG_PATH"
|
|
3343
3344
|
}),
|
|
3344
3345
|
port: Flags.string({
|
|
3345
3346
|
char: "p",
|
|
3346
3347
|
hidden: true,
|
|
3347
3348
|
description: "the port to run the preview server on",
|
|
3348
|
-
default: "3000"
|
|
3349
|
+
default: "3000",
|
|
3350
|
+
env: "SHOPIFY_FLAG_PORT"
|
|
3349
3351
|
})
|
|
3350
3352
|
};
|
|
3351
3353
|
|