create-outsystems-astro 0.9.0 → 0.10.0

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 (52) hide show
  1. package/bin/cli.js +37 -1
  2. package/integrations/.prettierignore +15 -0
  3. package/integrations/.yarn/releases/yarn-4.15.0.cjs +940 -0
  4. package/integrations/.yarnrc.yml +6 -0
  5. package/integrations/bun.lock +1225 -0
  6. package/integrations/bunfig.toml +3 -0
  7. package/integrations/deno.json +4 -0
  8. package/integrations/deno.lock +3896 -0
  9. package/integrations/eslint.config.mjs +61 -0
  10. package/integrations/html/client.ts +30 -0
  11. package/integrations/html/index.ts +57 -0
  12. package/integrations/html/server.ts +54 -0
  13. package/integrations/package-lock.json +8898 -0
  14. package/integrations/package.json +39 -0
  15. package/integrations/pnpm-lock.yaml +5499 -0
  16. package/integrations/pnpm-workspace.yaml +4 -0
  17. package/integrations/tsconfig.json +15 -0
  18. package/integrations/yarn.lock +6305 -0
  19. package/package.json +3 -1
  20. package/template/.github/workflows/deno-test.yml +1 -1
  21. package/template/.github/workflows/npm-test.yml +1 -1
  22. package/template/.github/workflows/pnpm-test.yml +2 -2
  23. package/template/.github/workflows/yarn-test.yml +26 -13
  24. package/template/.gitignore +4 -0
  25. package/template/.prettierignore +1 -0
  26. package/template/.yarn/releases/yarn-4.15.0.cjs +940 -0
  27. package/template/.yarnrc.yml +8 -0
  28. package/template/AGENTS.md +46 -1
  29. package/template/README.md +15 -0
  30. package/template/astro.config.mjs +4 -0
  31. package/template/bun.lock +322 -360
  32. package/template/bunfig.toml +3 -0
  33. package/template/deno.json +3 -11
  34. package/template/deno.lock +700 -679
  35. package/template/eslint.config.mjs +1 -0
  36. package/template/package-lock.json +610 -589
  37. package/template/package.json +36 -41
  38. package/template/pnpm-lock.yaml +1084 -1114
  39. package/template/pnpm-workspace.yaml +5 -0
  40. package/template/src/framework/html/Demo.ts +105 -0
  41. package/template/src/framework/html/Store.ts +47 -0
  42. package/template/src/images/html.png +0 -0
  43. package/template/src/pages/html/html-demo.astro +61 -0
  44. package/template/src/pages/multi/store.astro +3 -1
  45. package/template/src/stores/framework.ts +1 -0
  46. package/template/test/e2e/html/html-demo.spec.ts +36 -0
  47. package/template/test/integration/html/Demo.test.ts +83 -0
  48. package/template/tsconfig.json +1 -1
  49. package/template/vitest.config.ts +9 -0
  50. package/template/yarn.lock +14730 -10350
  51. /package/template/patches/{@analogjs+astro-angular+2.5.1.patch → @analogjs+astro-angular+2.5.2.patch} +0 -0
  52. /package/template/patches/{@angular+build+21.2.11.patch → @angular+build+21.2.12.patch} +0 -0
