@absolutejs/absolute 0.20.0-beta.173 → 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 +7 -0
- package/changelog.json +11 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +47 -27
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +47 -27
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +635 -613
- package/dist/build.js.map +25 -24
- 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 +85 -65
- package/dist/cli/{dev-x49583aj.js → dev-6h1f0mzq.js} +1 -1
- 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 +11 -11
- 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/dev/importCostReport.js +45 -26
- package/dist/index.js +633 -611
- package/dist/index.js.map +25 -24
- package/dist/mobile/index.js +115 -95
- package/dist/mobile/index.js.map +6 -5
- package/dist/mobile/remoteMacAgentEntry.js +205 -651
- 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/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/utils/lazyTypescript.d.ts +3 -0
- package/package.json +1 -1
|
@@ -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 {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
lazyTypescript
|
|
4
|
+
} from "./index-4j1twret.js";
|
|
5
|
+
|
|
2
6
|
// src/core/islandManifest.ts
|
|
3
7
|
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1);
|
|
4
8
|
var getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
5
9
|
|
|
6
10
|
// src/build/islandEntries.ts
|
|
7
11
|
import { dirname, extname, join, relative, resolve } from "path";
|
|
8
|
-
import ts from "typescript";
|
|
9
12
|
// src/core/islands.ts
|
|
10
13
|
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
11
14
|
var getIslandBuildReference = (component) => {
|
|
@@ -36,7 +39,7 @@ var resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
|
36
39
|
return resolve(dirname(registryPath), sourcePath);
|
|
37
40
|
};
|
|
38
41
|
var getObjectPropertyName = (name) => {
|
|
39
|
-
if (
|
|
42
|
+
if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name)) {
|
|
40
43
|
return name.text;
|
|
41
44
|
}
|
|
42
45
|
return null;
|
|
@@ -51,7 +54,7 @@ var collectDefaultImport = (imports, importClause, source) => {
|
|
|
51
54
|
};
|
|
52
55
|
var collectNamedImports = (imports, importClause, source) => {
|
|
53
56
|
const bindings = importClause.namedBindings;
|
|
54
|
-
if (!bindings || !
|
|
57
|
+
if (!bindings || !lazyTypescript.isNamedImports(bindings))
|
|
55
58
|
return;
|
|
56
59
|
for (const element of bindings.elements) {
|
|
57
60
|
imports.set(element.name.text, {
|
|
@@ -67,7 +70,7 @@ var collectRegistryHelperImports = (importClause, source, registryFactoryNames,
|
|
|
67
70
|
const bindings = importClause.namedBindings;
|
|
68
71
|
if (!bindings)
|
|
69
72
|
return;
|
|
70
|
-
if (
|
|
73
|
+
if (lazyTypescript.isNamespaceImport(bindings)) {
|
|
71
74
|
registryNamespaceNames.add(bindings.name.text);
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
@@ -87,13 +90,13 @@ var addRegistryEntries = (frameworkNode, framework, imports, definitions, regist
|
|
|
87
90
|
const frameworkRegistry = registry[framework] ?? {};
|
|
88
91
|
registry[framework] = frameworkRegistry;
|
|
89
92
|
for (const property of frameworkNode.properties) {
|
|
90
|
-
if (!
|
|
93
|
+
if (!lazyTypescript.isPropertyAssignment(property) && !lazyTypescript.isShorthandPropertyAssignment(property))
|
|
91
94
|
continue;
|
|
92
95
|
const componentName = getObjectPropertyName(property.name);
|
|
93
96
|
if (!componentName)
|
|
94
97
|
continue;
|
|
95
|
-
const initializer =
|
|
96
|
-
if (!
|
|
98
|
+
const initializer = lazyTypescript.isPropertyAssignment(property) ? property.initializer : property.name;
|
|
99
|
+
if (!lazyTypescript.isIdentifier(initializer))
|
|
97
100
|
continue;
|
|
98
101
|
const reference = imports.get(initializer.text);
|
|
99
102
|
if (!reference)
|
|
@@ -108,7 +111,7 @@ var addRegistryEntries = (frameworkNode, framework, imports, definitions, regist
|
|
|
108
111
|
};
|
|
109
112
|
var processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
110
113
|
const [firstArg] = node.arguments;
|
|
111
|
-
if (!firstArg || !
|
|
114
|
+
if (!firstArg || !lazyTypescript.isObjectLiteralExpression(firstArg))
|
|
112
115
|
return;
|
|
113
116
|
const validFrameworks = [
|
|
114
117
|
"react",
|
|
@@ -117,7 +120,7 @@ var processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
|
117
120
|
"angular"
|
|
118
121
|
];
|
|
119
122
|
for (const property of firstArg.properties) {
|
|
120
|
-
if (!
|
|
123
|
+
if (!lazyTypescript.isPropertyAssignment(property))
|
|
121
124
|
continue;
|
|
122
125
|
const frameworkName = getObjectPropertyName(property.name);
|
|
123
126
|
if (!frameworkName)
|
|
@@ -125,31 +128,31 @@ var processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
|
125
128
|
const framework = validFrameworks.find((f) => f === frameworkName);
|
|
126
129
|
if (!framework)
|
|
127
130
|
continue;
|
|
128
|
-
if (!
|
|
131
|
+
if (!lazyTypescript.isObjectLiteralExpression(property.initializer))
|
|
129
132
|
continue;
|
|
130
133
|
addRegistryEntries(property.initializer, framework, imports, definitions, registry);
|
|
131
134
|
}
|
|
132
135
|
};
|
|
133
136
|
var walkRegistryNode = (node, imports, registryFactoryNames, registryNamespaceNames, definitions, registry) => {
|
|
134
|
-
if (
|
|
137
|
+
if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, registryFactoryNames, registryNamespaceNames)) {
|
|
135
138
|
processDefineIslandRegistry(node, imports, definitions, registry);
|
|
136
139
|
}
|
|
137
|
-
|
|
140
|
+
lazyTypescript.forEachChild(node, (child) => walkRegistryNode(child, imports, registryFactoryNames, registryNamespaceNames, definitions, registry));
|
|
138
141
|
};
|
|
139
142
|
var isDefineIslandRegistryCall = (expression, registryFactoryNames, registryNamespaceNames) => {
|
|
140
|
-
if (
|
|
143
|
+
if (lazyTypescript.isIdentifier(expression)) {
|
|
141
144
|
return registryFactoryNames.has(expression.text);
|
|
142
145
|
}
|
|
143
|
-
return
|
|
146
|
+
return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && registryNamespaceNames.has(expression.expression.text);
|
|
144
147
|
};
|
|
145
148
|
var hasIslandRegistryNamedExport = (sourceFile) => {
|
|
146
149
|
for (const statement of sourceFile.statements) {
|
|
147
|
-
if (
|
|
150
|
+
if (lazyTypescript.isVariableStatement(statement) && statement.modifiers?.some((modifier) => modifier.kind === lazyTypescript.SyntaxKind.ExportKeyword) && statement.declarationList.declarations.some((declaration) => lazyTypescript.isIdentifier(declaration.name) && declaration.name.text === "islandRegistry")) {
|
|
148
151
|
return true;
|
|
149
152
|
}
|
|
150
|
-
if (!
|
|
153
|
+
if (!lazyTypescript.isExportDeclaration(statement) || !statement.exportClause)
|
|
151
154
|
continue;
|
|
152
|
-
if (!
|
|
155
|
+
if (!lazyTypescript.isNamedExports(statement.exportClause))
|
|
153
156
|
continue;
|
|
154
157
|
if (statement.exportClause.elements.some((element) => element.name.text === "islandRegistry")) {
|
|
155
158
|
return true;
|
|
@@ -159,7 +162,7 @@ var hasIslandRegistryNamedExport = (sourceFile) => {
|
|
|
159
162
|
};
|
|
160
163
|
var collectImportDeclarations = (sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames) => {
|
|
161
164
|
for (const statement of sourceFile.statements) {
|
|
162
|
-
if (!
|
|
165
|
+
if (!lazyTypescript.isImportDeclaration(statement) || !lazyTypescript.isStringLiteral(statement.moduleSpecifier))
|
|
163
166
|
continue;
|
|
164
167
|
const { importClause } = statement;
|
|
165
168
|
if (!importClause)
|
|
@@ -171,7 +174,7 @@ var collectImportDeclarations = (sourceFile, registryPath, imports, registryFact
|
|
|
171
174
|
}
|
|
172
175
|
};
|
|
173
176
|
var parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
|
|
174
|
-
const sourceFile =
|
|
177
|
+
const sourceFile = lazyTypescript.createSourceFile(registryPath, registrySource, lazyTypescript.ScriptTarget.Latest, true, lazyTypescript.ScriptKind.TS);
|
|
175
178
|
const imports = new Map;
|
|
176
179
|
const registryFactoryNames = new Set(["defineIslandRegistry"]);
|
|
177
180
|
const registryNamespaceNames = new Set;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import {
|
|
3
|
+
lazyTypescript
|
|
4
|
+
} from "./index-4j1twret.js";
|
|
2
5
|
import {
|
|
3
6
|
frameworks,
|
|
4
7
|
sharedDirFor,
|
|
5
8
|
toModuleSpecifier
|
|
6
|
-
} from "./index-
|
|
9
|
+
} from "./index-enbw9484.js";
|
|
7
10
|
import {
|
|
8
11
|
findRoutingFile,
|
|
9
12
|
wireRoute
|
|
10
|
-
} from "./index-
|
|
13
|
+
} from "./index-23hvdyxf.js";
|
|
11
14
|
|
|
12
15
|
// src/cli/generate/naming.ts
|
|
13
16
|
var tokenize = (raw) => raw.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").split(/[^a-zA-Z0-9]+/).filter((token) => token.length > 0).map((token) => token.toLowerCase());
|
|
@@ -32,7 +35,6 @@ import {
|
|
|
32
35
|
import { dirname as dirname2, join as join2, relative } from "path";
|
|
33
36
|
|
|
34
37
|
// src/cli/generate/cssStrategy.ts
|
|
35
|
-
import ts from "typescript";
|
|
36
38
|
import { existsSync } from "fs";
|
|
37
39
|
import { join } from "path";
|
|
38
40
|
var CSS_SUFFIX = "CSS";
|
|
@@ -44,28 +46,28 @@ var DEFAULT_CSS = `main {
|
|
|
44
46
|
}
|
|
45
47
|
`;
|
|
46
48
|
var cssAssetArg = (node) => {
|
|
47
|
-
if (!
|
|
49
|
+
if (!lazyTypescript.isCallExpression(node) || !lazyTypescript.isIdentifier(node.expression) || node.expression.text !== "asset") {
|
|
48
50
|
return null;
|
|
49
51
|
}
|
|
50
52
|
const [, arg] = node.arguments;
|
|
51
|
-
if (arg &&
|
|
53
|
+
if (arg && lazyTypescript.isStringLiteralLike(arg) && arg.text.endsWith(CSS_SUFFIX)) {
|
|
52
54
|
return arg.text;
|
|
53
55
|
}
|
|
54
56
|
return null;
|
|
55
57
|
};
|
|
56
58
|
var detectSharedKey = (routingText) => {
|
|
57
|
-
const sourceFile =
|
|
59
|
+
const sourceFile = lazyTypescript.createSourceFile("routing.ts", routingText, lazyTypescript.ScriptTarget.Latest, true);
|
|
58
60
|
let hoisted = null;
|
|
59
61
|
const inlineCounts = new Map;
|
|
60
62
|
const visit = (node) => {
|
|
61
63
|
const key = cssAssetArg(node);
|
|
62
64
|
if (key) {
|
|
63
|
-
if (
|
|
65
|
+
if (lazyTypescript.isVariableDeclaration(node.parent))
|
|
64
66
|
hoisted ??= key;
|
|
65
67
|
else
|
|
66
68
|
inlineCounts.set(key, (inlineCounts.get(key) ?? 0) + 1);
|
|
67
69
|
}
|
|
68
|
-
|
|
70
|
+
lazyTypescript.forEachChild(node, visit);
|
|
69
71
|
};
|
|
70
72
|
visit(sourceFile);
|
|
71
73
|
if (hoisted)
|
|
@@ -103,7 +105,6 @@ var planCss = (routingText, stylesDir, pascal, kebab) => {
|
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
// src/cli/generate/navData.ts
|
|
106
|
-
import ts2 from "typescript";
|
|
107
108
|
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
108
109
|
import { dirname } from "path";
|
|
109
110
|
var NAV_DATA_TEMPLATE = `type NavItem = {
|
|
@@ -118,18 +119,18 @@ var findNavArray = (sourceFile) => {
|
|
|
118
119
|
const visit = (node) => {
|
|
119
120
|
if (found)
|
|
120
121
|
return;
|
|
121
|
-
if (
|
|
122
|
+
if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === "navData" && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
|
|
122
123
|
found = node.initializer;
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
lazyTypescript.forEachChild(node, visit);
|
|
126
127
|
};
|
|
127
128
|
visit(sourceFile);
|
|
128
129
|
return found;
|
|
129
130
|
};
|
|
130
131
|
var readStringProperty = (object, name) => {
|
|
131
|
-
const property = object.properties.find((candidate) =>
|
|
132
|
-
if (!property || !
|
|
132
|
+
const property = object.properties.find((candidate) => lazyTypescript.isPropertyAssignment(candidate) && lazyTypescript.isIdentifier(candidate.name) && candidate.name.text === name);
|
|
133
|
+
if (!property || !lazyTypescript.isStringLiteralLike(property.initializer)) {
|
|
133
134
|
return null;
|
|
134
135
|
}
|
|
135
136
|
return property.initializer.text;
|
|
@@ -137,7 +138,7 @@ var readStringProperty = (object, name) => {
|
|
|
137
138
|
var parseNavItems = (array) => {
|
|
138
139
|
const items = [];
|
|
139
140
|
for (const element of array.elements) {
|
|
140
|
-
if (!
|
|
141
|
+
if (!lazyTypescript.isObjectLiteralExpression(element))
|
|
141
142
|
continue;
|
|
142
143
|
const href = readStringProperty(element, "href");
|
|
143
144
|
const label = readStringProperty(element, "label");
|
|
@@ -150,7 +151,7 @@ var readNavItems = (navDataPath) => {
|
|
|
150
151
|
if (!existsSync2(navDataPath))
|
|
151
152
|
return [];
|
|
152
153
|
const text = readFileSync(navDataPath, "utf-8");
|
|
153
|
-
const sourceFile =
|
|
154
|
+
const sourceFile = lazyTypescript.createSourceFile(navDataPath, text, lazyTypescript.ScriptTarget.Latest, true);
|
|
154
155
|
const array = findNavArray(sourceFile);
|
|
155
156
|
return array ? parseNavItems(array) : [];
|
|
156
157
|
};
|
|
@@ -197,7 +198,7 @@ var upsertNavItem = (navDataPath, item) => {
|
|
|
197
198
|
return { changed: created, created, items: existing };
|
|
198
199
|
}
|
|
199
200
|
const text = readFileSync(navDataPath, "utf-8");
|
|
200
|
-
const sourceFile =
|
|
201
|
+
const sourceFile = lazyTypescript.createSourceFile(navDataPath, text, lazyTypescript.ScriptTarget.Latest, true);
|
|
201
202
|
const array = findNavArray(sourceFile);
|
|
202
203
|
if (!array)
|
|
203
204
|
return { changed: created, created, items: existing };
|