@absolutejs/absolute 0.20.0-beta.179 → 0.20.0-beta.180

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 (125) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/changelog.json +45 -0
  3. package/dist/angular/browser.js +2 -2
  4. package/dist/angular/browser.js.map +3 -3
  5. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  6. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  7. package/dist/angular/index.js +21 -6
  8. package/dist/angular/index.js.map +6 -6
  9. package/dist/angular/server.js +21 -6
  10. package/dist/angular/server.js.map +6 -6
  11. package/dist/build.js +5357 -4945
  12. package/dist/build.js.map +27 -24
  13. package/dist/cli/build-fntmf42w.js +495 -0
  14. package/dist/cli/{buildDepVendor-qvsh6dsj.js → buildDepVendor-qnwfct22.js} +5 -3
  15. package/dist/cli/buildReactServerComponents-fq6mw10d.js +13 -0
  16. package/dist/cli/{compile-p5yv6ecp.js → compile-54rb8szn.js} +94 -125
  17. package/dist/cli/config/server.js +10 -5
  18. package/dist/cli/{dev-2hbcsvkp.js → dev-6s6g5tnk.js} +13 -14
  19. package/dist/cli/{expoProject-1qtw97js.js → expoProject-acgfaj3f.js} +2 -1
  20. package/dist/cli/generatedDir-239r7csr.js +9 -0
  21. package/dist/cli/{index-cksezef8.js → index-0gd30trc.js} +105 -851
  22. package/dist/cli/index-2wvysvjc.js +40 -0
  23. package/dist/cli/index-42xjh6gg.js +282 -0
  24. package/dist/cli/{index-qw98g1p6.js → index-47e8fwha.js} +4 -1
  25. package/dist/cli/index-65kqn88a.js +8 -0
  26. package/dist/cli/{index-2bxfhs32.js → index-6f448d7m.js} +0 -26
  27. package/dist/cli/index-972xxwgj.js +16 -0
  28. package/dist/cli/index-aqe25w4h.js +39 -0
  29. package/dist/cli/index-assqancr.js +51 -0
  30. package/dist/cli/{index-2shf4aya.js → index-c8rcfe5a.js} +4 -6
  31. package/dist/cli/index-cba1cemz.js +8 -0
  32. package/dist/cli/{index-3ff5ztt3.js → index-djkrb7pc.js} +1 -7
  33. package/dist/cli/index-dkfwkpc8.js +138 -0
  34. package/dist/cli/{index-92g14j47.js → index-dw44xa4x.js} +2 -1
  35. package/dist/cli/index-evsnq0n2.js +17 -0
  36. package/dist/cli/index-fxwf3n2v.js +224 -0
  37. package/dist/cli/{index-zyd80s3h.js → index-js2hksgv.js} +21 -295
  38. package/dist/cli/{index-bp60baze.js → index-jyap0bhv.js} +1 -1
  39. package/dist/cli/{index-9dzdbbfc.js → index-kx2d067c.js} +8 -6
  40. package/dist/cli/index-pb31zan6.js +9 -0
  41. package/dist/cli/index-sq0478b0.js +281 -0
  42. package/dist/cli/index-va274tsf.js +7 -0
  43. package/dist/cli/{index-yd672jyq.js → index-w6xsk8cv.js} +4 -1
  44. package/dist/cli/index-w79snsxv.js +461 -0
  45. package/dist/cli/index-x1vvn549.js +835 -0
  46. package/dist/cli/index-xf9sfr8a.js +243 -0
  47. package/dist/cli/index-ycqdxy55.js +754 -0
  48. package/dist/cli/index-z74cqxz0.js +131 -0
  49. package/dist/cli/index.js +10 -9
  50. package/dist/cli/{islands-6zgb7501.js → islands-17tfx8jf.js} +6 -17
  51. package/dist/cli/{ls-0hfx323m.js → ls-0wr74w0b.js} +10 -58
  52. package/dist/cli/{mobile-93vaawcz.js → mobile-hpqpy61f.js} +11 -8
  53. package/dist/cli/{prerender-010z771p.js → prerender-w65xp6h8.js} +2 -1
  54. package/dist/cli/{rewriteImports-z6629aww.js → rewriteImports-np2d2kvc.js} +4 -11
  55. package/dist/cli/rewriteImportsPlugin-c6hcb3x6.js +12 -0
  56. package/dist/cli/{start-asxb79rc.js → start-mbn2zgs2.js} +6 -4
  57. package/dist/cli/staticAnalyzeSpaRoutes-2nev05m1.js +8 -0
  58. package/dist/cli/staticAnalyzeSpaRoutes-6vgzp0rs.js +8 -0
  59. package/dist/cli/staticAnalyzeSpaRoutes-f85q9dqk.js +8 -0
  60. package/dist/cli/staticAnalyzeSpaRoutes-yakmg22g.js +7 -0
  61. package/dist/cli/{typecheck-m2j4tkdk.js → typecheck-488txsfc.js} +92 -18
  62. package/dist/cli/vueCompiler-8bzdmf08.js +7 -0
  63. package/dist/client/chunks/{react-khr6ewhr.js → react-g8r290b8.js} +37 -2
  64. package/dist/client/chunks/react-g8r290b8.js.map +10 -0
  65. package/dist/client/chunks/vue-zcpmka32.js +85 -0
  66. package/dist/client/chunks/vue-zcpmka32.js.map +10 -0
  67. package/dist/client/index.js +58 -10
  68. package/dist/client/index.js.map +4 -4
  69. package/dist/dev/client/handlers/vue.ts +116 -0
  70. package/dist/index.js +2472 -2058
  71. package/dist/index.js.map +26 -23
  72. package/dist/islands/browser.js +2 -2
  73. package/dist/islands/browser.js.map +3 -3
  74. package/dist/islands/index.js +2 -2
  75. package/dist/islands/index.js.map +3 -3
  76. package/dist/react/browser.js +2 -2
  77. package/dist/react/browser.js.map +3 -3
  78. package/dist/react/index.js +42 -11
  79. package/dist/react/index.js.map +10 -10
  80. package/dist/react/server.js +42 -11
  81. package/dist/react/server.js.map +10 -10
  82. package/dist/src/angular/ssrRender.d.ts +2 -2
  83. package/dist/src/angular/staticAnalyzeSpaRoutes.d.ts +6 -1
  84. package/dist/src/build/generateManifest.d.ts +15 -0
  85. package/dist/src/build/manifestKeys.d.ts +22 -0
  86. package/dist/src/cli/add/dependencies.d.ts +1 -1
  87. package/dist/src/cli/scripts/typecheck.d.ts +11 -0
  88. package/dist/src/client/hydrators/react.d.ts +10 -0
  89. package/dist/src/client/hydrators/vue.d.ts +13 -0
  90. package/dist/src/client/islandRuntime.d.ts +1 -1
  91. package/dist/src/core/islandManifest.d.ts +4 -0
  92. package/dist/src/core/islandPageContext.d.ts +8 -2
  93. package/dist/src/core/lookup.d.ts +16 -1
  94. package/dist/src/dev/importCost/instrument.d.ts +1 -1
  95. package/dist/src/dev/manifestKeysRefresher.d.ts +6 -0
  96. package/dist/src/dev/spaRouteRefresh.d.ts +13 -0
  97. package/dist/src/mobile/androidConformance.d.ts +1 -1
  98. package/dist/src/react/staticAnalyzeSpaRoutes.d.ts +6 -1
  99. package/dist/src/svelte/staticAnalyzeSpaRoutes.d.ts +1 -0
  100. package/dist/src/utils/logger.d.ts +5 -0
  101. package/dist/src/utils/spaRouteManifest.d.ts +1 -0
  102. package/dist/src/vue/components/Image.d.ts +4 -4
  103. package/dist/src/vue/components/StreamSlot.d.ts +1 -1
  104. package/dist/src/vue/components/SuspenseSlot.d.ts +2 -2
  105. package/dist/src/vue/staticAnalyzeSpaRoutes.d.ts +4 -0
  106. package/dist/svelte/browser.js +2 -2
  107. package/dist/svelte/browser.js.map +3 -3
  108. package/dist/svelte/index.js +25 -9
  109. package/dist/svelte/index.js.map +8 -8
  110. package/dist/svelte/server.js +25 -9
  111. package/dist/svelte/server.js.map +8 -8
  112. package/dist/types/globals.d.ts +4 -0
  113. package/dist/types/index.d.ts +1 -0
  114. package/dist/types/island.d.ts +1 -1
  115. package/dist/types/manifest.d.ts +25 -0
  116. package/dist/vue/browser.js +2 -2
  117. package/dist/vue/browser.js.map +3 -3
  118. package/dist/vue/index.js +21 -6
  119. package/dist/vue/index.js.map +6 -6
  120. package/dist/vue/server.js +21 -6
  121. package/dist/vue/server.js.map +6 -6
  122. package/package.json +1 -1
  123. package/dist/client/chunks/react-khr6ewhr.js.map +0 -10
  124. package/dist/client/chunks/vue-db6ppn1f.js +0 -32
  125. package/dist/client/chunks/vue-db6ppn1f.js.map +0 -10
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ // src/utils/vueCompiler.ts
3
+ var createVueCompiler = async () => {
4
+ const [compiler, typescript] = await Promise.all([
5
+ import("@vue/compiler-sfc"),
6
+ import("typescript")
7
+ ]);
8
+ compiler.registerTS?.(() => typescript);
9
+ return compiler;
10
+ };
11
+ var compilerPromise;
12
+ var loadVueCompiler2 = () => {
13
+ compilerPromise ??= createVueCompiler();
14
+ return compilerPromise;
15
+ };
16
+
17
+ export { loadVueCompiler2 };
@@ -0,0 +1,224 @@
1
+ // @bun
2
+ import {
3
+ lazyTypescript
4
+ } from "./index-4j1twret.js";
5
+
6
+ // src/react/staticAnalyzeSpaRoutes.ts
7
+ import { existsSync, promises as fs } from "fs";
8
+ import { join } from "path";
9
+ var DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
10
+ var pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**");
11
+ var readStringLiteral = (expression) => {
12
+ if (lazyTypescript.isStringLiteral(expression) || lazyTypescript.isNoSubstitutionTemplateLiteral(expression)) {
13
+ return expression.text;
14
+ }
15
+ return null;
16
+ };
17
+ var readPropertyKey = (property) => {
18
+ if (lazyTypescript.isPropertyAssignment(property)) {
19
+ const { name } = property;
20
+ if (lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name))
21
+ return name.text;
22
+ }
23
+ if (lazyTypescript.isShorthandPropertyAssignment(property)) {
24
+ return property.name.text;
25
+ }
26
+ return null;
27
+ };
28
+ var importsSymbolFromAny = (sourceFile, localName, moduleSpecifiers) => {
29
+ for (const statement of sourceFile.statements) {
30
+ if (!lazyTypescript.isImportDeclaration(statement))
31
+ continue;
32
+ if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
33
+ continue;
34
+ if (!moduleSpecifiers.includes(statement.moduleSpecifier.text))
35
+ continue;
36
+ const named = statement.importClause?.namedBindings;
37
+ if (!named || !lazyTypescript.isNamedImports(named))
38
+ continue;
39
+ for (const element of named.elements) {
40
+ if (element.name.text === localName)
41
+ return true;
42
+ }
43
+ }
44
+ return false;
45
+ };
46
+ var findVariableArrayDeclaration = (sourceFile, identifierName) => {
47
+ let found = null;
48
+ const visit = (node) => {
49
+ if (found)
50
+ return;
51
+ if (lazyTypescript.isVariableDeclaration(node) && lazyTypescript.isIdentifier(node.name) && node.name.text === identifierName && node.initializer && lazyTypescript.isArrayLiteralExpression(node.initializer)) {
52
+ found = node.initializer;
53
+ return;
54
+ }
55
+ lazyTypescript.forEachChild(node, visit);
56
+ };
57
+ lazyTypescript.forEachChild(sourceFile, visit);
58
+ return found;
59
+ };
60
+ var joinSegments = (parent, child) => {
61
+ if (!child)
62
+ return parent;
63
+ if (!parent)
64
+ return child;
65
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
66
+ };
67
+ var extractRouteEntries = (routeArray, parentPath, routes) => {
68
+ for (const element of routeArray.elements) {
69
+ if (!lazyTypescript.isObjectLiteralExpression(element))
70
+ continue;
71
+ let pathSegment = null;
72
+ let redirected = false;
73
+ let sitemapExcluded = false;
74
+ let childrenLiteral = null;
75
+ let isIndex = false;
76
+ for (const property of element.properties) {
77
+ const key = readPropertyKey(property);
78
+ if (!key)
79
+ continue;
80
+ if (!lazyTypescript.isPropertyAssignment(property))
81
+ continue;
82
+ if (key === "path") {
83
+ pathSegment = readStringLiteral(property.initializer);
84
+ } else if (key === "index") {
85
+ isIndex = true;
86
+ } else if (key === "loader" || key === "lazy") {} else if (key === "children" && lazyTypescript.isArrayLiteralExpression(property.initializer)) {
87
+ childrenLiteral = property.initializer;
88
+ } else if (key === "redirectTo") {
89
+ redirected = true;
90
+ } else if (key === "handle" && lazyTypescript.isObjectLiteralExpression(property.initializer)) {
91
+ for (const handleProp of property.initializer.properties) {
92
+ const handleKey = readPropertyKey(handleProp);
93
+ if (handleKey !== "sitemap")
94
+ continue;
95
+ if (!lazyTypescript.isPropertyAssignment(handleProp))
96
+ continue;
97
+ const value = readStringLiteral(handleProp.initializer);
98
+ if (value === "exclude")
99
+ sitemapExcluded = true;
100
+ }
101
+ }
102
+ }
103
+ const segment = pathSegment ?? "";
104
+ const joined = joinSegments(parentPath, segment);
105
+ if (childrenLiteral) {
106
+ extractRouteEntries(childrenLiteral, joined, routes);
107
+ continue;
108
+ }
109
+ if (!isIndex && pathSegment === null)
110
+ continue;
111
+ if (joined === "")
112
+ continue;
113
+ routes.push({
114
+ dynamic: pathHasDynamic(joined),
115
+ path: joined,
116
+ redirected,
117
+ sitemapExcluded
118
+ });
119
+ }
120
+ };
121
+ var findCreateBrowserRouterCall = (sourceFile) => {
122
+ const result = { found: null };
123
+ const visit = (node) => {
124
+ if (result.found)
125
+ return;
126
+ if (lazyTypescript.isCallExpression(node) && lazyTypescript.isIdentifier(node.expression) && node.expression.text === "createBrowserRouter") {
127
+ result.found = node;
128
+ return;
129
+ }
130
+ lazyTypescript.forEachChild(node, visit);
131
+ };
132
+ lazyTypescript.forEachChild(sourceFile, visit);
133
+ return result.found;
134
+ };
135
+ var readBasenameFromOptions = (expression) => {
136
+ if (!expression || !lazyTypescript.isObjectLiteralExpression(expression))
137
+ return null;
138
+ for (const property of expression.properties) {
139
+ const key = readPropertyKey(property);
140
+ if (key !== "basename")
141
+ continue;
142
+ if (!lazyTypescript.isPropertyAssignment(property))
143
+ continue;
144
+ const value = readStringLiteral(property.initializer);
145
+ if (value !== null)
146
+ return value;
147
+ }
148
+ return null;
149
+ };
150
+ var analyzeReactSpaRouteFile = async (filePath) => {
151
+ let source;
152
+ try {
153
+ source = await fs.readFile(filePath, "utf-8");
154
+ } catch {
155
+ return null;
156
+ }
157
+ if (!source.includes("createBrowserRouter"))
158
+ return null;
159
+ const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, filePath.endsWith(".tsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS);
160
+ if (!importsSymbolFromAny(sourceFile, "createBrowserRouter", [
161
+ "react-router-dom",
162
+ "react-router"
163
+ ])) {
164
+ return null;
165
+ }
166
+ const call = findCreateBrowserRouterCall(sourceFile);
167
+ if (!call)
168
+ return null;
169
+ const [routesArg] = call.arguments;
170
+ if (!routesArg)
171
+ return null;
172
+ let routesArray = null;
173
+ if (lazyTypescript.isArrayLiteralExpression(routesArg)) {
174
+ routesArray = routesArg;
175
+ } else if (lazyTypescript.isIdentifier(routesArg)) {
176
+ routesArray = findVariableArrayDeclaration(sourceFile, routesArg.text);
177
+ }
178
+ if (!routesArray)
179
+ return null;
180
+ const basename = readBasenameFromOptions(call.arguments[1]);
181
+ const baseHref = basename ? `${basename.replace(/\/+$/, "")}/` : "/";
182
+ const routes = [];
183
+ extractRouteEntries(routesArray, "", routes);
184
+ return { baseHref, routes, sourceFile: filePath };
185
+ };
186
+ var walkSourceFiles = async (dir, files) => {
187
+ let items;
188
+ try {
189
+ items = await fs.readdir(dir, { withFileTypes: true });
190
+ } catch {
191
+ return;
192
+ }
193
+ const directories = [];
194
+ for (const item of items) {
195
+ if (item.name === "node_modules" || item.name.startsWith("."))
196
+ continue;
197
+ const full = join(dir, item.name);
198
+ if (item.isDirectory()) {
199
+ directories.push(full);
200
+ } else if (item.isFile() && (item.name.endsWith(".tsx") || item.name.endsWith(".ts") || item.name.endsWith(".jsx") || item.name.endsWith(".js")) && !item.name.endsWith(".d.ts")) {
201
+ files.push(full);
202
+ }
203
+ }
204
+ await Promise.all(directories.map((directory) => walkSourceFiles(directory, files)));
205
+ };
206
+ var analyzeReactSpaRoutes2 = async (reactDirectory) => {
207
+ if (!existsSync(reactDirectory))
208
+ return [];
209
+ const files = [];
210
+ await walkSourceFiles(reactDirectory, files);
211
+ const hosts = [];
212
+ await Promise.all(files.map(async (file) => {
213
+ try {
214
+ const host = await analyzeReactSpaRouteFile(file);
215
+ if (host)
216
+ hosts.push(host);
217
+ } catch (err) {
218
+ console.warn(`[sitemap] React SPA analysis failed for ${file}:`, err);
219
+ }
220
+ }));
221
+ return hosts;
222
+ };
223
+
224
+ export { analyzeReactSpaRoutes2 };
@@ -1,295 +1,21 @@
1
1
  // @bun
2
+ import {
3
+ normalizeAbsoluteMobileConfig2
4
+ } from "./index-t7yf3vxs.js";
2
5
  import {
3
6
  lazyTypescript
4
7
  } from "./index-4j1twret.js";
5
8
  import {
6
- normalizeAbsoluteMobileConfig2
7
- } from "./index-t7yf3vxs.js";
9
+ assertAbsoluteDeviceCapabilityPackages
10
+ } from "./index-ycqdxy55.js";
8
11
  import {
9
- assertAbsoluteDeviceCapabilityPackages,
10
12
  resolveAbsoluteMobileUpdateRuntime,
11
13
  writeAbsoluteExpoProject2,
12
14
  syncAbsoluteExpoWebAssets2
13
- } from "./index-cksezef8.js";
15
+ } from "./index-0gd30trc.js";
14
16
  import {
15
17
  toPascal
16
- } from "./index-92g14j47.js";
17
-
18
- // src/build/islandRegistryTransform.ts
19
- import { basename } from "path";
20
- var VALID_FRAMEWORKS = [
21
- "react",
22
- "svelte",
23
- "vue",
24
- "angular"
25
- ];
26
- var getObjectPropertyName = (name) => lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name) ? name.text : null;
27
- var isIslandRegistryHelperImport = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands");
28
- var collectRegistryFactory = (sourceFile) => {
29
- const factoryNames = new Set;
30
- const namespaceNames = new Set;
31
- for (const statement of sourceFile.statements) {
32
- if (!lazyTypescript.isImportDeclaration(statement))
33
- continue;
34
- if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
35
- continue;
36
- if (!isIslandRegistryHelperImport(statement.moduleSpecifier.text))
37
- continue;
38
- const bindings = statement.importClause?.namedBindings;
39
- if (!bindings)
40
- continue;
41
- if (lazyTypescript.isNamespaceImport(bindings)) {
42
- namespaceNames.add(bindings.name.text);
43
- continue;
44
- }
45
- if (!lazyTypescript.isNamedImports(bindings))
46
- continue;
47
- for (const element of bindings.elements) {
48
- const imported = element.propertyName?.text ?? element.name.text;
49
- if (imported === "defineIslandRegistry") {
50
- factoryNames.add(element.name.text);
51
- }
52
- }
53
- }
54
- return { factoryNames, namespaceNames };
55
- };
56
- var isDefineIslandRegistryCall = (expression, factoryNames, namespaceNames) => {
57
- if (lazyTypescript.isIdentifier(expression))
58
- return factoryNames.has(expression.text);
59
- return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && namespaceNames.has(expression.expression.text);
60
- };
61
- var findDefineIslandRegistryCall = (sourceFile, factoryNames, namespaceNames) => {
62
- let found = null;
63
- const visit = (node) => {
64
- if (found)
65
- return;
66
- const [firstArg] = lazyTypescript.isCallExpression(node) ? node.arguments : [];
67
- if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, factoryNames, namespaceNames) && firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
68
- found = node;
69
- return;
70
- }
71
- lazyTypescript.forEachChild(node, visit);
72
- };
73
- visit(sourceFile);
74
- return found;
75
- };
76
- var quoteKey = (key) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(key);
77
- var definitionLiteral = (reference) => {
78
- const exportPart = reference.export ? `, export: ${JSON.stringify(reference.export)}` : "";
79
- return `{ component: null, source: ${JSON.stringify(reference.source)}${exportPart} }`;
80
- };
81
- var transformIslandRegistrySource = (source, filePath, info) => {
82
- if (!source.includes("defineIslandRegistry"))
83
- return null;
84
- const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS;
85
- const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, scriptKind);
86
- const { factoryNames, namespaceNames } = collectRegistryFactory(sourceFile);
87
- if (factoryNames.size === 0 && namespaceNames.size === 0)
88
- return null;
89
- const call = findDefineIslandRegistryCall(sourceFile, factoryNames, namespaceNames);
90
- if (!call)
91
- return null;
92
- const [objectLiteral] = call.arguments;
93
- if (!objectLiteral || !lazyTypescript.isObjectLiteralExpression(objectLiteral)) {
94
- return null;
95
- }
96
- const definitionLookup = new Map;
97
- for (const definition of info.definitions) {
98
- if (!definition.buildReference)
99
- continue;
100
- definitionLookup.set(`${definition.framework}:${definition.component}`, {
101
- export: definition.buildReference.export,
102
- source: definition.buildReference.source
103
- });
104
- }
105
- const edits = [];
106
- const replacedLocals = new Set;
107
- for (const frameworkProperty of objectLiteral.properties) {
108
- if (!lazyTypescript.isPropertyAssignment(frameworkProperty))
109
- continue;
110
- const frameworkName = getObjectPropertyName(frameworkProperty.name);
111
- const framework = VALID_FRAMEWORKS.find((f) => f === frameworkName);
112
- if (!framework)
113
- continue;
114
- if (!lazyTypescript.isObjectLiteralExpression(frameworkProperty.initializer))
115
- continue;
116
- for (const componentProperty of frameworkProperty.initializer.properties) {
117
- let componentKey = null;
118
- let localName = null;
119
- let replaceNode = null;
120
- let replacementText = "";
121
- if (lazyTypescript.isShorthandPropertyAssignment(componentProperty)) {
122
- componentKey = componentProperty.name.text;
123
- localName = componentProperty.name.text;
124
- const reference = definitionLookup.get(`${framework}:${componentKey}`);
125
- if (!reference)
126
- continue;
127
- replaceNode = componentProperty;
128
- replacementText = `${quoteKey(componentKey)}: ${definitionLiteral(reference)}`;
129
- } else if (lazyTypescript.isPropertyAssignment(componentProperty) && lazyTypescript.isIdentifier(componentProperty.initializer)) {
130
- componentKey = getObjectPropertyName(componentProperty.name);
131
- localName = componentProperty.initializer.text;
132
- if (!componentKey)
133
- continue;
134
- const reference = definitionLookup.get(`${framework}:${componentKey}`);
135
- if (!reference)
136
- continue;
137
- replaceNode = componentProperty.initializer;
138
- replacementText = definitionLiteral(reference);
139
- } else {
140
- continue;
141
- }
142
- edits.push({
143
- end: replaceNode.getEnd(),
144
- start: replaceNode.getStart(sourceFile),
145
- text: replacementText
146
- });
147
- replacedLocals.add(localName);
148
- }
149
- }
150
- if (edits.length === 0)
151
- return null;
152
- for (const statement of sourceFile.statements) {
153
- if (!lazyTypescript.isImportDeclaration(statement))
154
- continue;
155
- const clause = statement.importClause;
156
- if (!clause)
157
- continue;
158
- const localNames = [];
159
- if (clause.name)
160
- localNames.push(clause.name.text);
161
- const bindings = clause.namedBindings;
162
- if (bindings && lazyTypescript.isNamedImports(bindings)) {
163
- for (const element of bindings.elements) {
164
- localNames.push(element.name.text);
165
- }
166
- } else if (bindings && lazyTypescript.isNamespaceImport(bindings)) {
167
- localNames.push(bindings.name.text);
168
- }
169
- if (localNames.length === 0)
170
- continue;
171
- if (localNames.every((name) => replacedLocals.has(name))) {
172
- edits.push({
173
- end: statement.getEnd(),
174
- start: statement.getStart(sourceFile),
175
- text: ""
176
- });
177
- }
178
- }
179
- edits.sort((a, b) => b.start - a.start);
180
- let output = source;
181
- for (const edit of edits) {
182
- output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);
183
- }
184
- return output;
185
- };
186
- var escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
187
- var loaderForPath = (filePath) => {
188
- if (filePath.endsWith(".tsx"))
189
- return "tsx";
190
- if (filePath.endsWith(".jsx"))
191
- return "jsx";
192
- if (filePath.endsWith(".js") || filePath.endsWith(".mjs") || filePath.endsWith(".cjs")) {
193
- return "js";
194
- }
195
- return "ts";
196
- };
197
- var createIslandRegistryDefinitionPlugin = (info) => {
198
- const registryBase = basename(info.resolvedRegistryPath).replace(/\.[mc]?[jt]sx?$/, "");
199
- const filter = new RegExp(`(^|[/\\\\])${escapeRegExp(registryBase)}\\.[mc]?[jt]sx?$`);
200
- return {
201
- name: "absolute-island-registry-definitions",
202
- setup(build) {
203
- build.onLoad({ filter }, async (args) => {
204
- const source = await Bun.file(args.path).text();
205
- const transformed = transformIslandRegistrySource(source, args.path, info);
206
- if (transformed === null)
207
- return;
208
- return {
209
- contents: transformed,
210
- loader: loaderForPath(args.path)
211
- };
212
- });
213
- }
214
- };
215
- };
216
-
217
- // src/build/bunStringRawUnicodePlugin.ts
218
- import { extname } from "path";
219
- var NON_ASCII = /[^\x00-\x7f]/;
220
- var getScriptKind = (filePath) => {
221
- if (/\.[cm]?tsx$/.test(filePath))
222
- return lazyTypescript.ScriptKind.TSX;
223
- if (/\.[cm]?jsx$/.test(filePath))
224
- return lazyTypescript.ScriptKind.JSX;
225
- if (/\.[cm]?ts$/.test(filePath))
226
- return lazyTypescript.ScriptKind.TS;
227
- return lazyTypescript.ScriptKind.JS;
228
- };
229
- var getLoader = (filePath) => {
230
- const extension = extname(filePath);
231
- if (extension === ".tsx")
232
- return "tsx";
233
- if (extension === ".jsx")
234
- return "jsx";
235
- if (extension === ".ts" || extension === ".mts" || extension === ".cts") {
236
- return "ts";
237
- }
238
- return "js";
239
- };
240
- var isStringRawTag = (node) => lazyTypescript.isPropertyAccessExpression(node.tag) && lazyTypescript.isIdentifier(node.tag.expression) && node.tag.expression.text === "String" && node.tag.name.text === "raw";
241
- var getRawText = (node) => node.rawText ?? node.text;
242
- var rewriteBunStringRawUnicode = (source, filePath = "input.ts") => {
243
- if (!source.includes("String.raw") || !NON_ASCII.test(source))
244
- return source;
245
- const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind(filePath));
246
- const replacements = [];
247
- const visit = (node) => {
248
- if (lazyTypescript.isTaggedTemplateExpression(node) && isStringRawTag(node)) {
249
- const rawSegments = lazyTypescript.isNoSubstitutionTemplateLiteral(node.template) ? [getRawText(node.template)] : [
250
- getRawText(node.template.head),
251
- ...node.template.templateSpans.map((span) => getRawText(span.literal))
252
- ];
253
- if (rawSegments.some((segment) => NON_ASCII.test(segment))) {
254
- const expressions = lazyTypescript.isTemplateExpression(node.template) ? node.template.templateSpans.map((span) => {
255
- const expression = source.slice(span.expression.getStart(sourceFile), span.expression.end);
256
- return rewriteBunStringRawUnicode(expression, filePath);
257
- }) : [];
258
- const args = [
259
- `{ raw: [${rawSegments.map((text) => JSON.stringify(text)).join(", ")}] }`,
260
- ...expressions
261
- ];
262
- replacements.push({
263
- end: node.end,
264
- start: node.getStart(sourceFile),
265
- value: `String.raw(${args.join(", ")})`
266
- });
267
- return;
268
- }
269
- }
270
- lazyTypescript.forEachChild(node, visit);
271
- };
272
- visit(sourceFile);
273
- let result = source;
274
- for (const replacement of replacements.sort((a, b) => b.start - a.start)) {
275
- result = result.slice(0, replacement.start) + replacement.value + result.slice(replacement.end);
276
- }
277
- return result;
278
- };
279
- var createBunStringRawUnicodePlugin = () => ({
280
- name: "absolute-bun-string-raw-unicode",
281
- setup(build) {
282
- build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
283
- if (args.path.includes("/node_modules/"))
284
- return;
285
- const source = await Bun.file(args.path).text();
286
- const contents = rewriteBunStringRawUnicode(source, args.path);
287
- if (contents === source)
288
- return;
289
- return { contents, loader: getLoader(args.path) };
290
- });
291
- }
292
- });
18
+ } from "./index-dw44xa4x.js";
293
19
 
