@absolutejs/absolute 0.20.0-beta.172 → 0.20.0-beta.174
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/CHANGELOG.md +39 -0
- package/README.md +3 -2
- package/changelog.json +68 -0
- package/dist/angular/browser.js +12 -12
- package/dist/angular/browser.js.map +6 -7
- package/dist/angular/components/core/streamingSlotRegistrar.js +2 -6
- package/dist/angular/components/core/streamingSlotRegistry.js +3 -7
- package/dist/angular/components/defer-slot.component.js +12 -7
- package/dist/angular/components/stream-slot.component.js +3 -1
- package/dist/angular/index.js +86 -39
- package/dist/angular/index.js.map +11 -10
- package/dist/angular/server.js +85 -38
- package/dist/angular/server.js.map +10 -9
- package/dist/build/buildWorker.js +135 -57
- package/dist/build.js +1817 -1623
- package/dist/build.js.map +38 -36
- package/dist/cli/{add-ae6mg79m.js → add-ntg96znk.js} +32 -31
- package/dist/cli/{compile-ndc36zna.js → compile-n6fs2vmx.js} +16 -14
- package/dist/cli/config/server.js +128 -77
- package/dist/cli/{dev-x49583aj.js → dev-6h1f0mzq.js} +1 -1
- package/dist/cli/{doctor-repprx92.js → doctor-m36tmx4d.js} +70 -15
- package/dist/cli/{expoProject-h404n2r8.js → expoProject-1qtw97js.js} +2 -1
- package/dist/cli/{generate-brvjesd6.js → generate-5vyz1s44.js} +7 -6
- package/dist/cli/{htmx-5twhjz7p.js → htmx-26hs6jdm.js} +2 -1
- package/dist/cli/{index-gyjxrnnz.js → index-23hvdyxf.js} +18 -16
- package/dist/cli/index-4j1twret.js +22 -0
- package/dist/cli/{index-25e7k849.js → index-bhyd3ejc.js} +4 -4
- package/dist/cli/{index-s0r5q839.js → index-cksezef8.js} +10 -8
- package/dist/cli/{index-q3snnhyd.js → index-enbw9484.js} +34 -33
- package/dist/cli/{index-b1wht4q5.js → index-kes8he5s.js} +6 -4
- package/dist/cli/{index-z794p5qg.js → index-mqevg32w.js} +22 -19
- package/dist/cli/{index-vh68jb0e.js → index-pkw3jktb.js} +17 -16
- package/dist/cli/{index-rervww4p.js → index-zyd80s3h.js} +119 -119
- package/dist/cli/index.js +12 -12
- package/dist/cli/{islands-p4vgx7a2.js → islands-vk05sj6v.js} +5 -4
- package/dist/cli/{mobile-nqdkk3gd.js → mobile-62b6j3j7.js} +5 -4
- package/dist/cli/{remove-abaf0w6k.js → remove-4jh862qa.js} +6 -5
- package/dist/cli/{start-t3cq57wn.js → start-jh6kyp92.js} +5 -4
- package/dist/cli/{typecheck-fag7djt5.js → typecheck-7fvww3b7.js} +28 -26
- package/dist/core/streamingSlotRegistrar.js +2 -5
- package/dist/core/streamingSlotRegistrar.js.map +4 -5
- package/dist/core/streamingSlotRegistry.js +2 -5
- package/dist/core/streamingSlotRegistry.js.map +4 -5
- package/dist/dev/importCostReport.js +45 -26
- package/dist/dev/serverBootstrap.js +2 -1
- package/dist/index.js +1748 -1550
- package/dist/index.js.map +40 -38
- package/dist/islands/index.js +2 -2
- package/dist/islands/index.js.map +3 -3
- package/dist/mobile/browser.js +2 -2
- package/dist/mobile/browser.js.map +3 -3
- package/dist/mobile/index.js +116 -96
- package/dist/mobile/index.js.map +7 -6
- package/dist/mobile/remoteMacAgentEntry.js +205 -651
- package/dist/react/components/index.js +2 -5
- package/dist/react/components/index.js.map +5 -6
- package/dist/react/index.js +45 -16
- package/dist/react/index.js.map +8 -8
- package/dist/react/router/browser.js.map +2 -2
- package/dist/react/router/index.js.map +2 -2
- package/dist/react/server.js +45 -16
- package/dist/react/server.js.map +8 -8
- package/dist/src/angular/components/defer-slot.component.d.ts +1 -0
- package/dist/src/build/missingReactRouter.d.ts +8 -0
- package/dist/src/build/vueModuleOutputPath.d.ts +10 -6
- package/dist/src/cli/config/absolute/resolveAbsoluteConfig.d.ts +3 -3
- package/dist/src/cli/config/auth/resolveAuthSettings.d.ts +3 -3
- package/dist/src/cli/scripts/doctor.d.ts +10 -0
- package/dist/src/core/streamingSlotWarningScope.d.ts +3 -0
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -2
- package/dist/src/dev/angular/hmrImportGenerator.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +2 -2
- package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +40 -40
- package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +3 -3
- package/dist/src/dev/hot/reload.d.ts +5 -0
- package/dist/src/dev/hot/runtime.d.ts +2 -0
- package/dist/src/dev/srcPath.d.ts +2 -1
- package/dist/src/react/pageHandler.d.ts +5 -0
- package/dist/src/react/router/Link.d.ts +6 -1
- package/dist/src/react/serverComponents/pageHandler.d.ts +2 -0
- package/dist/src/utils/lazyTypescript.d.ts +3 -0
- package/dist/src/utils/portInUse.d.ts +16 -0
- package/dist/svelte/index.js +39 -12
- package/dist/svelte/index.js.map +6 -6
- package/dist/svelte/server.js +39 -12
- package/dist/svelte/server.js.map +6 -6
- package/dist/vue/components/index.js +2 -5
- package/dist/vue/components/index.js.map +4 -5
- package/dist/vue/index.js +39 -12
- package/dist/vue/index.js.map +6 -6
- package/dist/vue/server.js +39 -12
- package/dist/vue/server.js.map +6 -6
- package/package.json +1 -1
|
@@ -14,15 +14,70 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
isRecord
|
|
16
16
|
} from "./index-tx0kx9zx.js";
|
|
17
|
-
import {
|
|
18
|
-
scanListeners
|
|
19
|
-
} from "./index-x8x0f3ha.js";
|
|
20
17
|
|
|
21
18
|
// src/cli/scripts/doctor.ts
|
|
22
19
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
23
20
|
import { createRequire as createRequire2 } from "module";
|
|
24
21
|
import { join as join2 } from "path";
|
|
25
22
|
|
|
23
|
+
// src/utils/portInUse.ts
|
|
24
|
+
import { spawnSync } from "child_process";
|
|
25
|
+
import { createConnection, createServer } from "net";
|
|
26
|
+
var CONNECT_TIMEOUT_MS = 300;
|
|
27
|
+
var IPV4_LOOPBACK = "127.0.0.1";
|
|
28
|
+
var IPV6_LOOPBACK = "::1";
|
|
29
|
+
var IPV4_ANY = "0.0.0.0";
|
|
30
|
+
var IPV6_ANY = "::";
|
|
31
|
+
var acceptsConnection = (port, host) => new Promise((resolve) => {
|
|
32
|
+
const socket = createConnection({ host, port });
|
|
33
|
+
const finish = (accepted) => {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
socket.removeAllListeners();
|
|
36
|
+
socket.on("error", () => {
|
|
37
|
+
return;
|
|
38
|
+
});
|
|
39
|
+
socket.destroy();
|
|
40
|
+
resolve(accepted);
|
|
41
|
+
};
|
|
42
|
+
const timer = setTimeout(() => finish(false), CONNECT_TIMEOUT_MS);
|
|
43
|
+
socket.once("connect", () => finish(true));
|
|
44
|
+
socket.once("error", () => finish(false));
|
|
45
|
+
});
|
|
46
|
+
var bindConflicts = (port, host, ipv6Only) => new Promise((resolve) => {
|
|
47
|
+
const server = createServer();
|
|
48
|
+
server.unref();
|
|
49
|
+
server.once("error", (error) => {
|
|
50
|
+
server.close(() => {
|
|
51
|
+
return;
|
|
52
|
+
});
|
|
53
|
+
resolve(error.code === "EADDRINUSE");
|
|
54
|
+
});
|
|
55
|
+
server.listen({ exclusive: true, host, ipv6Only, port }, () => {
|
|
56
|
+
server.close(() => resolve(false));
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
var isPortInUse = async (port) => {
|
|
60
|
+
if (await acceptsConnection(port, IPV4_LOOPBACK))
|
|
61
|
+
return true;
|
|
62
|
+
if (await acceptsConnection(port, IPV6_LOOPBACK))
|
|
63
|
+
return true;
|
|
64
|
+
if (await bindConflicts(port, IPV4_ANY, false))
|
|
65
|
+
return true;
|
|
66
|
+
return bindConflicts(port, IPV6_ANY, true);
|
|
67
|
+
};
|
|
68
|
+
var portListenerPids = (port) => {
|
|
69
|
+
try {
|
|
70
|
+
const result = spawnSync("lsof", ["-nP", "-t", `-iTCP:${port}`, "-sTCP:LISTEN"], { encoding: "utf-8", timeout: 2000 });
|
|
71
|
+
const output = typeof result.stdout === "string" ? result.stdout : "";
|
|
72
|
+
return [
|
|
73
|
+
...new Set(output.split(`
|
|
74
|
+
`).map(Number).filter((pid) => Number.isInteger(pid) && pid > 0 && pid !== process.pid))
|
|
75
|
+
];
|
|
76
|
+
} catch {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
26
81
|
// src/cli/typeGraphCoherence.ts
|
|
27
82
|
import {
|
|
28
83
|
existsSync,
|
|
@@ -312,15 +367,18 @@ var envCheck = async () => {
|
|
|
312
367
|
}
|
|
313
368
|
return check("fail", "Env vars", `missing ${missing.map((entry) => entry.key).join(", ")}`);
|
|
314
369
|
};
|
|
315
|
-
var devPort = (config) => {
|
|
316
|
-
const dev = Reflect.get(config, "dev");
|
|
317
|
-
const
|
|
318
|
-
return typeof
|
|
370
|
+
var devPort = (config, env = process.env) => {
|
|
371
|
+
const dev = config ? Reflect.get(config, "dev") : undefined;
|
|
372
|
+
const configured = dev && typeof dev === "object" ? Reflect.get(dev, "port") : undefined;
|
|
373
|
+
return Number(env.ABSOLUTE_PORT) || Number(env.PORT) || (typeof configured === "number" && configured > 0 ? configured : DEFAULT_PORT);
|
|
319
374
|
};
|
|
320
|
-
var portCheck = async (config) => {
|
|
321
|
-
const port = devPort(config);
|
|
322
|
-
|
|
323
|
-
|
|
375
|
+
var portCheck = async (config, env = process.env) => {
|
|
376
|
+
const port = devPort(config, env);
|
|
377
|
+
if (!await isPortInUse(port)) {
|
|
378
|
+
return check("ok", "Dev port", `${port} free`);
|
|
379
|
+
}
|
|
380
|
+
const pids = portListenerPids(port);
|
|
381
|
+
return check("warn", "Dev port", pids.length > 0 ? `${port} in use by pid ${pids.join(", ")}` : `${port} in use`);
|
|
324
382
|
};
|
|
325
383
|
var typeGraphCheck = () => {
|
|
326
384
|
const report = typeGraphCoherence.inspectTypeGraph(process.cwd());
|
|
@@ -364,10 +422,7 @@ ${colors.dim}${checks.length} checks \xB7 ${colors.reset}${summary}${colors.dim}
|
|
|
364
422
|
var gatherChecks = async () => {
|
|
365
423
|
const config = await loadConfigOrNull();
|
|
366
424
|
const configCheck = config === null ? check("fail", "Config", "absolute.config.ts not found or invalid") : check("ok", "Config", "absolute.config.ts loaded");
|
|
367
|
-
const [env, port] = await Promise.all([
|
|
368
|
-
envCheck(),
|
|
369
|
-
config === null ? check("warn", "Dev port", "skipped (no config)") : portCheck(config)
|
|
370
|
-
]);
|
|
425
|
+
const [env, port] = await Promise.all([envCheck(), portCheck(config)]);
|
|
371
426
|
return [
|
|
372
427
|
checkBun(),
|
|
373
428
|
checkAbsolute(),
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import"./index-wk0pyxrg.js";
|
|
3
|
+
import"./index-4j1twret.js";
|
|
3
4
|
import {
|
|
4
5
|
frameworks,
|
|
5
6
|
resolveProject,
|
|
6
7
|
selectFramework,
|
|
7
8
|
toModuleSpecifier
|
|
8
|
-
} from "./index-
|
|
9
|
+
} from "./index-enbw9484.js";
|
|
9
10
|
import"./index-t8jmj8w1.js";
|
|
10
11
|
import {
|
|
11
12
|
wirePluginUse
|
|
12
|
-
} from "./index-
|
|
13
|
+
} from "./index-23hvdyxf.js";
|
|
14
|
+
import {
|
|
15
|
+
colors
|
|
16
|
+
} from "./index-9djrap79.js";
|
|
13
17
|
import {
|
|
14
18
|
isValidName,
|
|
15
19
|
toCamelCase,
|
|
@@ -18,10 +22,7 @@ import {
|
|
|
18
22
|
toTitleCase,
|
|
19
23
|
emptyOutcome,
|
|
20
24
|
generatePage
|
|
21
|
-
} from "./index-
|
|
22
|
-
import {
|
|
23
|
-
colors
|
|
24
|
-
} from "./index-9djrap79.js";
|
|
25
|
+
} from "./index-pkw3jktb.js";
|
|
25
26
|
import"./index-125cfzvn.js";
|
|
26
27
|
import"./index-3ewt17wm.js";
|
|
27
28
|
import"./index-pr1skxen.js";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
lazyTypescript
|
|
4
|
+
} from "./index-4j1twret.js";
|
|
2
5
|
import {
|
|
3
6
|
toModuleSpecifier
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-enbw9484.js";
|
|
5
8
|
|
|
6
9
|
// src/cli/generate/routeWiring.ts
|
|
7
|
-
import ts from "typescript";
|
|
8
10
|
import { existsSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
9
11
|
import { dirname, join } from "path";
|
|
10
12
|
var DEFAULT_SEPARATOR = `
|
|
@@ -19,24 +21,24 @@ var applyEdits = (text, edits) => {
|
|
|
19
21
|
return output;
|
|
20
22
|
};
|
|
21
23
|
var stripExtension = (path) => path.replace(/\.[^./\\]+$/, "");
|
|
22
|
-
var parse = (path, text) =>
|
|
24
|
+
var parse = (path, text) => lazyTypescript.createSourceFile(path, text, lazyTypescript.ScriptTarget.Latest, true);
|
|
23
25
|
var findElysiaNew = (sourceFile) => {
|
|
24
26
|
let found = null;
|
|
25
27
|
const visit = (node) => {
|
|
26
28
|
if (found)
|
|
27
29
|
return;
|
|
28
|
-
if (
|
|
30
|
+
if (lazyTypescript.isNewExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "Elysia") {
|
|
29
31
|
found = node;
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
|
-
|
|
34
|
+
lazyTypescript.forEachChild(node, visit);
|
|
33
35
|
};
|
|
34
36
|
visit(sourceFile);
|
|
35
37
|
return found;
|
|
36
38
|
};
|
|
37
39
|
var climbChain = (start) => {
|
|
38
40
|
let top = start;
|
|
39
|
-
while (
|
|
41
|
+
while (lazyTypescript.isPropertyAccessExpression(top.parent) && top.parent.expression === top && lazyTypescript.isCallExpression(top.parent.parent) && top.parent.parent.expression === top.parent) {
|
|
40
42
|
top = top.parent.parent;
|
|
41
43
|
}
|
|
42
44
|
return top;
|
|
@@ -44,22 +46,22 @@ var climbChain = (start) => {
|
|
|
44
46
|
var collectCalls = (top) => {
|
|
45
47
|
const calls = [];
|
|
46
48
|
let node = top;
|
|
47
|
-
while (
|
|
49
|
+
while (lazyTypescript.isCallExpression(node) && lazyTypescript.isPropertyAccessExpression(node.expression)) {
|
|
48
50
|
calls.push(node);
|
|
49
51
|
node = node.expression.expression;
|
|
50
52
|
}
|
|
51
53
|
return calls.reverse();
|
|
52
54
|
};
|
|
53
|
-
var methodName = (call) =>
|
|
55
|
+
var methodName = (call) => lazyTypescript.isPropertyAccessExpression(call.expression) ? call.expression.name.text : null;
|
|
54
56
|
var isBoundary = (call) => {
|
|
55
57
|
const name = methodName(call);
|
|
56
58
|
const [arg] = call.arguments;
|
|
57
|
-
if (name === "use" && arg &&
|
|
59
|
+
if (name === "use" && arg && lazyTypescript.isIdentifier(arg)) {
|
|
58
60
|
return BOUNDARY_USE.has(arg.text);
|
|
59
61
|
}
|
|
60
|
-
return name === "on" && arg !== undefined &&
|
|
62
|
+
return name === "on" && arg !== undefined && lazyTypescript.isStringLiteralLike(arg);
|
|
61
63
|
};
|
|
62
|
-
var receiverEnd = (call) =>
|
|
64
|
+
var receiverEnd = (call) => lazyTypescript.isPropertyAccessExpression(call.expression) ? call.expression.expression.getEnd() : call.getEnd();
|
|
63
65
|
var separatorBefore = (text, offset) => {
|
|
64
66
|
const match = text.slice(offset).match(/^(\s*\n[ \t]*)\./);
|
|
65
67
|
return match ? match[1] : DEFAULT_SEPARATOR;
|
|
@@ -76,22 +78,22 @@ var findRouteInsertion = (text, top) => {
|
|
|
76
78
|
const sepProbe = last ? receiverEnd(last) : top.getEnd();
|
|
77
79
|
return { offset, separator: separatorBefore(text, sepProbe) };
|
|
78
80
|
};
|
|
79
|
-
var namedImportDecl = (sourceFile, module) => sourceFile.statements.find((statement) =>
|
|
81
|
+
var namedImportDecl = (sourceFile, module) => sourceFile.statements.find((statement) => lazyTypescript.isImportDeclaration(statement) && lazyTypescript.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === module && statement.importClause !== undefined && !statement.importClause.isTypeOnly && statement.importClause.namedBindings !== undefined && lazyTypescript.isNamedImports(statement.importClause.namedBindings));
|
|
80
82
|
var importedNames = (decl) => {
|
|
81
83
|
const bindings = decl.importClause?.namedBindings;
|
|
82
|
-
if (!bindings || !
|
|
84
|
+
if (!bindings || !lazyTypescript.isNamedImports(bindings))
|
|
83
85
|
return new Set;
|
|
84
86
|
return new Set(bindings.elements.map((element) => (element.propertyName ?? element.name).text));
|
|
85
87
|
};
|
|
86
88
|
var lastImportEnd = (sourceFile) => {
|
|
87
89
|
let end = 0;
|
|
88
90
|
for (const statement of sourceFile.statements) {
|
|
89
|
-
if (
|
|
91
|
+
if (lazyTypescript.isImportDeclaration(statement))
|
|
90
92
|
end = statement.getEnd();
|
|
91
93
|
}
|
|
92
94
|
return end;
|
|
93
95
|
};
|
|
94
|
-
var hasTypeImport = (sourceFile, module, local) => sourceFile.statements.some((statement) =>
|
|
96
|
+
var hasTypeImport = (sourceFile, module, local) => sourceFile.statements.some((statement) => lazyTypescript.isImportDeclaration(statement) && lazyTypescript.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === module && statement.getText().includes(local));
|
|
95
97
|
var renderTypeImport = (spec) => {
|
|
96
98
|
if (spec.kind === "typeDefault") {
|
|
97
99
|
return `import type ${spec.local} from '${spec.module}';`;
|
|
@@ -114,7 +116,7 @@ var groupNamed = (specs) => {
|
|
|
114
116
|
};
|
|
115
117
|
var mergeNamedEdit = (decl, sourceFile, missing) => {
|
|
116
118
|
const bindings = decl.importClause?.namedBindings;
|
|
117
|
-
if (!bindings || !
|
|
119
|
+
if (!bindings || !lazyTypescript.isNamedImports(bindings))
|
|
118
120
|
return null;
|
|
119
121
|
const { elements } = bindings;
|
|
120
122
|
const additions = missing.join(", ");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/utils/lazyTypescript.ts
|
|
3
|
+
import { createRequire } from "module";
|
|
4
|
+
var loaded;
|
|
5
|
+
var loadTypescript = () => {
|
|
6
|
+
if (loaded)
|
|
7
|
+
return loaded;
|
|
8
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
9
|
+
const typescript = requireFromHere("typescript");
|
|
10
|
+
loaded = typescript;
|
|
11
|
+
return typescript;
|
|
12
|
+
};
|
|
13
|
+
var createLazyTypescript = () => {
|
|
14
|
+
const target = Object.create(null);
|
|
15
|
+
return new Proxy(target, {
|
|
16
|
+
get: (_target, key) => Reflect.get(loadTypescript(), key),
|
|
17
|
+
has: (_target, key) => Reflect.has(loadTypescript(), key)
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var lazyTypescript = createLazyTypescript();
|
|
21
|
+
|
|
22
|
+
export { lazyTypescript };
|
|
@@ -9,9 +9,6 @@ import {
|
|
|
9
9
|
registerInstance,
|
|
10
10
|
resolveProjectName
|
|
11
11
|
} from "./index-71gchbzt.js";
|
|
12
|
-
import {
|
|
13
|
-
loadIslandRegistryBuildInfo
|
|
14
|
-
} from "./index-z794p5qg.js";
|
|
15
12
|
import {
|
|
16
13
|
createIslandRegistryDefinitionPlugin,
|
|
17
14
|
createBunStringRawUnicodePlugin,
|
|
@@ -20,7 +17,7 @@ import {
|
|
|
20
17
|
createElysiaOpenApiTypeboxPlugin,
|
|
21
18
|
createOptionalPeerPlugin,
|
|
22
19
|
resolveServerBundleExternals
|
|
23
|
-
} from "./index-
|
|
20
|
+
} from "./index-zyd80s3h.js";
|
|
24
21
|
import {
|
|
25
22
|
normalizeAbsoluteMobileConfig2
|
|
26
23
|
} from "./index-t7yf3vxs.js";
|
|
@@ -30,6 +27,9 @@ import {
|
|
|
30
27
|
import {
|
|
31
28
|
loadConfig
|
|
32
29
|
} from "./index-wk0pyxrg.js";
|
|
30
|
+
import {
|
|
31
|
+
loadIslandRegistryBuildInfo
|
|
32
|
+
} from "./index-mqevg32w.js";
|
|
33
33
|
import {
|
|
34
34
|
stripStringsAndComments
|
|
35
35
|
} from "./index-prs14ys9.js";
|
|
@@ -9,6 +9,9 @@ import {
|
|
|
9
9
|
projectUsesAbsoluteSync2,
|
|
10
10
|
resolveAbsoluteMobileAuthManifest2
|
|
11
11
|
} from "./index-pch0v1z6.js";
|
|
12
|
+
import {
|
|
13
|
+
lazyTypescript
|
|
14
|
+
} from "./index-4j1twret.js";
|
|
12
15
|
|
|
13
16
|
// src/mobile/expoProject.ts
|
|
14
17
|
import {
|
|
@@ -544,7 +547,6 @@ var discoverAbsoluteSyncSchema = (projectRoot) => {
|
|
|
544
547
|
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
545
548
|
import { extname, join as join3, relative, resolve as resolve3 } from "path";
|
|
546
549
|
import { fileURLToPath } from "url";
|
|
547
|
-
import ts from "typescript";
|
|
548
550
|
var DEVICES_PACKAGE = "@absolutejs/devices";
|
|
549
551
|
var ABSOLUTE_MOBILE_SHELL_DEVICE_CAPABILITIES = [
|
|
550
552
|
"keyboard",
|
|
@@ -749,29 +751,29 @@ var importedCapabilities = (source, file) => {
|
|
|
749
751
|
const names = new Set;
|
|
750
752
|
const namespaces = new Set;
|
|
751
753
|
const visit = (node) => {
|
|
752
|
-
if (
|
|
754
|
+
if (lazyTypescript.isImportDeclaration(node) && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && !node.importClause?.isTypeOnly) {
|
|
753
755
|
const bindings = node.importClause?.namedBindings;
|
|
754
|
-
if (bindings &&
|
|
756
|
+
if (bindings && lazyTypescript.isNamedImports(bindings)) {
|
|
755
757
|
for (const element of bindings.elements)
|
|
756
758
|
if (!element.isTypeOnly)
|
|
757
759
|
names.add((element.propertyName ?? element.name).text);
|
|
758
760
|
}
|
|
759
|
-
if (bindings &&
|
|
761
|
+
if (bindings && lazyTypescript.isNamespaceImport(bindings))
|
|
760
762
|
namespaces.add(bindings.name.text);
|
|
761
763
|
}
|
|
762
|
-
if (
|
|
764
|
+
if (lazyTypescript.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier !== undefined && lazyTypescript.isStringLiteral(node.moduleSpecifier) && node.moduleSpecifier.text === DEVICES_PACKAGE && node.exportClause && lazyTypescript.isNamedExports(node.exportClause)) {
|
|
763
765
|
for (const element of node.exportClause.elements)
|
|
764
766
|
if (!element.isTypeOnly)
|
|
765
767
|
names.add((element.propertyName ?? element.name).text);
|
|
766
768
|
}
|
|
767
|
-
if (
|
|
769
|
+
if (lazyTypescript.isPropertyAccessExpression(node) && lazyTypescript.isIdentifier(node.expression) && namespaces.has(node.expression.text))
|
|
768
770
|
names.add(node.name.text);
|
|
769
|
-
|
|
771
|
+
lazyTypescript.forEachChild(node, visit);
|
|
770
772
|
};
|
|
771
773
|
const extension = extname(file).toLowerCase();
|
|
772
774
|
const sources = extension === ".svelte" || extension === ".vue" ? [...source.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/giu)].map((match) => match[1]).filter((value) => value !== undefined) : [source];
|
|
773
775
|
for (const [index, script] of sources.entries())
|
|
774
|
-
visit(
|
|
776
|
+
visit(lazyTypescript.createSourceFile(`${file}#script-${index}`, script, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TSX));
|
|
775
777
|
return names;
|
|
776
778
|
};
|
|
777
779
|
var assertAbsoluteDeviceCapabilityPackages = (projectRoot, plan) => {
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
loadConfig
|
|
4
4
|
} from "./index-wk0pyxrg.js";
|
|
5
|
+
import {
|
|
6
|
+
lazyTypescript
|
|
7
|
+
} from "./index-4j1twret.js";
|
|
5
8
|
import {
|
|
6
9
|
isRecord
|
|
7
10
|
} from "./index-tx0kx9zx.js";
|
|
@@ -135,12 +138,10 @@ var frameworks = {
|
|
|
135
138
|
import { dirname, isAbsolute, join, relative, resolve as resolve3 } from "path";
|
|
136
139
|
|
|
137
140
|
// src/cli/config/absolute/resolveAbsoluteConfig.ts
|
|
138
|
-
import ts2 from "typescript";
|
|
139
141
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
140
142
|
import { resolve as resolve2 } from "path";
|
|
141
143
|
|
|
142
144
|
// src/cli/config/schema/fromType.ts
|
|
143
|
-
import ts from "typescript";
|
|
144
145
|
import {
|
|
145
146
|
existsSync,
|
|
146
147
|
mkdirSync,
|
|
@@ -160,14 +161,14 @@ var isFrameworkRepo = (cwd) => {
|
|
|
160
161
|
}
|
|
161
162
|
};
|
|
162
163
|
var compilerOptionsFor = (cwd) => {
|
|
163
|
-
const tsconfigPath =
|
|
164
|
+
const tsconfigPath = lazyTypescript.findConfigFile(cwd, lazyTypescript.sys.fileExists, "tsconfig.json");
|
|
164
165
|
const parseConfigHost = {
|
|
165
|
-
...
|
|
166
|
+
...lazyTypescript.sys,
|
|
166
167
|
onUnRecoverableConfigFileDiagnostic: () => {}
|
|
167
168
|
};
|
|
168
|
-
const base = tsconfigPath &&
|
|
169
|
+
const base = tsconfigPath && lazyTypescript.getParsedCommandLineOfConfigFile(tsconfigPath, {}, parseConfigHost)?.options;
|
|
169
170
|
return {
|
|
170
|
-
...base ??
|
|
171
|
+
...base ?? lazyTypescript.getDefaultCompilerOptions(),
|
|
171
172
|
noEmit: true,
|
|
172
173
|
skipDefaultLibCheck: true,
|
|
173
174
|
skipLibCheck: true,
|
|
@@ -223,7 +224,7 @@ var writeDiskCache = (cwd, typeName, signature, fields, specifier) => {
|
|
|
223
224
|
writeFileSync(cacheFile(cwd, typeName, specifier), JSON.stringify({ fields, signature }));
|
|
224
225
|
} catch {}
|
|
225
226
|
};
|
|
226
|
-
var docOf = (symbol, checker) =>
|
|
227
|
+
var docOf = (symbol, checker) => lazyTypescript.displayPartsToString(symbol.getDocumentationComment(checker)).trim();
|
|
227
228
|
var typeOfSymbol = (symbol, checker) => {
|
|
228
229
|
const declaration = symbol.valueDeclaration ?? symbol.declarations?.[0];
|
|
229
230
|
return declaration ? checker.getTypeOfSymbolAtLocation(symbol, declaration) : checker.getDeclaredTypeOfSymbol(symbol);
|
|
@@ -244,10 +245,10 @@ var toSchema = (type, checker, depth, seen) => {
|
|
|
244
245
|
});
|
|
245
246
|
if (depth > MAX_DEPTH)
|
|
246
247
|
return opaque();
|
|
247
|
-
const parts = unionParts(type).filter((part) => !hasFlag(part,
|
|
248
|
+
const parts = unionParts(type).filter((part) => !hasFlag(part, lazyTypescript.TypeFlags.Undefined) && !hasFlag(part, lazyTypescript.TypeFlags.Null));
|
|
248
249
|
if (parts.length === 0)
|
|
249
250
|
return opaque();
|
|
250
|
-
if (parts.every((part) => hasFlag(part,
|
|
251
|
+
if (parts.every((part) => hasFlag(part, lazyTypescript.TypeFlags.BooleanLike))) {
|
|
251
252
|
return { kind: "boolean" };
|
|
252
253
|
}
|
|
253
254
|
const choices = parts.map(literalChoice);
|
|
@@ -268,13 +269,13 @@ var single = (type, checker, depth, seen) => {
|
|
|
268
269
|
kind: "opaque",
|
|
269
270
|
typeText: checker.typeToString(type)
|
|
270
271
|
});
|
|
271
|
-
if (hasFlag(type,
|
|
272
|
+
if (hasFlag(type, lazyTypescript.TypeFlags.BooleanLike))
|
|
272
273
|
return { kind: "boolean" };
|
|
273
|
-
if (hasFlag(type,
|
|
274
|
+
if (hasFlag(type, lazyTypescript.TypeFlags.NumberLike))
|
|
274
275
|
return { kind: "number" };
|
|
275
|
-
if (hasFlag(type,
|
|
276
|
+
if (hasFlag(type, lazyTypescript.TypeFlags.StringLike))
|
|
276
277
|
return { kind: "string" };
|
|
277
|
-
if (!hasFlag(type,
|
|
278
|
+
if (!hasFlag(type, lazyTypescript.TypeFlags.Object))
|
|
278
279
|
return opaque();
|
|
279
280
|
if (type.getCallSignatures().length > 0)
|
|
280
281
|
return opaque();
|
|
@@ -295,7 +296,7 @@ var single = (type, checker, depth, seen) => {
|
|
|
295
296
|
const fields = props.map((symbol) => ({
|
|
296
297
|
description: docOf(symbol, checker),
|
|
297
298
|
name: symbol.getName(),
|
|
298
|
-
optional: (symbol.flags &
|
|
299
|
+
optional: (symbol.flags & lazyTypescript.SymbolFlags.Optional) !== 0,
|
|
299
300
|
schema: toSchema(typeOfSymbol(symbol, checker), checker, depth + 1, seen)
|
|
300
301
|
}));
|
|
301
302
|
return { fields, kind: "object" };
|
|
@@ -317,21 +318,21 @@ var introspectFrom = (cwd, specifier, typeName, options, exclude) => {
|
|
|
317
318
|
declare const value: ${typeName};
|
|
318
319
|
export { value };
|
|
319
320
|
`;
|
|
320
|
-
const host =
|
|
321
|
+
const host = lazyTypescript.createCompilerHost(options, true);
|
|
321
322
|
const getSourceFile = host.getSourceFile.bind(host);
|
|
322
|
-
host.getSourceFile = (fileName, languageVersion, onError, shouldCreate) => fileName === virtualPath ?
|
|
323
|
+
host.getSourceFile = (fileName, languageVersion, onError, shouldCreate) => fileName === virtualPath ? lazyTypescript.createSourceFile(fileName, source, languageVersion, true) : getSourceFile(fileName, languageVersion, onError, shouldCreate);
|
|
323
324
|
const fileExists = host.fileExists.bind(host);
|
|
324
325
|
host.fileExists = (fileName) => fileName === virtualPath ? true : fileExists(fileName);
|
|
325
326
|
const readFile = host.readFile.bind(host);
|
|
326
327
|
host.readFile = (fileName) => fileName === virtualPath ? source : readFile(fileName);
|
|
327
|
-
const program =
|
|
328
|
+
const program = lazyTypescript.createProgram([virtualPath], options, host);
|
|
328
329
|
const checker = program.getTypeChecker();
|
|
329
330
|
const sourceFile = program.getSourceFile(virtualPath);
|
|
330
331
|
if (!sourceFile)
|
|
331
332
|
return [];
|
|
332
333
|
const nodes = [];
|
|
333
334
|
sourceFile.forEachChild((node) => {
|
|
334
|
-
if (!
|
|
335
|
+
if (!lazyTypescript.isVariableStatement(node))
|
|
335
336
|
return;
|
|
336
337
|
const [declaration] = node.declarationList.declarations;
|
|
337
338
|
if (!declaration)
|
|
@@ -344,7 +345,7 @@ export { value };
|
|
|
344
345
|
nodes.push({
|
|
345
346
|
description: docOf(symbol, checker),
|
|
346
347
|
name,
|
|
347
|
-
optional: (symbol.flags &
|
|
348
|
+
optional: (symbol.flags & lazyTypescript.SymbolFlags.Optional) !== 0,
|
|
348
349
|
schema: toSchema(typeOfSymbol(symbol, checker), checker, 1, new Set)
|
|
349
350
|
});
|
|
350
351
|
}
|
|
@@ -405,18 +406,18 @@ var findConfigPath = (cwd, override) => {
|
|
|
405
406
|
}
|
|
406
407
|
return null;
|
|
407
408
|
};
|
|
408
|
-
var parseSource = (configPath, text) =>
|
|
409
|
+
var parseSource = (configPath, text) => lazyTypescript.createSourceFile(configPath, text, lazyTypescript.ScriptTarget.Latest, true);
|
|
409
410
|
var findConfigObject = (sourceFile) => {
|
|
410
411
|
const pending = [sourceFile];
|
|
411
412
|
while (pending.length > 0) {
|
|
412
413
|
const node = pending.pop();
|
|
413
414
|
if (!node)
|
|
414
415
|
continue;
|
|
415
|
-
const [firstArgument] =
|
|
416
|
-
if (
|
|
416
|
+
const [firstArgument] = lazyTypescript.isCallExpression(node) ? node.arguments : [];
|
|
417
|
+
if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "defineConfig" && firstArgument && lazyTypescript.isObjectLiteralExpression(firstArgument)) {
|
|
417
418
|
return firstArgument;
|
|
418
419
|
}
|
|
419
|
-
if (
|
|
420
|
+
if (lazyTypescript.isExportAssignment(node) && lazyTypescript.isObjectLiteralExpression(node.expression)) {
|
|
420
421
|
return node.expression;
|
|
421
422
|
}
|
|
422
423
|
node.forEachChild((child) => {
|
|
@@ -430,25 +431,25 @@ var parseConfigObject = (configPath) => {
|
|
|
430
431
|
return { object: findConfigObject(parseSource(configPath, text)), text };
|
|
431
432
|
};
|
|
432
433
|
var evalLiteral = (node) => {
|
|
433
|
-
if (
|
|
434
|
+
if (lazyTypescript.isStringLiteralLike(node)) {
|
|
434
435
|
return { opaque: false, value: node.text };
|
|
435
436
|
}
|
|
436
|
-
if (node.kind ===
|
|
437
|
+
if (node.kind === lazyTypescript.SyntaxKind.TrueKeyword) {
|
|
437
438
|
return { opaque: false, value: true };
|
|
438
439
|
}
|
|
439
|
-
if (node.kind ===
|
|
440
|
+
if (node.kind === lazyTypescript.SyntaxKind.FalseKeyword) {
|
|
440
441
|
return { opaque: false, value: false };
|
|
441
442
|
}
|
|
442
|
-
if (node.kind ===
|
|
443
|
+
if (node.kind === lazyTypescript.SyntaxKind.NullKeyword) {
|
|
443
444
|
return { opaque: false, value: null };
|
|
444
445
|
}
|
|
445
|
-
if (
|
|
446
|
+
if (lazyTypescript.isNumericLiteral(node)) {
|
|
446
447
|
return { opaque: false, value: Number(node.text) };
|
|
447
448
|
}
|
|
448
|
-
if (
|
|
449
|
+
if (lazyTypescript.isPrefixUnaryExpression(node) && node.operator === lazyTypescript.SyntaxKind.MinusToken && lazyTypescript.isNumericLiteral(node.operand)) {
|
|
449
450
|
return { opaque: false, value: -Number(node.operand.text) };
|
|
450
451
|
}
|
|
451
|
-
if (
|
|
452
|
+
if (lazyTypescript.isArrayLiteralExpression(node)) {
|
|
452
453
|
const items = [];
|
|
453
454
|
for (const element of node.elements) {
|
|
454
455
|
const result = evalLiteral(element);
|
|
@@ -458,10 +459,10 @@ var evalLiteral = (node) => {
|
|
|
458
459
|
}
|
|
459
460
|
return { opaque: false, value: items };
|
|
460
461
|
}
|
|
461
|
-
if (
|
|
462
|
+
if (lazyTypescript.isObjectLiteralExpression(node)) {
|
|
462
463
|
const object = {};
|
|
463
464
|
for (const property of node.properties) {
|
|
464
|
-
if (!
|
|
465
|
+
if (!lazyTypescript.isPropertyAssignment(property) || !(lazyTypescript.isIdentifier(property.name) || lazyTypescript.isStringLiteral(property.name))) {
|
|
465
466
|
return { opaque: true, value: undefined };
|
|
466
467
|
}
|
|
467
468
|
const result = evalLiteral(property.initializer);
|
|
@@ -480,7 +481,7 @@ var readCurrent = (configPath) => {
|
|
|
480
481
|
if (!object)
|
|
481
482
|
return { current, opaqueKeys };
|
|
482
483
|
for (const property of object.properties) {
|
|
483
|
-
if (!
|
|
484
|
+
if (!lazyTypescript.isPropertyAssignment(property) || !(lazyTypescript.isIdentifier(property.name) || lazyTypescript.isStringLiteral(property.name))) {
|
|
484
485
|
continue;
|
|
485
486
|
}
|
|
486
487
|
const name = property.name.text;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
lazyTypescript
|
|
4
|
+
} from "./index-4j1twret.js";
|
|
2
5
|
import {
|
|
3
6
|
findConfigObject
|
|
4
|
-
} from "./index-
|
|
7
|
+
} from "./index-enbw9484.js";
|
|
5
8
|
import {
|
|
6
9
|
isRecord
|
|
7
10
|
} from "./index-tx0kx9zx.js";
|
|
8
11
|
|
|
9
12
|
// src/cli/config/absolute/editAbsoluteConfig.ts
|
|
10
|
-
import ts from "typescript";
|
|
11
13
|
import { readFileSync, writeFileSync } from "fs";
|
|
12
14
|
|
|
13
15
|
// src/cli/config/schema/serialize.ts
|
|
@@ -55,11 +57,11 @@ var lineStartOffset = (text, position) => {
|
|
|
55
57
|
return index;
|
|
56
58
|
};
|
|
57
59
|
var indentBefore = (text, position) => text.slice(lineStartOffset(text, position), position);
|
|
58
|
-
var findProperty = (object, name) => object.properties.find((property) =>
|
|
60
|
+
var findProperty = (object, name) => object.properties.find((property) => lazyTypescript.isPropertyAssignment(property) && (lazyTypescript.isIdentifier(property.name) || lazyTypescript.isStringLiteral(property.name)) && property.name.text === name);
|
|
59
61
|
var applyAbsoluteConfigEdit = (configPath, request) => {
|
|
60
62
|
try {
|
|
61
63
|
const text = readFileSync(configPath, "utf-8");
|
|
62
|
-
const sourceFile =
|
|
64
|
+
const sourceFile = lazyTypescript.createSourceFile(configPath, text, lazyTypescript.ScriptTarget.Latest, true);
|
|
63
65
|
const object = findConfigObject(sourceFile);
|
|
64
66
|
if (!object) {
|
|
65
67
|
return {
|