xpine 0.0.31 → 0.0.32
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/index.js +8 -8
- package/dist/src/scripts/xpine-build.js +4 -4
- package/dist/src/scripts/xpine-dev.js +4 -4
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/types.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -573,8 +573,8 @@ async function createRouter() {
|
|
|
573
573
|
if (componentFn && !isDev) {
|
|
574
574
|
if (isJSX) {
|
|
575
575
|
const data = config2?.data ? await config2.data(req) : null;
|
|
576
|
-
const originalResult = await componentFn({ req, res, data,
|
|
577
|
-
const output = config2?.wrapper ? await config2.wrapper({ req, children: originalResult, config: config2, data,
|
|
576
|
+
const originalResult = await componentFn({ req, res, data, routePath: urlPath });
|
|
577
|
+
const output = config2?.wrapper ? await config2.wrapper({ req, children: originalResult, config: config2, data, routePath: urlPath }) : originalResult;
|
|
578
578
|
res.send(doctypeHTML + output);
|
|
579
579
|
} else {
|
|
580
580
|
await componentFn(req, res);
|
|
@@ -594,8 +594,8 @@ async function createRouter() {
|
|
|
594
594
|
};
|
|
595
595
|
}
|
|
596
596
|
const data = config3?.data ? await config3.data(req) : null;
|
|
597
|
-
const originalResult = await componentFnDev({ req, res, data, config: config3,
|
|
598
|
-
const output = config3?.wrapper ? await config3.wrapper({ req, children: originalResult, config: config3, data,
|
|
597
|
+
const originalResult = await componentFnDev({ req, res, data, config: config3, routePath: urlPath });
|
|
598
|
+
const output = config3?.wrapper ? await config3.wrapper({ req, children: originalResult, config: config3, data, routePath: urlPath }) : originalResult;
|
|
599
599
|
context.clear();
|
|
600
600
|
res.send(doctypeHTML + output);
|
|
601
601
|
} else {
|
|
@@ -890,10 +890,10 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
890
890
|
try {
|
|
891
891
|
const req = { params: {} };
|
|
892
892
|
const data = config2?.data ? await config2.data(req) : null;
|
|
893
|
-
const staticComponentOutput = await componentFn({ data,
|
|
893
|
+
const staticComponentOutput = await componentFn({ data, routePath: urlPath });
|
|
894
894
|
fs6.writeFileSync(
|
|
895
895
|
path6.join(outputPath, "./index.html"),
|
|
896
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
896
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
897
897
|
);
|
|
898
898
|
} catch (err) {
|
|
899
899
|
console.error(err);
|
|
@@ -911,11 +911,11 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
911
911
|
const updatedOutDir = path6.join(outputPath, `./${componentDynamicPaths.map((key) => dynamicPath[key]).join("/")}`);
|
|
912
912
|
const urlPath = filePathToURLPath(updatedOutDir);
|
|
913
913
|
const data = config2?.data ? await config2.data(req) : null;
|
|
914
|
-
const staticComponentOutput = await componentFn({ req, data,
|
|
914
|
+
const staticComponentOutput = await componentFn({ req, data, routePath: urlPath });
|
|
915
915
|
fs6.ensureDirSync(updatedOutDir);
|
|
916
916
|
fs6.writeFileSync(
|
|
917
917
|
path6.join(updatedOutDir, "./index.html"),
|
|
918
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
918
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
919
919
|
);
|
|
920
920
|
} catch (err) {
|
|
921
921
|
console.log("Could not build static component", component.path);
|
|
@@ -699,10 +699,10 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
699
699
|
try {
|
|
700
700
|
const req = { params: {} };
|
|
701
701
|
const data = config2?.data ? await config2.data(req) : null;
|
|
702
|
-
const staticComponentOutput = await componentFn({ data,
|
|
702
|
+
const staticComponentOutput = await componentFn({ data, routePath: urlPath });
|
|
703
703
|
fs6.writeFileSync(
|
|
704
704
|
path5.join(outputPath, "./index.html"),
|
|
705
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
705
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
706
706
|
);
|
|
707
707
|
} catch (err) {
|
|
708
708
|
console.error(err);
|
|
@@ -720,11 +720,11 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
720
720
|
const updatedOutDir = path5.join(outputPath, `./${componentDynamicPaths.map((key) => dynamicPath[key]).join("/")}`);
|
|
721
721
|
const urlPath = filePathToURLPath(updatedOutDir);
|
|
722
722
|
const data = config2?.data ? await config2.data(req) : null;
|
|
723
|
-
const staticComponentOutput = await componentFn({ req, data,
|
|
723
|
+
const staticComponentOutput = await componentFn({ req, data, routePath: urlPath });
|
|
724
724
|
fs6.ensureDirSync(updatedOutDir);
|
|
725
725
|
fs6.writeFileSync(
|
|
726
726
|
path5.join(updatedOutDir, "./index.html"),
|
|
727
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
727
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
728
728
|
);
|
|
729
729
|
} catch (err) {
|
|
730
730
|
console.log("Could not build static component", component.path);
|
|
@@ -706,10 +706,10 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
706
706
|
try {
|
|
707
707
|
const req = { params: {} };
|
|
708
708
|
const data = config2?.data ? await config2.data(req) : null;
|
|
709
|
-
const staticComponentOutput = await componentFn({ data,
|
|
709
|
+
const staticComponentOutput = await componentFn({ data, routePath: urlPath });
|
|
710
710
|
fs6.writeFileSync(
|
|
711
711
|
path5.join(outputPath, "./index.html"),
|
|
712
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
712
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
713
713
|
);
|
|
714
714
|
} catch (err) {
|
|
715
715
|
console.error(err);
|
|
@@ -727,11 +727,11 @@ async function buildStaticFiles(config2, component, componentImport, builtCompon
|
|
|
727
727
|
const updatedOutDir = path5.join(outputPath, `./${componentDynamicPaths.map((key) => dynamicPath[key]).join("/")}`);
|
|
728
728
|
const urlPath = filePathToURLPath(updatedOutDir);
|
|
729
729
|
const data = config2?.data ? await config2.data(req) : null;
|
|
730
|
-
const staticComponentOutput = await componentFn({ req, data,
|
|
730
|
+
const staticComponentOutput = await componentFn({ req, data, routePath: urlPath });
|
|
731
731
|
fs6.ensureDirSync(updatedOutDir);
|
|
732
732
|
fs6.writeFileSync(
|
|
733
733
|
path5.join(updatedOutDir, "./index.html"),
|
|
734
|
-
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data,
|
|
734
|
+
doctypeHTML + (config2?.wrapper ? await config2.wrapper({ req, children: staticComponentOutput, config: config2, data, routePath: urlPath }) : staticComponentOutput) + staticComment
|
|
735
735
|
);
|
|
736
736
|
} catch (err) {
|
|
737
737
|
console.log("Could not build static component", component.path);
|
package/dist/types.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type WrapperProps = {
|
|
|
16
16
|
children: any;
|
|
17
17
|
config: ConfigFile;
|
|
18
18
|
data?: any;
|
|
19
|
-
|
|
19
|
+
routePath?: string;
|
|
20
20
|
};
|
|
21
21
|
export type ConfigFile = {
|
|
22
22
|
staticPaths?: boolean | (() => Promise<{
|
|
@@ -29,7 +29,7 @@ export type PageProps = {
|
|
|
29
29
|
req: ServerRequest;
|
|
30
30
|
res: Response;
|
|
31
31
|
data: any;
|
|
32
|
-
|
|
32
|
+
routePath: string;
|
|
33
33
|
};
|
|
34
34
|
export type FileItem = {
|
|
35
35
|
file: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,aAAa,CAAC;IACnB,QAAQ,EAAE,GAAG,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC,CAAC;IACrE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CAC7C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,aAAa,CAAC;IACnB,GAAG,EAAE,QAAQ,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC;CACvB,CAAA"}
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type WrapperProps = {
|
|
|
20
20
|
children: any;
|
|
21
21
|
config: ConfigFile;
|
|
22
22
|
data?: any;
|
|
23
|
-
|
|
23
|
+
routePath?: string;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export type ConfigFile = {
|
|
@@ -33,7 +33,7 @@ export type PageProps = {
|
|
|
33
33
|
req: ServerRequest;
|
|
34
34
|
res: Response;
|
|
35
35
|
data: any;
|
|
36
|
-
|
|
36
|
+
routePath: string;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export type FileItem = {
|