@absolutejs/absolute 0.19.0-beta.312 → 0.19.0-beta.314
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/build.js +4 -2
- package/dist/build.js.map +3 -3
- package/dist/cli/index.js +127 -10
- package/dist/index.js +4 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1002,13 +1002,128 @@ var init_compile = __esm(() => {
|
|
|
1002
1002
|
];
|
|
1003
1003
|
});
|
|
1004
1004
|
|
|
1005
|
+
// src/build/generateIslandBindings.ts
|
|
1006
|
+
var exports_generateIslandBindings = {};
|
|
1007
|
+
__export(exports_generateIslandBindings, {
|
|
1008
|
+
generateIslandBindings: () => generateIslandBindings
|
|
1009
|
+
});
|
|
1010
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1011
|
+
import { dirname as dirname2, relative as relative2, resolve as resolve7 } from "path";
|
|
1012
|
+
var normalizeImportPath = (fromFile, targetFile) => {
|
|
1013
|
+
const rel = relative2(dirname2(fromFile), targetFile).replace(/\\/g, "/");
|
|
1014
|
+
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
1015
|
+
}, ensureDir = (filePath) => {
|
|
1016
|
+
mkdirSync4(dirname2(filePath), { recursive: true });
|
|
1017
|
+
}, writeIfChanged = (filePath, content) => {
|
|
1018
|
+
ensureDir(filePath);
|
|
1019
|
+
writeFileSync2(filePath, content);
|
|
1020
|
+
}, removeIfExists = (filePath) => {
|
|
1021
|
+
if (existsSync9(filePath)) {
|
|
1022
|
+
rmSync2(filePath, { force: true });
|
|
1023
|
+
}
|
|
1024
|
+
}, generateIslandBindings = (projectRoot, config) => {
|
|
1025
|
+
const registryPath = config.islands?.registry;
|
|
1026
|
+
if (!registryPath) {
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
const resolvedRegistryPath = resolve7(projectRoot, registryPath);
|
|
1030
|
+
const sharedDtsTarget = resolve7(dirname2(resolvedRegistryPath), "absolute-islands.d.ts");
|
|
1031
|
+
const buildRegistryAugmentation = (registryImportPath, moduleBody) => `import type { islandRegistry } from ${JSON.stringify(registryImportPath)};
|
|
1032
|
+
|
|
1033
|
+
` + `type GeneratedAbsoluteIslandRegistry = typeof islandRegistry;
|
|
1034
|
+
|
|
1035
|
+
` + `declare global {
|
|
1036
|
+
interface AbsoluteIslandRegistry extends GeneratedAbsoluteIslandRegistry {}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
` + (moduleBody ? `${moduleBody}
|
|
1040
|
+
|
|
1041
|
+
` : "") + `export {};
|
|
1042
|
+
`;
|
|
1043
|
+
const sharedRegistryImport = normalizeImportPath(sharedDtsTarget, resolvedRegistryPath);
|
|
1044
|
+
const sharedModuleBodies = [
|
|
1045
|
+
`declare module "@absolutejs/absolute/react" {
|
|
1046
|
+
import type { JSX } from "react";
|
|
1047
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1048
|
+
export const Island: (props: ConfiguredTypedIslandRenderProps) => Promise<JSX.Element>;
|
|
1049
|
+
}`,
|
|
1050
|
+
`declare module "@absolutejs/absolute/vue" {
|
|
1051
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1052
|
+
export const Island: new () => { $props: ConfiguredTypedIslandRenderProps };
|
|
1053
|
+
}`,
|
|
1054
|
+
`declare module "@absolutejs/absolute/svelte" {
|
|
1055
|
+
import type { Component } from "svelte";
|
|
1056
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1057
|
+
export const Island: Component<ConfiguredTypedIslandRenderProps>;
|
|
1058
|
+
}`,
|
|
1059
|
+
`declare module "@absolutejs/absolute/angular" {
|
|
1060
|
+
import type { Type } from "@angular/core";
|
|
1061
|
+
export const Island: Type<unknown>;
|
|
1062
|
+
}`
|
|
1063
|
+
];
|
|
1064
|
+
writeIfChanged(sharedDtsTarget, buildRegistryAugmentation(sharedRegistryImport, sharedModuleBodies.join(`
|
|
1065
|
+
|
|
1066
|
+
`)));
|
|
1067
|
+
if (config.reactDirectory) {
|
|
1068
|
+
const compatTarget = resolve7(config.reactDirectory, "generated", "absolute-react.ts");
|
|
1069
|
+
const dtsTarget = resolve7(config.reactDirectory, "generated", "absolute-react.d.ts");
|
|
1070
|
+
removeIfExists(resolve7(config.reactDirectory, "generated", "Island.tsx"));
|
|
1071
|
+
const registryImport = normalizeImportPath(dtsTarget, resolvedRegistryPath);
|
|
1072
|
+
writeIfChanged(compatTarget, `export * from "@absolutejs/absolute/react";
|
|
1073
|
+
`);
|
|
1074
|
+
writeIfChanged(dtsTarget, buildRegistryAugmentation(registryImport, `declare module "@absolutejs/absolute/react" {
|
|
1075
|
+
import type { JSX } from "react";
|
|
1076
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1077
|
+
export const Island: (props: ConfiguredTypedIslandRenderProps) => Promise<JSX.Element>;
|
|
1078
|
+
}`));
|
|
1079
|
+
}
|
|
1080
|
+
if (config.vueDirectory) {
|
|
1081
|
+
const compatTarget = resolve7(config.vueDirectory, "generated", "absolute-vue.ts");
|
|
1082
|
+
const dtsTarget = resolve7(config.vueDirectory, "generated", "absolute-vue.d.ts");
|
|
1083
|
+
removeIfExists(resolve7(config.vueDirectory, "generated", "Island.ts"));
|
|
1084
|
+
const registryImport = normalizeImportPath(dtsTarget, resolvedRegistryPath);
|
|
1085
|
+
writeIfChanged(compatTarget, `export * from "@absolutejs/absolute/vue";
|
|
1086
|
+
`);
|
|
1087
|
+
writeIfChanged(dtsTarget, buildRegistryAugmentation(registryImport, `declare module "@absolutejs/absolute/vue" {
|
|
1088
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1089
|
+
export const Island: new () => { $props: ConfiguredTypedIslandRenderProps };
|
|
1090
|
+
}`));
|
|
1091
|
+
}
|
|
1092
|
+
if (config.svelteDirectory) {
|
|
1093
|
+
const compatTarget = resolve7(config.svelteDirectory, "generated", "absolute-svelte.ts");
|
|
1094
|
+
const dtsTarget = resolve7(config.svelteDirectory, "generated", "absolute-svelte.d.ts");
|
|
1095
|
+
removeIfExists(resolve7(config.svelteDirectory, "generated", "islands.ts"));
|
|
1096
|
+
const registryImport = normalizeImportPath(dtsTarget, resolvedRegistryPath);
|
|
1097
|
+
writeIfChanged(compatTarget, `export * from "@absolutejs/absolute/svelte";
|
|
1098
|
+
`);
|
|
1099
|
+
writeIfChanged(dtsTarget, buildRegistryAugmentation(registryImport, `declare module "@absolutejs/absolute/svelte" {
|
|
1100
|
+
import type { Component } from "svelte";
|
|
1101
|
+
import type { ConfiguredTypedIslandRenderProps } from "@absolutejs/absolute";
|
|
1102
|
+
export const Island: Component<ConfiguredTypedIslandRenderProps>;
|
|
1103
|
+
}`));
|
|
1104
|
+
}
|
|
1105
|
+
if (config.angularDirectory) {
|
|
1106
|
+
const compatTarget = resolve7(config.angularDirectory, "generated", "absolute-angular.ts");
|
|
1107
|
+
const dtsTarget = resolve7(config.angularDirectory, "generated", "absolute-angular.d.ts");
|
|
1108
|
+
removeIfExists(resolve7(config.angularDirectory, "generated", "islands.ts"));
|
|
1109
|
+
const registryImport = normalizeImportPath(dtsTarget, resolvedRegistryPath);
|
|
1110
|
+
writeIfChanged(compatTarget, `export * from "@absolutejs/absolute/angular";
|
|
1111
|
+
`);
|
|
1112
|
+
writeIfChanged(dtsTarget, buildRegistryAugmentation(registryImport, `declare module "@absolutejs/absolute/angular" {
|
|
1113
|
+
import type { Type } from "@angular/core";
|
|
1114
|
+
export const Island: Type<unknown>;
|
|
1115
|
+
}`));
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
var init_generateIslandBindings = () => {};
|
|
1119
|
+
|
|
1005
1120
|
// src/cli/scripts/typecheck.ts
|
|
1006
1121
|
var exports_typecheck = {};
|
|
1007
1122
|
__export(exports_typecheck, {
|
|
1008
1123
|
typecheck: () => typecheck
|
|
1009
1124
|
});
|
|
1010
|
-
import { resolve as
|
|
1011
|
-
import { existsSync as
|
|
1125
|
+
import { resolve as resolve8, join as join7 } from "path";
|
|
1126
|
+
import { existsSync as existsSync10 } from "fs";
|
|
1012
1127
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
1013
1128
|
var run = async (name, command) => {
|
|
1014
1129
|
const proc = Bun.spawn(command, {
|
|
@@ -1022,8 +1137,8 @@ var run = async (name, command) => {
|
|
|
1022
1137
|
const exitCode = await proc.exited;
|
|
1023
1138
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
1024
1139
|
}, findBin = (name) => {
|
|
1025
|
-
const local =
|
|
1026
|
-
return
|
|
1140
|
+
const local = resolve8("node_modules", ".bin", name);
|
|
1141
|
+
return existsSync10(local) ? local : null;
|
|
1027
1142
|
}, stripAnsi = (str) => str.replace(/\x1b\[[0-9;]*m/g, ""), formatSvelteOutput = (output) => {
|
|
1028
1143
|
const cwd = `${process.cwd()}/`;
|
|
1029
1144
|
const summaryMatch = stripAnsi(output).match(/svelte-check found (\d+) error/);
|
|
@@ -1082,13 +1197,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1082
1197
|
"../**/generated/**/*"
|
|
1083
1198
|
];
|
|
1084
1199
|
return writeFile(vueTsconfigPath, JSON.stringify({
|
|
1085
|
-
extends:
|
|
1200
|
+
extends: resolve8("tsconfig.json"),
|
|
1086
1201
|
exclude
|
|
1087
1202
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
1088
1203
|
vueTscBin,
|
|
1089
1204
|
"--noEmit",
|
|
1090
1205
|
"--project",
|
|
1091
|
-
|
|
1206
|
+
resolve8(vueTsconfigPath),
|
|
1092
1207
|
"--incremental",
|
|
1093
1208
|
"--tsBuildInfoFile",
|
|
1094
1209
|
join7(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
@@ -1108,13 +1223,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1108
1223
|
"../**/generated/**/*"
|
|
1109
1224
|
];
|
|
1110
1225
|
return writeFile(tscConfigPath, JSON.stringify({
|
|
1111
|
-
extends:
|
|
1226
|
+
extends: resolve8("tsconfig.json"),
|
|
1112
1227
|
exclude
|
|
1113
1228
|
}, null, "\t")).then(() => run("tsc", [
|
|
1114
1229
|
tscBin,
|
|
1115
1230
|
"--noEmit",
|
|
1116
1231
|
"--project",
|
|
1117
|
-
|
|
1232
|
+
resolve8(tscConfigPath),
|
|
1118
1233
|
"--incremental",
|
|
1119
1234
|
"--tsBuildInfoFile",
|
|
1120
1235
|
join7(cacheDir, "tsc.tsbuildinfo"),
|
|
@@ -1128,13 +1243,13 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1128
1243
|
}
|
|
1129
1244
|
const svelteTsconfigPath = join7(cacheDir, "tsconfig.svelte-check.json");
|
|
1130
1245
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
1131
|
-
extends:
|
|
1246
|
+
extends: resolve8("tsconfig.json"),
|
|
1132
1247
|
include: [`../${svelteDir}/**/*`]
|
|
1133
1248
|
}, null, "\t"));
|
|
1134
1249
|
return run("svelte-check", [
|
|
1135
1250
|
svelteBin,
|
|
1136
1251
|
"--tsconfig",
|
|
1137
|
-
|
|
1252
|
+
resolve8(svelteTsconfigPath),
|
|
1138
1253
|
"--threshold",
|
|
1139
1254
|
"error",
|
|
1140
1255
|
"--compiler-warnings",
|
|
@@ -1145,6 +1260,8 @@ Found ${errorCount} error${suffix}.`;
|
|
|
1145
1260
|
]);
|
|
1146
1261
|
}, typecheck = async (configPath2) => {
|
|
1147
1262
|
const config = await loadConfig(configPath2);
|
|
1263
|
+
const { generateIslandBindings: generateIslandBindings2 } = await Promise.resolve().then(() => (init_generateIslandBindings(), exports_generateIslandBindings));
|
|
1264
|
+
generateIslandBindings2(process.cwd(), config);
|
|
1148
1265
|
const hasSvelte = Boolean(config.svelteDirectory);
|
|
1149
1266
|
const hasVue = Boolean(config.vueDirectory);
|
|
1150
1267
|
const cacheDir = ".absolutejs";
|
package/dist/index.js
CHANGED
|
@@ -880,8 +880,10 @@ var normalizeImportPath2 = (fromFile, targetFile) => {
|
|
|
880
880
|
const sharedDtsTarget = resolve5(dirname3(resolvedRegistryPath), "absolute-islands.d.ts");
|
|
881
881
|
const buildRegistryAugmentation = (registryImportPath, moduleBody) => `import type { islandRegistry } from ${JSON.stringify(registryImportPath)};
|
|
882
882
|
|
|
883
|
+
` + `type GeneratedAbsoluteIslandRegistry = typeof islandRegistry;
|
|
884
|
+
|
|
883
885
|
` + `declare global {
|
|
884
|
-
interface AbsoluteIslandRegistry extends
|
|
886
|
+
interface AbsoluteIslandRegistry extends GeneratedAbsoluteIslandRegistry {}
|
|
885
887
|
}
|
|
886
888
|
|
|
887
889
|
` + (moduleBody ? `${moduleBody}
|
|
@@ -215504,5 +215506,5 @@ export {
|
|
|
215504
215506
|
ANGULAR_INIT_TIMEOUT_MS
|
|
215505
215507
|
};
|
|
215506
215508
|
|
|
215507
|
-
//# debugId=
|
|
215509
|
+
//# debugId=5E40B456CFBAF1D064756E2164756E21
|
|
215508
215510
|
//# sourceMappingURL=index.js.map
|