vaderjs 1.4.2 → 1.4.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/{README.md → README.MD} +9 -19
- package/config/index.ts +12 -66
- package/document/index.ts +49 -0
- package/index.ts +283 -322
- package/main.js +314 -0
- package/package.json +8 -24
- package/.editorconfig +0 -11
- package/.vscode/c_cpp_properties.json +0 -21
- package/.vscode/settings.json +0 -12
- package/binaries/Kalix/index.js +0 -665
- package/binaries/compiler/main.js +0 -461
- package/binaries/vader.js +0 -74
- package/binaries/watcher/hmr.js +0 -36
- package/client/index.d.ts +0 -226
- package/client/runtime/index.js +0 -417
- package/client/runtime/router.js +0 -235
- package/plugins/cloudflare/functions/index.js +0 -98
- package/plugins/cloudflare/toCopy/@server/Kalix/index.js +0 -625
- package/plugins/cloudflare/toCopy/@server/cloudflare_ssr/index.js +0 -85
- package/plugins/cloudflare/toCopy/node_modules/vaderjs/server/index.js +0 -99
- package/plugins/cloudflare/toCopy/src/client.js +0 -432
- package/plugins/cloudflare/toCopy/src/router.js +0 -235
- package/plugins/ssg/index.js +0 -124
- package/plugins/vercel/functions/index.ts +0 -8
- package/router/index.ts +0 -181
- package/server/index.js +0 -129
- package/vader.js +0 -177
package/{README.md → README.MD}
RENAMED
|
@@ -26,8 +26,7 @@ Create a pages folder - which allows you to have nextjs page like routing via bu
|
|
|
26
26
|
|
|
27
27
|
Tip: Each folder can be deep nested up to 4 levels!
|
|
28
28
|
|
|
29
|
-
```md
|
|
30
|
-
|
|
29
|
+
```md
|
|
31
30
|
/pages/index.jsx = /
|
|
32
31
|
/pages/home/[page].jsx = /home/:page
|
|
33
32
|
/pages/path/index.jsx = /path/
|
|
@@ -38,29 +37,20 @@ Tip: Each folder can be deep nested up to 4 levels!
|
|
|
38
37
|
Keyword folders - all files are passed from these folders to the build folder
|
|
39
38
|
|
|
40
39
|
```md
|
|
41
|
-
1.
|
|
42
|
-
2.
|
|
43
|
-
3. public - used for anything
|
|
40
|
+
1. app - used for jsx route files
|
|
41
|
+
2. public - used for anything / css / json etc
|
|
44
42
|
```
|
|
45
43
|
|
|
46
44
|
|
|
47
45
|
# Define your config
|
|
48
46
|
|
|
49
47
|
```ts
|
|
50
|
-
import
|
|
51
|
-
|
|
48
|
+
import defineConfig from "../config";
|
|
49
|
+
|
|
52
50
|
export default defineConfig({
|
|
53
|
-
|
|
54
|
-
host:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
env: {
|
|
59
|
-
PORT: 3000,
|
|
60
|
-
SSR: true,
|
|
61
|
-
apiRoute: "https://api.example.com"
|
|
62
|
-
},
|
|
63
|
-
plugins: [cloudflare],
|
|
64
|
-
});
|
|
51
|
+
port: 3000,
|
|
52
|
+
host: 'localhost',
|
|
53
|
+
hot_reload: true,
|
|
54
|
+
})
|
|
65
55
|
|
|
66
56
|
```
|
package/config/index.ts
CHANGED
|
@@ -1,68 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @property {any[]} plugins - The plugins to be used in the application
|
|
12
|
-
* @property {string} mode - The mode of the application
|
|
13
|
-
* @param config - The configuration object
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Defines the configuration options for VaderJS.
|
|
18
|
-
* @param {Object} config - The configuration object.
|
|
19
|
-
* @param {string} config.target - The target platform for the code ('web' or 'bun').
|
|
20
|
-
* @param {Object} [config.host] - The host configuration.
|
|
21
|
-
* @param {string} [config.host.hostname] - The hostname for the host.
|
|
22
|
-
* @param {('vercel','netlify')} [config.host.provider] - The provider for the host ('vercel', 'netlify', 'aws', 'azure', 'gcp').
|
|
23
|
-
* @param {number} [config.host.port] - The port number for the host.
|
|
24
|
-
* @param {Object} [config.compilerOptions] - The compiler options.
|
|
25
|
-
* @param {string} [config.compilerOptions.outDir] - The output directory for the compiled code.
|
|
26
|
-
* @param {string} [config.mode] - The mode for the configuration.
|
|
27
|
-
* @param {Array} [config.plugins] - The plugins for the configuration.
|
|
28
|
-
* @param {Object} [config.env] - The environment variables for the configuration.
|
|
29
|
-
* @returns {Object} The configured object.
|
|
30
|
-
*/
|
|
31
|
-
export const defineConfig = (config: {
|
|
32
|
-
/**
|
|
33
|
-
* @type {string}
|
|
34
|
-
* @param {('web'|'bun')} target
|
|
35
|
-
*/
|
|
36
|
-
target:string,
|
|
37
|
-
host?: {
|
|
38
|
-
hostname?: string,
|
|
39
|
-
/**
|
|
40
|
-
* @param {('vercel', 'netlify', 'aws', 'azure', 'gcp')} provider
|
|
41
|
-
*/
|
|
42
|
-
provider?: string,
|
|
43
|
-
port?: number
|
|
44
|
-
},
|
|
45
|
-
compilerOptions?: {
|
|
46
|
-
outDir?: string,
|
|
47
|
-
},
|
|
48
|
-
mode?: string,
|
|
49
|
-
plugins?: any[]
|
|
50
|
-
env?: {
|
|
51
|
-
[key: string]: any
|
|
52
|
-
}
|
|
53
|
-
}) => {
|
|
54
|
-
// add config.env to globalThis.env
|
|
55
|
-
let env = {}
|
|
56
|
-
if(config.env){
|
|
57
|
-
for(let key in config.env){
|
|
58
|
-
env[key] = config.env[key]
|
|
59
|
-
}
|
|
60
|
-
for(let key in globalThis.env){
|
|
61
|
-
env[key] = globalThis.env[key]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
type Config = {
|
|
2
|
+
port: number,
|
|
3
|
+
host?: string,
|
|
4
|
+
plugins?: any[],
|
|
5
|
+
generateTypes?: boolean,
|
|
6
|
+
host_provider?: 'vercel' | 'netlify' | 'aws' | 'gcp' | 'azure' | 'heroku' | 'custom' | 'none',
|
|
7
|
+
host_provider_options?: {
|
|
8
|
+
[key: string]: any
|
|
9
|
+
},
|
|
10
|
+
}
|
|
64
11
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return config
|
|
12
|
+
export default function defineConfig(config: Config) {
|
|
13
|
+
return config
|
|
68
14
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export const document = (element: any) => {
|
|
2
|
+
let type = element.type;
|
|
3
|
+
let el = `<${type}`;
|
|
4
|
+
let attributes = element.props;
|
|
5
|
+
let children = element.children;
|
|
6
|
+
for (let key in attributes) {
|
|
7
|
+
if(key === "key"){
|
|
8
|
+
el += ` key="${attributes[key]}"`;
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
if (key === "className") {
|
|
12
|
+
el += ` class="${attributes[key]}"`;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
if (key === "style") {
|
|
16
|
+
let style = "";
|
|
17
|
+
for (let styleKey in attributes[key]) {
|
|
18
|
+
style += `${styleKey}:${attributes[key][styleKey]};`;
|
|
19
|
+
}
|
|
20
|
+
el += ` style="${style}"`;
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
//@ts-ignore
|
|
24
|
+
if (key.includes("on")) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
el += ` ${key}="${attributes[key]}"`;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
el += ">";
|
|
31
|
+
for (let i = 0;i < children.length; i++) {
|
|
32
|
+
let child = children[i];
|
|
33
|
+
if (Array.isArray(child)) {
|
|
34
|
+
child.forEach((c) => {
|
|
35
|
+
el += document(c);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if(typeof child === "function"){
|
|
39
|
+
el += document(child());
|
|
40
|
+
}else
|
|
41
|
+
if (typeof child === "object") {
|
|
42
|
+
el += document(child);
|
|
43
|
+
}else{
|
|
44
|
+
el += child;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
el += `</${type}>`;
|
|
48
|
+
return el;
|
|
49
|
+
}
|