@@ -0,0 +1,61 @@
1
+ import { fixupPluginRules } from "@eslint/compat";
2
+ import pluginJs from "@eslint/js";
3
+ import eslintConfigPrettier from "eslint-config-prettier";
4
+ import eslintPluginAstro from "eslint-plugin-astro";
5
+ import importPlugin from "eslint-plugin-import";
6
+ import perfectionist from "eslint-plugin-perfectionist";
7
+ import globals from "globals";
8
+ import tseslint from "typescript-eslint";
9
+
10
+ // Fix for Bun and eslint-plugin-perfectionist.
11
+ if (!Array.prototype.toSorted) {
12
+ Array.prototype.toSorted = function (compareFn) {
13
+ return [...this].sort(compareFn);
14
+ };
15
+ }
16
+
17
+ /** @type {import('eslint').Linter.Config[]} */
18
+ export default [
19
+ {
20
+ ignores: [".astro/*", "dist/*", "node_modules/*"],
21
+ },
22
+ { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
23
+ pluginJs.configs.recommended,
24
+ ...tseslint.configs.recommended.map((config) => ({
25
+ ...config,
26
+ files: ["**/*.{ts,tsx}"],
27
+ })),
28
+ ...eslintPluginAstro.configs.recommended,
29
+ {
30
+ files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"],
31
+ plugins: {
32
+ import: fixupPluginRules(importPlugin),
33
+ },
34
+ rules: {
35
+ "import/order": [
36
+ "error",
37
+ {
38
+ alphabetize: {
39
+ caseInsensitive: true,
40
+ order: "asc",
41
+ },
42
+ groups: ["builtin", "external", "internal", "parent", "sibling"],
43
+ pathGroups: [
44
+ {
45
+ group: "internal",
46
+ pattern: "~/**",
47
+ position: "after",
48
+ },
49
+ ],
50
+ },
51
+ ],
52
+ },
53
+ },
54
+ eslintConfigPrettier,
55
+ perfectionist.configs["recommended-alphabetical"],
56
+ {
57
+ rules: {
58
+ "perfectionist/sort-imports": ["off"],
59
+ },
60
+ },
61
+ ];
@@ -0,0 +1,30 @@
1
+ const client_default =
2
+ (element: HTMLElement) =>
3
+ (
4
+ Component: unknown,
5
+ props: Record<string, unknown>,
6
+ { client }: { client: string },
7
+ ) => {
8
+ if (client !== "only" && !element.hasAttribute("ssr")) return;
9
+
10
+ let html: string;
11
+ if (typeof Component === "string") {
12
+ html = Component;
13
+ } else if (typeof Component === "function") {
14
+ html = (Component as (p: Record<string, unknown>) => string)({
15
+ ...props,
16
+ });
17
+ } else {
18
+ html = "";
19
+ }
20
+
21
+ element.innerHTML = html;
22
+
23
+ element.querySelectorAll("script").forEach((oldScript) => {
24
+ const newScript = document.createElement("script");
25
+ newScript.textContent = oldScript.textContent;
26
+ oldScript.parentNode?.replaceChild(newScript, oldScript);
27
+ });
28
+ };
29
+
30
+ export default client_default;
@@ -0,0 +1,57 @@
1
+ import type { AstroIntegration, AstroRenderer } from "astro";
2
+
3
+ const VIRTUAL_SERVER_ID = "virtual:islands/html/server-with-filter";
4
+ const RESOLVED_VIRTUAL_SERVER_ID = `\0${VIRTUAL_SERVER_ID}`;
5
+
6
+ function getRenderer(filtered: boolean): AstroRenderer {
7
+ return {
8
+ clientEntrypoint: "islands-integrations/html/client",
9
+ name: "islands/html",
10
+ serverEntrypoint: filtered
11
+ ? VIRTUAL_SERVER_ID
12
+ : "islands-integrations/html/server",
13
+ };
14
+ }
15
+
16
+ export const getContainerRenderer = (): AstroRenderer => getRenderer(false);
17
+
18
+ export interface Options {
19
+ exclude?: string[];
20
+ include?: string[];
21
+ }
22
+
23
+ export default function (options: Options = {}): AstroIntegration {
24
+ const { exclude, include } = options;
25
+ const filtered = !!(include?.length || exclude?.length);
26
+
27
+ return {
28
+ hooks: {
29
+ "astro:config:setup": ({ addRenderer, updateConfig }) => {
30
+ addRenderer(getRenderer(filtered));
31
+ updateConfig({
32
+ vite: filtered
33
+ ? {
34
+ plugins: [
35
+ {
36
+ load(id: string) {
37
+ if (id !== RESOLVED_VIRTUAL_SERVER_ID) return;
38
+ return [
39
+ `import { createRenderer } from "islands-integrations/html/server";`,
40
+ `export default createRenderer(${JSON.stringify(include)}, ${JSON.stringify(exclude)});`,
41
+ ].join("\n");
42
+ },
43
+ name: "islands/html/filter",
44
+ resolveId(id: string) {
45
+ if (id === VIRTUAL_SERVER_ID)
46
+ return RESOLVED_VIRTUAL_SERVER_ID;
47
+ },
48
+ },
49
+ ],
50
+ }
51
+ : {},
52
+ });
53
+ },
54
+ },
55
+ name: "islands/html",
56
+ };
57
+ }
@@ -0,0 +1,54 @@
1
+ import type {
2
+ AstroComponentMetadata,
3
+ NamedSSRLoadedRendererValue,
4
+ } from "astro";
5
+
6
+ export function createRenderer(
7
+ include?: string[],
8
+ exclude?: string[],
9
+ ): NamedSSRLoadedRendererValue {
10
+ return {
11
+ check: async (
12
+ Component: unknown,
13
+ _props: unknown,
14
+ _slots: unknown,
15
+ metadata?: AstroComponentMetadata,
16
+ ) => {
17
+ const url = metadata?.componentUrl;
18
+ if (url) {
19
+ if (include && !matchesPatterns(url, include)) return false;
20
+ if (exclude && matchesPatterns(url, exclude)) return false;
21
+ }
22
+ return checkComponent(Component);
23
+ },
24
+ name: "islands/html",
25
+ renderToStaticMarkup,
26
+ supportsAstroStaticSlot: false,
27
+ };
28
+ }
29
+
30
+ async function checkComponent(Component: unknown): Promise<boolean> {
31
+ if (typeof Component === "string") return true;
32
+ if (typeof Component === "function") {
33
+ try {
34
+ const result = (Component as (p: Record<string, unknown>) => unknown)({});
35
+ return typeof result === "string";
36
+ } catch {
37
+ return false;
38
+ }
39
+ }
40
+ return false;
41
+ }
42
+
43
+ function matchesPatterns(url: string, patterns: string[]): boolean {
44
+ return patterns.some((pattern) => {
45
+ const prefix = pattern.replace(/\/?\*+$/, "");
46
+ return url.includes(prefix);
47
+ });
48
+ }
49
+
50
+ async function renderToStaticMarkup(): Promise<{ html: string }> {
51
+ return { html: "" };
52
+ }
53
+
54
+ export default createRenderer();