@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.
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +12 -0
- package/dist/index.js +14 -3
- package/package.json +1 -1
- package/src/utils/esbuild.ts +17 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @ollie-shop/cli@1.0.
|
|
2
|
+
> @ollie-shop/cli@1.0.2 build /home/runner/work/ollie-shop/ollie-shop/packages/cli
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
[34mCLI[39m Target: node22
|
|
10
10
|
[34mCLI[39m Cleaning output folder
|
|
11
11
|
[34mESM[39m Build start
|
|
12
|
-
[32mESM[39m [1mdist/index.js [22m[32m37.
|
|
13
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m [1mdist/index.js [22m[32m37.48 KB[39m
|
|
13
|
+
[32mESM[39m ⚡️ 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-
|
|
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
|
-
|
|
698
|
-
|
|
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
package/src/utils/esbuild.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
//
|
|
400
|
-
|
|
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,
|
|
415
|
+
res.writeHead(proxyRes.statusCode || 200, responseHeaders);
|
|
403
416
|
proxyRes.pipe(res);
|
|
404
417
|
},
|
|
405
418
|
);
|