@ollie-shop/cli 1.0.0 → 1.0.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @ollie-shop/cli@1.0.0 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
2
+ > @ollie-shop/cli@1.0.2 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
3
3
  > tsup
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,5 +9,5 @@
9
9
  CLI Target: node22
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/index.js 37.04 KB
13
- ESM ⚡️ Build success in 179ms
12
+ ESM dist/index.js 37.48 KB
13
+ ESM ⚡️ Build success in 166ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ollie-shop/cli
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 19774e0: Add Private Network Access CORS header to allow cross-origin CSS loading from localhost during studio mode
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 6aac161: Add missing header in the cli server
14
+
3
15
  ## 1.0.0
4
16
 
5
17
  ### Major Changes
package/dist/index.js CHANGED
@@ -603,6 +603,7 @@ async function startDevServer(ctx, options = {}) {
603
603
  const componentName = pathMatch[1];
604
604
  res.setHeader("Access-Control-Allow-Origin", "*");
605
605
  res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
606
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
606
607
  try {
607
608
  const stream = await createComponentBundle({ cwd, componentName });
608
609
  res.setHeader("Content-Type", "application/zip");
@@ -642,6 +643,7 @@ async function startDevServer(ctx, options = {}) {
642
643
  res.setHeader("Access-Control-Allow-Origin", "*");
643
644
  res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
644
645
  res.setHeader("Access-Control-Allow-Headers", "Content-Type");
646
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
645
647
  let body = "";
646
648
  req.on("data", (chunk) => {
647
649
  body += chunk.toString();
@@ -680,7 +682,12 @@ async function startDevServer(ctx, options = {}) {
680
682
  if (req.method === "OPTIONS") {
681
683
  res.setHeader("Access-Control-Allow-Origin", "*");
682
684
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
683
- res.setHeader("Access-Control-Allow-Headers", "Content-Type");
685
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
686
+ const requestedHeaders = req.headers["access-control-request-headers"];
687
+ res.setHeader(
688
+ "Access-Control-Allow-Headers",
689
+ requestedHeaders || "Content-Type"
690
+ );
684
691
  res.statusCode = 204;
685
692
  res.end();
686
693
  return;
@@ -694,8 +701,12 @@ async function startDevServer(ctx, options = {}) {
694
701
  headers: req.headers
695
702
  },
696
703
  (proxyRes) => {
697
- res.setHeader("Access-Control-Allow-Origin", "*");
698
- res.writeHead(proxyRes.statusCode || 200, proxyRes.headers);
704
+ const responseHeaders = {
705
+ ...proxyRes.headers,
706
+ "access-control-allow-origin": "*",
707
+ "access-control-allow-private-network": "true"
708
+ };
709
+ res.writeHead(proxyRes.statusCode || 200, responseHeaders);
699
710
  proxyRes.pipe(res);
700
711
  }
701
712
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ollie-shop/cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Ollie Shop CLI - Development tools for custom checkouts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -280,6 +280,7 @@ export async function startDevServer(
280
280
  // Set CORS headers
281
281
  res.setHeader("Access-Control-Allow-Origin", "*");
282
282
  res.setHeader("Access-Control-Allow-Methods", "GET, OPTIONS");
283
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
283
284
 
284
285
  try {
285
286
  const stream = await createComponentBundle({ cwd, componentName });
@@ -328,6 +329,7 @@ export async function startDevServer(
328
329
  res.setHeader("Access-Control-Allow-Origin", "*");
329
330
  res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
330
331
  res.setHeader("Access-Control-Allow-Headers", "Content-Type");
332
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
331
333
 
332
334
  // Read request body
333
335
  let body = "";
@@ -380,7 +382,14 @@ export async function startDevServer(
380
382
  if (req.method === "OPTIONS") {
381
383
  res.setHeader("Access-Control-Allow-Origin", "*");
382
384
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
383
- res.setHeader("Access-Control-Allow-Headers", "Content-Type");
385
+ // Allow Private Network Access (public origin → localhost)
386
+ res.setHeader("Access-Control-Allow-Private-Network", "true");
387
+ // Reflect requested headers back (supports traceparent, tracestate, etc.)
388
+ const requestedHeaders = req.headers["access-control-request-headers"];
389
+ res.setHeader(
390
+ "Access-Control-Allow-Headers",
391
+ requestedHeaders || "Content-Type",
392
+ );
384
393
  res.statusCode = 204;
385
394
  res.end();
386
395
  return;
@@ -396,10 +405,14 @@ export async function startDevServer(
396
405
  headers: req.headers,
397
406
  },
398
407
  (proxyRes) => {
399
- // Add CORS headers to proxied responses
400
- res.setHeader("Access-Control-Allow-Origin", "*");
408
+ // Merge CORS headers with proxied response headers
409
+ const responseHeaders = {
410
+ ...proxyRes.headers,
411
+ "access-control-allow-origin": "*",
412
+ "access-control-allow-private-network": "true",
413
+ };
401
414
 
402
- res.writeHead(proxyRes.statusCode || 200, proxyRes.headers);
415
+ res.writeHead(proxyRes.statusCode || 200, responseHeaders);
403
416
  proxyRes.pipe(res);
404
417
  },
405
418
  );