fuzor 0.0.1 → 0.2.1

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.
Files changed (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +112 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +97 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/compiler/index.d.ts +28 -0
  8. package/dist/compiler/index.d.ts.map +1 -0
  9. package/dist/compiler/index.js +184 -0
  10. package/dist/compiler/index.js.map +1 -0
  11. package/dist/compiler/islands.d.ts +17 -0
  12. package/dist/compiler/islands.d.ts.map +1 -0
  13. package/dist/compiler/islands.js +78 -0
  14. package/dist/compiler/islands.js.map +1 -0
  15. package/dist/create.d.ts +21 -0
  16. package/dist/create.d.ts.map +1 -0
  17. package/dist/create.js +111 -0
  18. package/dist/create.js.map +1 -0
  19. package/dist/index.d.ts +8 -8
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +6 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/islands/react.d.ts +8 -0
  24. package/dist/islands/react.d.ts.map +1 -0
  25. package/dist/islands/react.js +19 -0
  26. package/dist/islands/react.js.map +1 -0
  27. package/dist/islands/solid.d.ts +8 -0
  28. package/dist/islands/solid.d.ts.map +1 -0
  29. package/dist/islands/solid.js +15 -0
  30. package/dist/islands/solid.js.map +1 -0
  31. package/dist/islands/vue.d.ts +5 -0
  32. package/dist/islands/vue.d.ts.map +1 -0
  33. package/dist/islands/vue.js +13 -0
  34. package/dist/islands/vue.js.map +1 -0
  35. package/dist/runtime/atom.d.ts +10 -0
  36. package/dist/runtime/atom.d.ts.map +1 -0
  37. package/dist/runtime/atom.js +38 -0
  38. package/dist/runtime/atom.js.map +1 -0
  39. package/dist/runtime/index.d.ts +31 -0
  40. package/dist/runtime/index.d.ts.map +1 -0
  41. package/dist/runtime/index.js +121 -0
  42. package/dist/runtime/index.js.map +1 -0
  43. package/dist/runtime/islands.d.ts +6 -0
  44. package/dist/runtime/islands.d.ts.map +1 -0
  45. package/dist/runtime/islands.js +43 -0
  46. package/dist/runtime/islands.js.map +1 -0
  47. package/dist/ssr/node.d.ts +7 -0
  48. package/dist/ssr/node.d.ts.map +1 -0
  49. package/dist/ssr/node.js +46 -0
  50. package/dist/ssr/node.js.map +1 -0
  51. package/dist/ssr.d.ts +10 -0
  52. package/dist/ssr.d.ts.map +1 -0
  53. package/dist/ssr.js +19 -0
  54. package/dist/ssr.js.map +1 -0
  55. package/dist/vite.d.ts +8 -0
  56. package/dist/vite.d.ts.map +1 -0
  57. package/dist/vite.js +310 -0
  58. package/dist/vite.js.map +1 -0
  59. package/package.json +71 -56
  60. package/templates/basic/README.md +16 -0
  61. package/templates/basic/_gitignore +3 -0
  62. package/templates/basic/components/app-badge.html +1 -0
  63. package/templates/basic/index.html +12 -0
  64. package/templates/basic/islands/counter.ts +13 -0
  65. package/templates/basic/package.json +20 -0
  66. package/templates/basic/pages/about/index.html +5 -0
  67. package/templates/basic/pages/docs/index.md +9 -0
  68. package/templates/basic/pages/index.html +9 -0
  69. package/templates/basic/pages/layout.html +8 -0
  70. package/templates/basic/pnpm-workspace.yaml +5 -0
  71. package/templates/basic/server.mjs +10 -0
  72. package/templates/basic/style.css +1 -0
  73. package/templates/basic/tsconfig.json +13 -0
  74. package/templates/basic/vite.config.ts +4 -0
  75. package/bin/index.js +0 -13
  76. package/dist/core/init.d.ts +0 -7
  77. package/dist/core/router.d.ts +0 -4
  78. package/dist/core/vite-config.d.ts +0 -5
  79. package/dist/init.cjs +0 -237
  80. package/dist/init.js +0 -468
  81. package/dist/lib.cjs +0 -222
  82. package/dist/lib.js +0 -19247
  83. package/dist/render/lit.d.ts +0 -1
  84. package/dist/render/preact.d.ts +0 -1
  85. package/dist/render/react.d.ts +0 -7
  86. package/dist/render/solid.d.ts +0 -1
  87. package/dist/render/svelte.d.ts +0 -6
  88. package/dist/render/vue.d.ts +0 -1
  89. package/dist/utils/create-file-if-not-exists.d.ts +0 -1
  90. package/dist/utils/create-folder-if-not-exist.d.ts +0 -2
  91. package/dist/utils/default-theme-files.d.ts +0 -7
  92. package/dist/utils/file-path-helpers.d.ts +0 -3
  93. package/dist/utils/is-valid-wordpress-slug.d.ts +0 -17
  94. package/dist/utils/read-write-file.d.ts +0 -1
  95. package/dist/utils/remove-file-exists.d.ts +0 -2
  96. package/dist/utils/remove-trailing-slash-url.d.ts +0 -1
  97. package/dist/utils/router-helpers.d.ts +0 -19
  98. package/dist/utils/zip-wp-theme.d.ts +0 -2
  99. package/types/index.d.ts +0 -6
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- import { JSXElementConstructor, ReactElement, ReactNode, ReactPortal } from 'react';
2
- export declare function renderReactComponent(comp: string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | null | undefined): string;
3
- type Props = {
4
- use: "MyComponent.tsx" | "OtherComponent.tsx";
5
- };
6
- export declare function UseComponent({ use }: Props): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +0,0 @@
1
- import { render } from 'svelte/server';
2
- export declare const app: {
3
- $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<Record<string, any>>): void;
5
- } & Record<string, any>;
6
- export { render };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function createFileIfNotExists(filePath: string, content?: string): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { PathLike } from 'fs';
2
- export declare function createFolderIfNotExist(dir: PathLike): Promise<void>;
@@ -1,7 +0,0 @@
1
- export declare const readmeTXT: () => string;
2
- export declare const styleCSS: () => string;
3
- export declare const themeJSON = "{\n\t\"settings\": {\n\t\t\"appearanceTools\": true,\n\t\t\"layout\": {\n\t\t\t\"contentSize\": \"620px\",\n\t\t\t\"wideSize\": \"1000px\"\n\t\t},\n\t\t\"spacing\": {\n\t\t\t\"units\": [\n\t\t\t\t\"%\",\n\t\t\t\t\"px\",\n\t\t\t\t\"em\",\n\t\t\t\t\"rem\",\n\t\t\t\t\"vh\",\n\t\t\t\t\"vw\"\n\t\t\t]\n\t\t},\n\t\t\"typography\": {\n\t\t\t\"fontFamilies\": [\n\t\t\t\t{\n\t\t\t\t\t\"fontFamily\": \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif\",\n\t\t\t\t\t\"name\": \"System Font\",\n\t\t\t\t\t\"slug\": \"system-font\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t\"useRootPaddingAwareAlignments\": true\n\t},\n\t\"templateParts\": [\n\t\t{\n\t\t\t\"area\": \"header\",\n\t\t\t\"name\": \"header\"\n\t\t},\n\t\t{\n\t\t\t\"area\": \"footer\",\n\t\t\t\"name\": \"footer\"\n\t\t}\n\t],\n\t\"version\": 3,\n\t\"$schema\": \"https://schemas.wp.org/wp/6.7/theme.json\"\n}";
4
- export declare const footerHTML = "<!-- wp:group {\"layout\":{\"inherit\":true}} -->\n<div class=\"wp-block-group\">\n\t<!-- wp:group {\"style\":{\"spacing\":{\"padding\":{\"top\":\"80px\",\"bottom\":\"30px\"}}}} -->\n\t<div class=\"wp-block-group\" style=\"padding-top:80px;padding-bottom:30px\">\n\t\t<!-- wp:paragraph {\"align\":\"center\"} -->\n\t\t<p class=\"has-text-align-center\">Proudly Powered by <a href=\"https://wordpress.org\" rel=\"nofollow\">WordPress</a></p>\n\t\t<!-- /wp:paragraph -->\n\t</div>\n\t<!-- /wp:group -->\n</div>\n<!-- /wp:group -->";
5
- export declare const headerHTML = "<!-- wp:group {\"layout\":{\"inherit\":\"true\"}} -->\n<div class=\"wp-block-group\">\n\t<!-- wp:group {\"align\":\"full\",\"layout\":{\"type\":\"flex\",\"justifyContent\":\"space-between\"},\"style\":{\"spacing\":{\"padding\":{\"bottom\":\"30px\",\"top\":\"30px\"}}}} -->\n\t<div class=\"wp-block-group alignfull\" style=\"padding-bottom:30px;padding-top:30px\">\n\t\n\t\t<!-- wp:group {\"layout\":{\"type\":\"flex\"}} -->\n\t\t<div class=\"wp-block-group\">\n\t\t\t<!-- wp:site-logo {\"width\":64} /-->\n\t\n\t\t\t<!-- wp:group -->\n\t\t\t<div class=\"wp-block-group\">\n\t\t\t\t<!-- wp:site-title /-->\n\t\t\t\t<!-- wp:site-tagline /-->\n\t\t\t</div>\n\t\t\t<!-- /wp:group -->\n\t\t</div>\n\t\t<!-- /wp:group -->\n\t\n\t\t<!-- wp:navigation {\"layout\":{\"type\":\"flex\",\"setCascadingProperties\":true,\"justifyContent\":\"right\",\"orientation\":\"horizontal\"},\"style\":{\"spacing\":{\"margin\":{\"top\":\"0\"}}}} /-->\n\t\n\t</div>\n\t<!-- /wp:group -->\n\n</div>\n<!-- /wp:group -->\n\n<!-- wp:spacer {\"height\":50} -->\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n<!-- /wp:spacer -->";
6
- export declare const indexHTML = "<!-- wp:template-part {\"slug\":\"header\",\"tagName\":\"header\"} /-->\n\n<!-- wp:group {\"tagName\":\"main\",\"layout\":{\"type\":\"constrained\"}} -->\n<main class=\"wp-block-group\">\n\t<!-- wp:query {\"layout\":{\"inherit\":true}} -->\n\t<div class=\"wp-block-query\">\n\t\t<!-- wp:post-template -->\n\t\t<!-- wp:group -->\n\t\t<div class=\"wp-block-group\">\n\t\t\t<!-- wp:post-title {\"isLink\":true} /-->\n\t\t\t<!-- wp:post-featured-image {\"isLink\":true} /-->\n\t\t\t<!-- wp:post-content /-->\n\t\t\t<!-- wp:group {\"layout\":{\"type\":\"flex\"},\"style\":{\"typography\":{\"fontSize\":\"14px\"}}} -->\n\t\t\t<div class=\"wp-block-group\" style=\"font-size:14px\">\n\t\t\t\t<!-- wp:post-author {\"showAvatar\":false,\"showBio\":false} /-->\n\t\t\t\t<!-- wp:post-date {\"isLink\":true} /-->\n\t\t\t\t<!-- wp:post-terms {\"term\":\"category\"} /-->\n\t\t\t\t<!-- wp:post-terms {\"term\":\"post_tag\"} /-->\n\t\t\t</div>\n\t\t\t<!-- /wp:group -->\n\t\t\t<!-- wp:spacer {\"height\":40} -->\n\t\t\t<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"></div>\n\t\t\t<!-- /wp:spacer -->\n\t\t</div>\n\t\t<!-- /wp:group -->\n\t\t<!-- /wp:post-template -->\n\t\t<!-- wp:group {\"layout\":{\"inherit\":true}} -->\n\t\t\t<div class=\"wp-block-group\">\n\t\t\t<!-- wp:query-pagination -->\n\t\t\t\t<!-- wp:query-pagination-previous /-->\n\n\t\t\t\t<!-- wp:query-pagination-numbers /-->\n\n\t\t\t\t<!-- wp:query-pagination-next /-->\n\t\t\t<!-- /wp:query-pagination -->\n\t\t\t</div>\n\t\t\t<!-- /wp:group -->\n\t\t</div>\n\t<!-- /wp:query -->\n</main>\n<!-- /wp:group -->\n\n<!-- wp:template-part {\"slug\":\"footer\",\"tagName\":\"footer\"} /-->";
7
- export declare const functionsPHP = "<?php\n// Flag to prevent recursive execution\n$prevent_recursive_execution = false;\n\nfunction create_or_update_or_delete_pages_from_json() {\n global $prevent_recursive_execution;\n\n // Prevent recursive execution\n if ($prevent_recursive_execution) {\n return;\n }\n\n // Path to the JSON file\n $json_file = get_template_directory() . '/pages.json';\n\n // Check if the file exists\n if (file_exists($json_file)) {\n // Read the JSON file\n $json_data = file_get_contents($json_file);\n $pages = json_decode($json_data, true)['pages'];\n\n // Initialize an array to store pages that are not deleted\n $updated_pages = [];\n\n // Get all pages from the database\n $all_pages = get_pages(array(\n 'post_status' => 'any'\n ));\n\n // Check if $all_pages is an array\n if (is_array($all_pages)) {\n // Create an array of slugs for all pages in the database\n $db_page_slugs = array_map(function($page) {\n return $page->post_name;\n }, $all_pages);\n } else {\n $db_page_slugs = [];\n }\n\n // Loop through the pages array\n foreach ($pages as $page) {\n $page_slug = $page['path'];\n $page_type = $page['type'];\n\n // Use WP_Query to find the page by slug\n $query = new WP_Query(array(\n 'post_type' => 'page',\n 'name' => $page_slug,\n 'post_status' => 'any',\n 'posts_per_page' => 1,\n 'no_found_rows' => true,\n 'ignore_sticky_posts' => true,\n 'update_post_term_cache' => false,\n 'update_post_meta_cache' => false,\n ));\n\n $page_check = !empty($query->posts) ? $query->posts[0] : null;\n\n if ($page_type === 'create') {\n // If the page exists, update it\n if ($page_check) {\n $page_id = $page_check->ID;\n $my_post = array(\n 'ID' => $page_id,\n 'post_title' => ucfirst(str_replace('-', ' ', $page_slug)),\n 'post_name' => $page_slug,\n 'post_status' => 'publish',\n 'post_author' => 1,\n 'post_type' => 'page',\n 'page_template' => $page_slug\n );\n\n // Update the post in the database\n wp_update_post($my_post);\n } else {\n // If the page doesn't exist, create it\n $my_post = array(\n 'post_title' => ucfirst(str_replace('-', ' ', $page_slug)),\n 'post_name' => $page_slug,\n 'post_status' => 'publish',\n 'post_author' => 1,\n 'post_type' => 'page',\n 'page_template' => $page_slug\n );\n\n // Insert the post into the database\n wp_insert_post($my_post);\n }\n\n // Add the page to the updated pages array\n $updated_pages[] = $page;\n } elseif ($page_type === 'delete' && $page_check) {\n // If the page exists and the type is 'delete', delete it\n wp_delete_post($page_check->ID, true);\n\n // Remove the \"create\" entry of the deleted page\n $updated_pages = array_filter($updated_pages, function($p) use ($page_slug) {\n return $p['path'] !== $page_slug;\n });\n }\n }\n\n // Update the JSON file with the remaining pages\n $new_json_data = json_encode(['pages' => $updated_pages], JSON_PRETTY_PRINT);\n file_put_contents($json_file, $new_json_data);\n }\n}\n\n// Hook the function to the 'init' action\nadd_action('init', 'create_or_update_or_delete_pages_from_json');\n\n// Function to remove page from JSON before deletion\nfunction remove_page_from_json_before_delete($post_id) {\n global $prevent_recursive_execution;\n\n // Check if the post type is 'page'\n if (get_post_type($post_id) !== 'page') {\n return;\n }\n\n // Path to the JSON file\n $json_file = get_template_directory() . '/pages.json';\n\n // Check if the file exists\n if (file_exists($json_file)) {\n // Read the JSON file\n $json_data = file_get_contents($json_file);\n $pages = json_decode($json_data, true)['pages'];\n\n // Get the slug of the page being deleted\n $page_slug = get_post_field('post_name', $post_id);\n\n // Remove the page entry from the JSON data\n $updated_pages = array_filter($pages, function($page) use ($page_slug) {\n return $page['path'] !== $page_slug;\n });\n\n // Update the JSON file with the remaining pages\n $new_json_data = json_encode(['pages' => array_values($updated_pages)], JSON_PRETTY_PRINT);\n file_put_contents($json_file, $new_json_data);\n\n // Set the flag to prevent recursive execution\n $prevent_recursive_execution = true;\n }\n}\n\n// Hook the function to the 'wp_trash_post' and 'wp_delete_post' actions\nadd_action('wp_trash_post', 'remove_page_from_json_before_delete', 10, 1);\nadd_action('wp_delete_post', 'remove_page_from_json_before_delete', 10, 1);";
@@ -1,3 +0,0 @@
1
- export declare function logFilename(filePath: string): string;
2
- export declare function modifiedPath(filePath: string): string;
3
- export declare function filenameWithoutExtension(filePath: string): string;
@@ -1,17 +0,0 @@
1
- /**
2
- * Checks if the given version string is a valid WordPress version.
3
- *
4
- * The Regex is based on the releases on https://wordpress.org/download/releases/#betas
5
- * The version string can be one of the following formats:
6
- * - "latest"
7
- * - "trunk"
8
- * - "nightly"
9
- * - "x.y" (x and y are integers) e.g. "6.2"
10
- * - "x.y.z" (x, y and z are integers) e.g. "6.2.1"
11
- * - "x.y.z-betaN" (N is an integer) e.g. "6.2.1-beta1"
12
- * - "x.y.z-RCN" (N is an integer) e.g. "6.2-RC1"
13
- *
14
- * @param version The version string to check.
15
- * @returns A boolean value indicating whether the version string is a valid WordPress version.
16
- */
17
- export declare function isValidWordPressSlug(version: string): boolean;
@@ -1 +0,0 @@
1
- export declare function readAndWriteFile(input: string, output: string): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { PathLike } from 'fs';
2
- export declare function removeFileIfExists(filePath: PathLike): Promise<void>;
@@ -1 +0,0 @@
1
- export declare function removeTrailingSlashURL(url: string): string;
@@ -1,19 +0,0 @@
1
- export declare const allowedExtensions: string[];
2
- /**
3
- *
4
- * @param directory
5
- * @param jsonPath
6
- */
7
- export declare function cleanUnusedFiles(directory: string, jsonPath: string): Promise<void>;
8
- /**
9
- *
10
- * @param folderPath
11
- * @param outputPath
12
- */
13
- export declare function createPagesJson(folderPath: string, outputPath: string): Promise<void>;
14
- /**
15
- *
16
- * @param filePath
17
- * @param jsonPath
18
- */
19
- export declare function deletePageFromJson(filePath: string, jsonPath: string): Promise<void>;
@@ -1,2 +0,0 @@
1
- import { default as AdmZip } from 'adm-zip';
2
- export declare const zipWPTheme: (wpZipFilesPath: string | Buffer | undefined) => AdmZip;
package/types/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- // svelte-shim.d.ts
2
- declare module "*.svelte" {
3
- import { SvelteComponent } from "svelte";
4
- const component: typeof SvelteComponent;
5
- export default component;
6
- }