@absolutejs/absolute 0.19.0-beta.205 → 0.19.0-beta.207

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/cli/index.js CHANGED
@@ -986,12 +986,21 @@ __export(exports_typecheck, {
986
986
  import { resolve as resolve7, join as join7 } from "path";
987
987
  import { existsSync as existsSync9 } from "fs";
988
988
  import { writeFile } from "fs/promises";
989
- var run = async (name, command) => {
989
+ var run = async (name, command, quiet = false) => {
990
990
  const proc = Bun.spawn(command, {
991
- stderr: "inherit",
992
- stdout: "inherit"
991
+ stderr: quiet ? "pipe" : "inherit",
992
+ stdout: quiet ? "pipe" : "inherit"
993
993
  });
994
994
  const exitCode = await proc.exited;
995
+ if (quiet && exitCode !== 0) {
996
+ const stderr = proc.stderr ? await new Response(proc.stderr).text() : "";
997
+ const stdout = proc.stdout ? await new Response(proc.stdout).text() : "";
998
+ const lines = (stdout + stderr).split(`
999
+ `).filter((line) => line.includes("Error:") || line.includes("error ") || line.includes("ERROR"));
1000
+ if (lines.length > 0)
1001
+ console.error(lines.join(`
1002
+ `));
1003
+ }
995
1004
  return { exitCode, name };
996
1005
  }, findBin = (name) => {
997
1006
  const local = resolve7("node_modules", ".bin", name);
@@ -1025,7 +1034,7 @@ var run = async (name, command) => {
1025
1034
  const svelteTsconfigPath = join7(cacheDir, "tsconfig.svelte-check.json");
1026
1035
  await writeFile(svelteTsconfigPath, JSON.stringify({
1027
1036
  extends: resolve7("tsconfig.json"),
1028
- include: [`${config.svelteDirectory}/**/*`]
1037
+ include: [`../${config.svelteDirectory}/**/*`]
1029
1038
  }, null, "\t"));
1030
1039
  checks.push(run("svelte-check", [
1031
1040
  findBin("svelte-check"),
@@ -1035,7 +1044,7 @@ var run = async (name, command) => {
1035
1044
  "error",
1036
1045
  "--compiler-warnings",
1037
1046
  "css-unused-selector:ignore"
1038
- ]));
1047
+ ], true));
1039
1048
  }
1040
1049
  const results = await Promise.all(checks);
1041
1050
  const failed = results.filter((r) => r.exitCode !== 0);
@@ -0,0 +1,5 @@
1
+ import type { Metadata } from '../../types/metadata';
2
+ import { SvelteComponent } from 'svelte';
3
+ declare const __propDef: { props: Metadata };
4
+ type Props = typeof __propDef.props;
5
+ export default class Head extends SvelteComponent<Props> {}
@@ -0,0 +1,5 @@
1
+ import type { ImageProps } from '../../types/image';
2
+ import { SvelteComponent } from 'svelte';
3
+ declare const __propDef: { props: ImageProps };
4
+ type Props = typeof __propDef.props;
5
+ export default class Image extends SvelteComponent<Props> {}
@@ -0,0 +1,2 @@
1
+ import { SvelteComponent } from 'svelte';
2
+ export default class JsonLd extends SvelteComponent {}
@@ -0,0 +1,4 @@
1
+ import type { ImageProps } from '../../types/image';
2
+ import { DefineComponent } from 'vue';
3
+ declare const _default: DefineComponent<ImageProps>;
4
+ export default _default;
package/package.json CHANGED
@@ -208,5 +208,5 @@
208
208
  "typecheck": "bun run vue-tsc --noEmit"
209
209
  },
210
210
  "types": "./dist/src/index.d.ts",
211
- "version": "0.19.0-beta.205"
211
+ "version": "0.19.0-beta.207"
212
212
  }
package/scripts/build.ts CHANGED
@@ -115,6 +115,10 @@ async function build() {
115
115
  );
116
116
  }
117
117
 
118
+ // Generate .d.ts files for SFC components so consumers get type safety
119
+ console.log("Generating SFC type declarations...");
120
+ await generateSfcDeclarations();
121
+
118
122
  // Compile Angular components with partial compilation (ɵɵngDeclareComponent)
119
123
  // so they work in both AOT (via linker) and JIT (via runtime fallback)
120
124
  console.log("Compiling Angular components (partial)...");
@@ -126,6 +130,46 @@ async function build() {
126
130
  console.log("Build complete.");
127
131
  }
128
132
 
133
+ async function generateSfcDeclarations() {
134
+ // Svelte component declarations
135
+ const svelteComponentDir = join(DIST, "svelte", "components");
136
+ const svelteFiles = await readdir(svelteComponentDir);
137
+ for (const file of svelteFiles.filter((f) => f.endsWith(".svelte"))) {
138
+ const content = await Bun.file(join(svelteComponentDir, file)).text();
139
+ const propsMatch = content.match(/\}:\s*(\w+)\s*=\s*\$props\(\)/);
140
+ const propsType = propsMatch?.[1];
141
+ const name = file.replace(/\.svelte$/, "");
142
+
143
+ let dts: string;
144
+ if (propsType === "ImageProps") {
145
+ dts = `import type { ImageProps } from '../../types/image';\nimport { SvelteComponent } from 'svelte';\ndeclare const __propDef: { props: ImageProps };\ntype Props = typeof __propDef.props;\nexport default class ${name} extends SvelteComponent<Props> {}\n`;
146
+ } else if (propsType) {
147
+ dts = `import type { ${propsType} } from '../../types/metadata';\nimport { SvelteComponent } from 'svelte';\ndeclare const __propDef: { props: ${propsType} };\ntype Props = typeof __propDef.props;\nexport default class ${name} extends SvelteComponent<Props> {}\n`;
148
+ } else {
149
+ dts = `import { SvelteComponent } from 'svelte';\nexport default class ${name} extends SvelteComponent {}\n`;
150
+ }
151
+ await writeFile(join(svelteComponentDir, `${file}.d.ts`), dts);
152
+ }
153
+
154
+ // Vue component declarations
155
+ const vueComponentDir = join(DIST, "vue", "components");
156
+ const vueFiles = await readdir(vueComponentDir);
157
+ for (const file of vueFiles.filter((f) => f.endsWith(".vue"))) {
158
+ const content = await Bun.file(join(vueComponentDir, file)).text();
159
+ const name = file.replace(/\.vue$/, "");
160
+
161
+ // Check if it uses defineProps<ImageProps> or inline props
162
+ const hasImageProps = content.includes("ImageProps") || content.includes("defineProps<{");
163
+ let dts: string;
164
+ if (name === "Image" || hasImageProps) {
165
+ dts = `import type { ImageProps } from '../../types/image';\nimport { DefineComponent } from 'vue';\ndeclare const _default: DefineComponent<ImageProps>;\nexport default _default;\n`;
166
+ } else {
167
+ dts = `import { DefineComponent } from 'vue';\ndeclare const _default: DefineComponent;\nexport default _default;\n`;
168
+ }
169
+ await writeFile(join(vueComponentDir, `${file}.d.ts`), dts);
170
+ }
171
+ }
172
+
129
173
  async function compileAngularComponentsPartial() {
130
174
  const { readConfiguration, performCompilation, EmitFlags } = await import(
131
175
  "@angular/compiler-cli"