@marko/run 0.1.3 → 0.1.4
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/dist/vite/index.cjs +18 -14
- package/dist/vite/index.js +18 -14
- package/package.json +1 -1
package/dist/vite/index.cjs
CHANGED
|
@@ -680,17 +680,7 @@ function renderRouter(routes, options = {
|
|
|
680
680
|
`import page${key} from '${virtualFilePrefix}/${markoRunFilePrefix}special__${key}.marko${serverEntryQuery}';`
|
|
681
681
|
);
|
|
682
682
|
}
|
|
683
|
-
writer.writeLines(
|
|
684
|
-
`
|
|
685
|
-
const page404ResponseInit = {
|
|
686
|
-
status: 404,
|
|
687
|
-
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
688
|
-
};
|
|
689
|
-
const page500ResponseInit = {
|
|
690
|
-
status: 404,
|
|
691
|
-
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
692
|
-
};`
|
|
693
|
-
).writeBlockStart(`export function match(method, pathname) {`).writeLines(
|
|
683
|
+
writer.writeLines("").writeBlockStart(`export function match(method, pathname) {`).writeLines(
|
|
694
684
|
`if (!pathname) {
|
|
695
685
|
pathname = '/';
|
|
696
686
|
} else if (pathname.charAt(0) !== '/') {
|
|
@@ -722,8 +712,16 @@ export async function invoke(route, request, platform, url) {
|
|
|
722
712
|
throw error;
|
|
723
713
|
}
|
|
724
714
|
}
|
|
725
|
-
`)
|
|
715
|
+
`);
|
|
726
716
|
if (routes.special[RoutableFileTypes.NotFound]) {
|
|
717
|
+
writer.indent = 2;
|
|
718
|
+
imports.writeLines(
|
|
719
|
+
`
|
|
720
|
+
const page404ResponseInit = {
|
|
721
|
+
status: 404,
|
|
722
|
+
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
723
|
+
};`
|
|
724
|
+
);
|
|
727
725
|
writer.write(
|
|
728
726
|
` } else {
|
|
729
727
|
}
|
|
@@ -733,11 +731,17 @@ export async function invoke(route, request, platform, url) {
|
|
|
733
731
|
`
|
|
734
732
|
);
|
|
735
733
|
} else {
|
|
734
|
+
writer.indent = 3;
|
|
736
735
|
writer.writeBlockEnd("}");
|
|
737
736
|
}
|
|
738
737
|
writer.indent--;
|
|
739
738
|
writer.writeBlockStart(`} catch (error) {`);
|
|
740
739
|
if (routes.special[RoutableFileTypes.Error]) {
|
|
740
|
+
imports.writeLines(`
|
|
741
|
+
const page500ResponseInit = {
|
|
742
|
+
status: 404,
|
|
743
|
+
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
744
|
+
};`);
|
|
741
745
|
writer.writeBlockStart(
|
|
742
746
|
`if (context.request.headers.get('Accept')?.includes('text/html')) {`
|
|
743
747
|
).writeLines(
|
|
@@ -922,7 +926,7 @@ function renderParamsInfo(params, pathIndex) {
|
|
|
922
926
|
for (const { name, index } of params) {
|
|
923
927
|
if (index >= 0) {
|
|
924
928
|
result += `${sep} ${wrapPropertyName(name)}: s${index + 1}`;
|
|
925
|
-
sep
|
|
929
|
+
sep = ",";
|
|
926
930
|
} else if (pathIndex) {
|
|
927
931
|
catchAll = name;
|
|
928
932
|
}
|
|
@@ -1515,7 +1519,7 @@ function markoRun(opts = {}) {
|
|
|
1515
1519
|
compiler ?? (compiler = await import(opts.compiler || "@marko/compiler"));
|
|
1516
1520
|
compiler.taglib.register("@marko/run", {
|
|
1517
1521
|
"<*>": {
|
|
1518
|
-
|
|
1522
|
+
transform: import_path2.default.resolve(
|
|
1519
1523
|
__dirname,
|
|
1520
1524
|
"../components/src-attributes-transformer.cjs"
|
|
1521
1525
|
)
|
package/dist/vite/index.js
CHANGED
|
@@ -643,17 +643,7 @@ function renderRouter(routes, options = {
|
|
|
643
643
|
`import page${key} from '${virtualFilePrefix}/${markoRunFilePrefix}special__${key}.marko${serverEntryQuery}';`
|
|
644
644
|
);
|
|
645
645
|
}
|
|
646
|
-
writer.writeLines(
|
|
647
|
-
`
|
|
648
|
-
const page404ResponseInit = {
|
|
649
|
-
status: 404,
|
|
650
|
-
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
651
|
-
};
|
|
652
|
-
const page500ResponseInit = {
|
|
653
|
-
status: 404,
|
|
654
|
-
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
655
|
-
};`
|
|
656
|
-
).writeBlockStart(`export function match(method, pathname) {`).writeLines(
|
|
646
|
+
writer.writeLines("").writeBlockStart(`export function match(method, pathname) {`).writeLines(
|
|
657
647
|
`if (!pathname) {
|
|
658
648
|
pathname = '/';
|
|
659
649
|
} else if (pathname.charAt(0) !== '/') {
|
|
@@ -685,8 +675,16 @@ export async function invoke(route, request, platform, url) {
|
|
|
685
675
|
throw error;
|
|
686
676
|
}
|
|
687
677
|
}
|
|
688
|
-
`)
|
|
678
|
+
`);
|
|
689
679
|
if (routes.special[RoutableFileTypes.NotFound]) {
|
|
680
|
+
writer.indent = 2;
|
|
681
|
+
imports.writeLines(
|
|
682
|
+
`
|
|
683
|
+
const page404ResponseInit = {
|
|
684
|
+
status: 404,
|
|
685
|
+
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
686
|
+
};`
|
|
687
|
+
);
|
|
690
688
|
writer.write(
|
|
691
689
|
` } else {
|
|
692
690
|
}
|
|
@@ -696,11 +694,17 @@ export async function invoke(route, request, platform, url) {
|
|
|
696
694
|
`
|
|
697
695
|
);
|
|
698
696
|
} else {
|
|
697
|
+
writer.indent = 3;
|
|
699
698
|
writer.writeBlockEnd("}");
|
|
700
699
|
}
|
|
701
700
|
writer.indent--;
|
|
702
701
|
writer.writeBlockStart(`} catch (error) {`);
|
|
703
702
|
if (routes.special[RoutableFileTypes.Error]) {
|
|
703
|
+
imports.writeLines(`
|
|
704
|
+
const page500ResponseInit = {
|
|
705
|
+
status: 404,
|
|
706
|
+
headers: { "content-type": "text/html;charset=UTF-8" },
|
|
707
|
+
};`);
|
|
704
708
|
writer.writeBlockStart(
|
|
705
709
|
`if (context.request.headers.get('Accept')?.includes('text/html')) {`
|
|
706
710
|
).writeLines(
|
|
@@ -885,7 +889,7 @@ function renderParamsInfo(params, pathIndex) {
|
|
|
885
889
|
for (const { name, index } of params) {
|
|
886
890
|
if (index >= 0) {
|
|
887
891
|
result += `${sep} ${wrapPropertyName(name)}: s${index + 1}`;
|
|
888
|
-
sep
|
|
892
|
+
sep = ",";
|
|
889
893
|
} else if (pathIndex) {
|
|
890
894
|
catchAll = name;
|
|
891
895
|
}
|
|
@@ -1477,7 +1481,7 @@ function markoRun(opts = {}) {
|
|
|
1477
1481
|
compiler ?? (compiler = await import(opts.compiler || "@marko/compiler"));
|
|
1478
1482
|
compiler.taglib.register("@marko/run", {
|
|
1479
1483
|
"<*>": {
|
|
1480
|
-
|
|
1484
|
+
transform: path2.resolve(
|
|
1481
1485
|
__dirname,
|
|
1482
1486
|
"../components/src-attributes-transformer.cjs"
|
|
1483
1487
|
)
|