294
20
  // src/mobile/buildPipeline.ts
295
21
  import { readFile as readFile4 } from "fs/promises";
@@ -669,7 +395,7 @@ var verifyAbsoluteMobileCompatibilityProducer = async (release, maxProducerBytes
669
395
  // src/mobile/buildRelease.ts
670
396
  import { createHash as createHash3 } from "crypto";
671
397
  import { mkdir, readFile, writeFile } from "fs/promises";
672
- import { basename as basename2, dirname, extname as extname2, join, relative, resolve } from "path";
398
+ import { basename, dirname, extname, join, relative, resolve } from "path";
673
399
 
674
400
  // src/mobile/buildMetadata.ts
675
401
  var ABSOLUTE_MOBILE_ROUTE_DETAIL = "x-absolute-mobile";
@@ -705,7 +431,7 @@ var STATIC_SCRIPT_PATTERN = /(<script\b[^>]*?\bsrc\s*=\s*["'])(\/[^"']+\.(?:js|t
705
431
  var rewriteStaticScriptPaths = (source, manifest) => source.replace(STATIC_SCRIPT_PATTERN, (match, prefix, path, suffix) => {
706
432
  if (path.endsWith("/htmx.min.js"))
707
433
  return match;
708
- const key = toPascal(basename2(path, extname2(path)));
434
+ const key = toPascal(basename(path, extname(path)));
709
435
  const builtPath = manifest[key];
710
436
  return builtPath ? `${prefix}${builtPath}${suffix}` : match;
711
437
  });
@@ -859,7 +585,7 @@ import {
859
585
  writeFile as writeFile2
860
586
  } from "fs/promises";
861
587
  import { existsSync } from "fs";
862
- import { basename as basename3, dirname as dirname2, extname as extname3, join as join2, relative as relative2, resolve as resolve2 } from "path";
588
+ import { basename as basename2, dirname as dirname2, extname as extname2, join as join2, relative as relative2, resolve as resolve2 } from "path";
863
589
 
864
590
  // src/mobile/routeMatcher.ts
865
591
  var REGEXP_SPECIAL_CHARACTERS = /[.*+?^${}()|[\]\\]/g;
@@ -1127,14 +853,14 @@ var copyClientPage = async (page, buildDirectory, staging, copiedDependencies) =
1127
853
  if (!CAPACITOR_CLIENT_FRAMEWORKS.has(page.framework)) {
1128
854
  throw new TypeError(`Capacitor client rendering does not yet support ${page.framework} page ${page.pageId}.`);
1129
855
  }
1130
- const extension = extname3(page.bundlePath) || ".js";
856
+ const extension = extname2(page.bundlePath) || ".js";
1131
857
  const localBundlePath = `./pages/${page.bundleHash}${extension}`;
1132
858
  const source = sourceAssetPath(buildDirectory, page.bundlePath);
1133
859
  await copyFile(source, join2(staging, localBundlePath));
1134
860
  await copyAbsoluteClientDependencies(source, buildDirectory, staging, copiedDependencies);
1135
861
  let localStylePath;
1136
862
  if (page.styleBundlePath && page.styleBundleHash) {
1137
- const styleExtension = extname3(page.styleBundlePath) || ".css";
863
+ const styleExtension = extname2(page.styleBundlePath) || ".css";
1138
864
  localStylePath = `./styles/${page.styleBundleHash}${styleExtension}`;
1139
865
  const styleSource = sourceAssetPath(buildDirectory, page.styleBundlePath);
1140
866
  await mkdir2(dirname2(join2(staging, localStylePath)), {
@@ -1160,13 +886,13 @@ var materializeAbsoluteMobileSourcemaps = async (pages, appBuild, projectRoot) =
1160
886
  const releaseRoot = join2(privateRoot, "mobile", release);
1161
887
  const copied = [];
1162
888
  const available = pages.flatMap((page) => {
1163
- const source = join2(privateRoot, `${basename3(page.bundlePath)}.map`);
889
+ const source = join2(privateRoot, `${basename2(page.bundlePath)}.map`);
1164
890
  return existsSync(source) ? [{ page, source }] : [];
1165
891
  });
1166
892
  if (available.length > 0)
1167
893
  await mkdir2(releaseRoot, { recursive: true });
1168
894
  await Promise.all(available.map(async ({ page, source }) => {
1169
- const extension = extname3(page.bundlePath) || ".js";
895
+ const extension = extname2(page.bundlePath) || ".js";
1170
896
  if (!/^\.[a-z0-9]+$/iu.test(extension))
1171
897
  throw new TypeError("Mobile page extension is not a safe source-map key.");
1172
898
  const bundleHash = safeLeaf(page.bundleHash, "Mobile page bundle hash");
@@ -1186,7 +912,7 @@ var materializeAbsoluteMobileSourcemaps = async (pages, appBuild, projectRoot) =
1186
912
  };
1187
913
  var absoluteClientImports = async (sourcePath, buildDirectory) => {
1188
914
  const source = await readFile2(sourcePath, "utf8");
1189
- const extension = extname3(sourcePath).toLowerCase();
915
+ const extension = extname2(sourcePath).toLowerCase();
1190
916
  let scriptLoader;
1191
917
  if (extension === ".tsx")
1192
918
  scriptLoader = "tsx";
@@ -1237,7 +963,7 @@ var materializeAbsoluteCapacitorWebBundle = async (options) => {
1237
963
  }
1238
964
  const destination = options.config.bundleDirectory;
1239
965
  await mkdir2(dirname2(destination), { recursive: true });
1240
- const staging = await mkdtemp(join2(dirname2(destination), `.${basename3(destination)}.stage-`));
966
+ const staging = await mkdtemp(join2(dirname2(destination), `.${basename2(destination)}.stage-`));
1241
967
  try {
1242
968
  const pageDirectory = join2(staging, "pages");
1243
969
  await mkdir2(pageDirectory, { recursive: true });
@@ -1567,7 +1293,7 @@ var finalizeAbsoluteMobileCompatibilityBuild = async (options) => {
1567
1293
 
1568
1294
  // src/mobile/routeMetadataTransform.ts
1569
1295
  import { existsSync as existsSync2, readFileSync } from "fs";
1570
- import { dirname as dirname4, extname as extname4, relative as relative3, resolve as resolve4 } from "path";
1296
+ import { dirname as dirname4, extname as extname3, relative as relative3, resolve as resolve4 } from "path";
1571
1297
  var ROUTE_METHODS = new Set(["get", "head"]);
1572
1298
  var SOURCE_FILTER = /\.[cm]?[jt]sx?$/;
1573
1299
  var PAGE_HANDLERS = new Map([
@@ -2079,7 +1805,7 @@ var createAbsoluteMobileRouteMetadataPlugin = (options) => {
2079
1805
  const source = await Bun.file(path).text();
2080
1806
  return {
2081
1807
  contents: transformFile(source, path, analysis),
2082
- loader: extname4(path).endsWith("x") ? "tsx" : "ts"
1808
+ loader: extname3(path).endsWith("x") ? "tsx" : "ts"
2083
1809
  };
2084
1810
  });
2085
1811
  }
@@ -2154,14 +1880,14 @@ var collectOptionalPeers = (projectRoot) => {
2154
1880
  ...new Set(Object.keys(app?.dependencies ?? {}).flatMap((dependency) => Object.entries(readManifest(join5(projectRoot, "node_modules", dependency, "package.json"))?.peerDependenciesMeta ?? {}).filter(([, meta]) => meta.optional === true).map(([peer]) => peer)))
2155
1881
  ];
2156
1882
  };
2157
- var escapeRegExp2 = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1883
+ var escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2158
1884
  var createOptionalPeerPlugin = (projectRoot = process.cwd()) => ({
2159
1885
  name: "absolute-optional-peers",
2160
1886
  setup(build) {
2161
1887
  const peers = collectOptionalPeers(projectRoot);
2162
1888
  if (peers.length === 0)
2163
1889
  return;
2164
- const filter = new RegExp(`^(?:${peers.map(escapeRegExp2).join("|")})(?:/.*)?$`);
1890
+ const filter = new RegExp(`^(?:${peers.map(escapeRegExp).join("|")})(?:/.*)?$`);
2165
1891
  build.onResolve({ filter }, (args) => {
2166
1892
  const from = args.importer ? dirname6(args.importer) : projectRoot;
2167
1893
  try {
@@ -2186,4 +1912,4 @@ var resolveServerBundleExternals = (buildConfig) => [
2186
1912
  ...collectUserServerExternals(buildConfig)
2187
1913
  ];
2188
1914
 
2189
- export { createIslandRegistryDefinitionPlugin, createBunStringRawUnicodePlugin, resolveAbsoluteMobileRoute, ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION, ABSOLUTE_MOBILE_CLIENT_MANIFEST_FORMAT, finalizeAbsoluteMobileCompatibilityBuild, createAbsoluteMobileRouteMetadataPlugin, createElysiaOpenApiTypeboxPlugin, createOptionalPeerPlugin, resolveServerBundleExternals };
1915
+ export { resolveAbsoluteMobileRoute, ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION, ABSOLUTE_MOBILE_CLIENT_MANIFEST_FORMAT, finalizeAbsoluteMobileCompatibilityBuild, createAbsoluteMobileRouteMetadataPlugin, createElysiaOpenApiTypeboxPlugin, createOptionalPeerPlugin, resolveServerBundleExternals };
@@ -345,4 +345,4 @@ var rewriteContentSpecifiers = (content, rewriter, options) => {
345
345
  };
346
346
  var rewriteSpecifiers = (masked, rewriter, options) => masked.replace(options.sweep ? rewriter.unionRegex : rewriter.mainRegex, replaceSpecifier(rewriter.lookup));
347
347
 
348
- export { maskLiterals, compileSpecifierRewriter, rewriteContentSpecifiers };
348
+ export { SENTINEL, maskLiterals, compileSpecifierRewriter, rewriteContentSpecifiers };