@kithinji/pod 1.0.30 → 1.0.31
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/main.js +19 -18
- package/dist/main.js.map +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2955,10 +2955,10 @@ async function swcTransform(source, pathStr, tsx = false, react) {
|
|
|
2955
2955
|
}
|
|
2956
2956
|
function parseFileMetadata(source, path16) {
|
|
2957
2957
|
const isTsx = path16.endsWith(".tsx");
|
|
2958
|
-
const
|
|
2958
|
+
const isClientFile = source.startsWith('"use client"') || source.startsWith("'use client'");
|
|
2959
2959
|
const isPublicFile = source.startsWith('"use public"') || source.startsWith("'use public'");
|
|
2960
2960
|
let directive = null;
|
|
2961
|
-
if (
|
|
2961
|
+
if (isClientFile) directive = "client";
|
|
2962
2962
|
else if (isPublicFile) directive = "public";
|
|
2963
2963
|
return {
|
|
2964
2964
|
source,
|
|
@@ -2966,7 +2966,7 @@ function parseFileMetadata(source, path16) {
|
|
|
2966
2966
|
isTsx,
|
|
2967
2967
|
directive,
|
|
2968
2968
|
isPublicFile,
|
|
2969
|
-
|
|
2969
|
+
isClientFile
|
|
2970
2970
|
};
|
|
2971
2971
|
}
|
|
2972
2972
|
var ServerBuildTransformer = class {
|
|
@@ -2992,18 +2992,18 @@ ${controllerCode}
|
|
|
2992
2992
|
importSource: "@kithinji/orca"
|
|
2993
2993
|
});
|
|
2994
2994
|
}
|
|
2995
|
-
async
|
|
2995
|
+
async transformClientTsxStub(source, path16) {
|
|
2996
2996
|
const stubSource = generateServerStub(path16, source);
|
|
2997
2997
|
return swcTransform(stubSource, path16);
|
|
2998
2998
|
}
|
|
2999
2999
|
async process(metadata, onClientFound) {
|
|
3000
3000
|
const expandedSource = await expandMacros(metadata.source, metadata.path);
|
|
3001
3001
|
const expandedMetadata = { ...metadata, source: expandedSource };
|
|
3002
|
-
const { source, path: path16, isTsx,
|
|
3002
|
+
const { source, path: path16, isTsx, isClientFile, isPublicFile } = expandedMetadata;
|
|
3003
3003
|
if (isTsx) {
|
|
3004
|
-
if (
|
|
3004
|
+
if (isClientFile) {
|
|
3005
3005
|
onClientFound(path16);
|
|
3006
|
-
const clientCode = await this.
|
|
3006
|
+
const clientCode = await this.transformClientTsxStub(source, path16);
|
|
3007
3007
|
const store = Store.getInstance();
|
|
3008
3008
|
store.set(path16, clientCode.contents);
|
|
3009
3009
|
return clientCode;
|
|
@@ -3014,7 +3014,7 @@ ${controllerCode}
|
|
|
3014
3014
|
}
|
|
3015
3015
|
};
|
|
3016
3016
|
var ClientBuildTransformer = class {
|
|
3017
|
-
async
|
|
3017
|
+
async transformClientTsx(source, path16) {
|
|
3018
3018
|
const swcResult = await swcTransform(source, path16, true, {
|
|
3019
3019
|
runtime: "preserve"
|
|
3020
3020
|
});
|
|
@@ -3053,8 +3053,8 @@ var ClientBuildTransformer = class {
|
|
|
3053
3053
|
const expandedMetadata = { ...metadata, source: expandedSource };
|
|
3054
3054
|
const { source, path: path16, isTsx, directive } = expandedMetadata;
|
|
3055
3055
|
if (isTsx) {
|
|
3056
|
-
if (directive === "
|
|
3057
|
-
return this.
|
|
3056
|
+
if (directive === "client") {
|
|
3057
|
+
return this.transformClientTsx(source, path16);
|
|
3058
3058
|
} else if (directive === null) {
|
|
3059
3059
|
return this.transformServerComponent(node, source, path16);
|
|
3060
3060
|
} else {
|
|
@@ -3143,7 +3143,7 @@ function extractDirective(ast) {
|
|
|
3143
3143
|
if (item.type === "ExpressionStatement" && item.expression.type === "StringLiteral") {
|
|
3144
3144
|
const val = item.expression.value;
|
|
3145
3145
|
if (val === "use public") return "public";
|
|
3146
|
-
if (val === "use
|
|
3146
|
+
if (val === "use client") return "client";
|
|
3147
3147
|
} else {
|
|
3148
3148
|
break;
|
|
3149
3149
|
}
|
|
@@ -3768,7 +3768,7 @@ var ButtonComponent = class extends ComponentDefinition {
|
|
|
3768
3768
|
this.dependencies = [];
|
|
3769
3769
|
}
|
|
3770
3770
|
generate() {
|
|
3771
|
-
return `"use
|
|
3771
|
+
return `"use client";
|
|
3772
3772
|
|
|
3773
3773
|
import { Component, JSX } from "@kithinji/orca";
|
|
3774
3774
|
|
|
@@ -3796,7 +3796,7 @@ var InputComponent = class extends ComponentDefinition {
|
|
|
3796
3796
|
this.dependencies = [];
|
|
3797
3797
|
}
|
|
3798
3798
|
generate() {
|
|
3799
|
-
return `"use
|
|
3799
|
+
return `"use client";
|
|
3800
3800
|
|
|
3801
3801
|
import { Component } from "@kithinji/orca";
|
|
3802
3802
|
|
|
@@ -3818,7 +3818,7 @@ var FormComponent = class extends ComponentDefinition {
|
|
|
3818
3818
|
this.dependencies = ["button", "input"];
|
|
3819
3819
|
}
|
|
3820
3820
|
generate() {
|
|
3821
|
-
return `"use
|
|
3821
|
+
return `"use client";
|
|
3822
3822
|
|
|
3823
3823
|
import { Component } from "@kithinji/orca";
|
|
3824
3824
|
import { Button } from "./button.component";
|
|
@@ -3849,7 +3849,7 @@ var CardComponent = class extends ComponentDefinition {
|
|
|
3849
3849
|
this.dependencies = ["button"];
|
|
3850
3850
|
}
|
|
3851
3851
|
generate() {
|
|
3852
|
-
return `"use
|
|
3852
|
+
return `"use client";
|
|
3853
3853
|
|
|
3854
3854
|
import { Component } from "@kithinji/orca";
|
|
3855
3855
|
import { Button } from "./button.component";
|
|
@@ -4607,7 +4607,7 @@ function createListComponent(name) {
|
|
|
4607
4607
|
const componentName = toPascalCase(name + "_List");
|
|
4608
4608
|
const serviceName = toPascalCase(name + "_Service");
|
|
4609
4609
|
const serviceVar = toCamelCase(name + "_Service");
|
|
4610
|
-
return `"use
|
|
4610
|
+
return `"use client";
|
|
4611
4611
|
|
|
4612
4612
|
import { Component } from "@kithinji/orca";
|
|
4613
4613
|
import { ${serviceName} } from "../${name}.service";
|
|
@@ -4740,6 +4740,7 @@ build
|
|
|
4740
4740
|
*.log
|
|
4741
4741
|
.env
|
|
4742
4742
|
.DS_Store
|
|
4743
|
+
public
|
|
4743
4744
|
`;
|
|
4744
4745
|
}
|
|
4745
4746
|
function genEnv() {
|
|
@@ -4763,7 +4764,7 @@ function genIndexHtml(name) {
|
|
|
4763
4764
|
`;
|
|
4764
4765
|
}
|
|
4765
4766
|
function genClientTsx() {
|
|
4766
|
-
return `"use
|
|
4767
|
+
return `"use client";
|
|
4767
4768
|
|
|
4768
4769
|
import {
|
|
4769
4770
|
Module,
|
|
@@ -6433,7 +6434,7 @@ Deployment Failed: ${err.message}`));
|
|
|
6433
6434
|
// src/main.ts
|
|
6434
6435
|
import chalk2 from "chalk";
|
|
6435
6436
|
var program = new Command();
|
|
6436
|
-
program.name("pod").description("Pod cli tool").version("1.0.
|
|
6437
|
+
program.name("pod").description("Pod cli tool").version("1.0.31");
|
|
6437
6438
|
program.command("new <name> [type]").description("Start a new Orca Project").action(async (name, type) => {
|
|
6438
6439
|
const orca = async () => {
|
|
6439
6440
|
await addNew(name);
|