@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,40 @@
1
+ // @bun
2
+ // src/build/externalAssetPlugin.ts
3
+ import { copyFileSync, existsSync, mkdirSync, statSync } from "fs";
4
+ import { basename, dirname, join, resolve } from "path";
5
+ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
6
+ name: "absolute-external-asset",
7
+ setup(bld) {
8
+ const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
9
+ const skipRoots = userSourceRoots.map((root) => resolve(root));
10
+ const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
11
+ bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
12
+ if (isUserSource(args.path))
13
+ return;
14
+ const source = await Bun.file(args.path).text();
15
+ if (!source.includes("import.meta.url"))
16
+ return;
17
+ urlPattern.lastIndex = 0;
18
+ let match;
19
+ const sourceDir = dirname(args.path);
20
+ while ((match = urlPattern.exec(source)) !== null) {
21
+ const relPath = match[1];
22
+ if (!relPath)
23
+ continue;
24
+ const assetPath = resolve(sourceDir, relPath);
25
+ if (!existsSync(assetPath))
26
+ continue;
27
+ if (!statSync(assetPath).isFile())
28
+ continue;
29
+ const targetPath = join(outDir, basename(assetPath));
30
+ if (existsSync(targetPath))
31
+ continue;
32
+ mkdirSync(dirname(targetPath), { recursive: true });
33
+ copyFileSync(assetPath, targetPath);
34
+ }
35
+ return;
36
+ });
37
+ }
38
+ });
39
+
40
+ export { createExternalAssetPlugin };
@@ -0,0 +1,282 @@
1
+ // @bun
2
+ import {
3
+ lazyTypescript
4
+ } from "./index-4j1twret.js";
5
+
6
+ // src/build/islandRegistryTransform.ts
7
+ import { basename } from "path";
8
+ var VALID_FRAMEWORKS = [
9
+ "react",
10
+ "svelte",
11
+ "vue",
12
+ "angular"
13
+ ];
14
+ var getObjectPropertyName = (name) => lazyTypescript.isIdentifier(name) || lazyTypescript.isStringLiteral(name) ? name.text : null;
15
+ var isIslandRegistryHelperImport = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands");
16
+ var collectRegistryFactory = (sourceFile) => {
17
+ const factoryNames = new Set;
18
+ const namespaceNames = new Set;
19
+ for (const statement of sourceFile.statements) {
20
+ if (!lazyTypescript.isImportDeclaration(statement))
21
+ continue;
22
+ if (!lazyTypescript.isStringLiteral(statement.moduleSpecifier))
23
+ continue;
24
+ if (!isIslandRegistryHelperImport(statement.moduleSpecifier.text))
25
+ continue;
26
+ const bindings = statement.importClause?.namedBindings;
27
+ if (!bindings)
28
+ continue;
29
+ if (lazyTypescript.isNamespaceImport(bindings)) {
30
+ namespaceNames.add(bindings.name.text);
31
+ continue;
32
+ }
33
+ if (!lazyTypescript.isNamedImports(bindings))
34
+ continue;
35
+ for (const element of bindings.elements) {
36
+ const imported = element.propertyName?.text ?? element.name.text;
37
+ if (imported === "defineIslandRegistry") {
38
+ factoryNames.add(element.name.text);
39
+ }
40
+ }
41
+ }
42
+ return { factoryNames, namespaceNames };
43
+ };
44
+ var isDefineIslandRegistryCall = (expression, factoryNames, namespaceNames) => {
45
+ if (lazyTypescript.isIdentifier(expression))
46
+ return factoryNames.has(expression.text);
47
+ return lazyTypescript.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && lazyTypescript.isIdentifier(expression.expression) && namespaceNames.has(expression.expression.text);
48
+ };
49
+ var findDefineIslandRegistryCall = (sourceFile, factoryNames, namespaceNames) => {
50
+ let found = null;
51
+ const visit = (node) => {
52
+ if (found)
53
+ return;
54
+ const [firstArg] = lazyTypescript.isCallExpression(node) ? node.arguments : [];
55
+ if (lazyTypescript.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, factoryNames, namespaceNames) && firstArg && lazyTypescript.isObjectLiteralExpression(firstArg)) {
56
+ found = node;
57
+ return;
58
+ }
59
+ lazyTypescript.forEachChild(node, visit);
60
+ };
61
+ visit(sourceFile);
62
+ return found;
63
+ };
64
+ var quoteKey = (key) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key) ? key : JSON.stringify(key);
65
+ var definitionLiteral = (reference) => {
66
+ const exportPart = reference.export ? `, export: ${JSON.stringify(reference.export)}` : "";
67
+ return `{ component: null, source: ${JSON.stringify(reference.source)}${exportPart} }`;
68
+ };
69
+ var transformIslandRegistrySource = (source, filePath, info) => {
70
+ if (!source.includes("defineIslandRegistry"))
71
+ return null;
72
+ const scriptKind = filePath.endsWith(".tsx") || filePath.endsWith(".jsx") ? lazyTypescript.ScriptKind.TSX : lazyTypescript.ScriptKind.TS;
73
+ const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, scriptKind);
74
+ const { factoryNames, namespaceNames } = collectRegistryFactory(sourceFile);
75
+ if (factoryNames.size === 0 && namespaceNames.size === 0)
76
+ return null;
77
+ const call = findDefineIslandRegistryCall(sourceFile, factoryNames, namespaceNames);
78
+ if (!call)
79
+ return null;
80
+ const [objectLiteral] = call.arguments;
81
+ if (!objectLiteral || !lazyTypescript.isObjectLiteralExpression(objectLiteral)) {
82
+ return null;
83
+ }
84
+ const definitionLookup = new Map;
85
+ for (const definition of info.definitions) {
86
+ if (!definition.buildReference)
87
+ continue;
88
+ definitionLookup.set(`${definition.framework}:${definition.component}`, {
89
+ export: definition.buildReference.export,
90
+ source: definition.buildReference.source
91
+ });
92
+ }
93
+ const edits = [];
94
+ const replacedLocals = new Set;
95
+ for (const frameworkProperty of objectLiteral.properties) {
96
+ if (!lazyTypescript.isPropertyAssignment(frameworkProperty))
97
+ continue;
98
+ const frameworkName = getObjectPropertyName(frameworkProperty.name);
99
+ const framework = VALID_FRAMEWORKS.find((f) => f === frameworkName);
100
+ if (!framework)
101
+ continue;
102
+ if (!lazyTypescript.isObjectLiteralExpression(frameworkProperty.initializer))
103
+ continue;
104
+ for (const componentProperty of frameworkProperty.initializer.properties) {
105
+ let componentKey = null;
106
+ let localName = null;
107
+ let replaceNode = null;
108
+ let replacementText = "";
109
+ if (lazyTypescript.isShorthandPropertyAssignment(componentProperty)) {
110
+ componentKey = componentProperty.name.text;
111
+ localName = componentProperty.name.text;
112
+ const reference = definitionLookup.get(`${framework}:${componentKey}`);
113
+ if (!reference)
114
+ continue;
115
+ replaceNode = componentProperty;
116
+ replacementText = `${quoteKey(componentKey)}: ${definitionLiteral(reference)}`;
117
+ } else if (lazyTypescript.isPropertyAssignment(componentProperty) && lazyTypescript.isIdentifier(componentProperty.initializer)) {
118
+ componentKey = getObjectPropertyName(componentProperty.name);
119
+ localName = componentProperty.initializer.text;
120
+ if (!componentKey)
121
+ continue;
122
+ const reference = definitionLookup.get(`${framework}:${componentKey}`);
123
+ if (!reference)
124
+ continue;
125
+ replaceNode = componentProperty.initializer;
126
+ replacementText = definitionLiteral(reference);
127
+ } else {
128
+ continue;
129
+ }
130
+ edits.push({
131
+ end: replaceNode.getEnd(),
132
+ start: replaceNode.getStart(sourceFile),
133
+ text: replacementText
134
+ });
135
+ replacedLocals.add(localName);
136
+ }
137
+ }
138
+ if (edits.length === 0)
139
+ return null;
140
+ for (const statement of sourceFile.statements) {
141
+ if (!lazyTypescript.isImportDeclaration(statement))
142
+ continue;
143
+ const clause = statement.importClause;
144
+ if (!clause)
145
+ continue;
146
+ const localNames = [];
147
+ if (clause.name)
148
+ localNames.push(clause.name.text);
149
+ const bindings = clause.namedBindings;
150
+ if (bindings && lazyTypescript.isNamedImports(bindings)) {
151
+ for (const element of bindings.elements) {
152
+ localNames.push(element.name.text);
153
+ }
154
+ } else if (bindings && lazyTypescript.isNamespaceImport(bindings)) {
155
+ localNames.push(bindings.name.text);
156
+ }
157
+ if (localNames.length === 0)
158
+ continue;
159
+ if (localNames.every((name) => replacedLocals.has(name))) {
160
+ edits.push({
161
+ end: statement.getEnd(),
162
+ start: statement.getStart(sourceFile),
163
+ text: ""
164
+ });
165
+ }
166
+ }
167
+ edits.sort((a, b) => b.start - a.start);
168
+ let output = source;
169
+ for (const edit of edits) {
170
+ output = output.slice(0, edit.start) + edit.text + output.slice(edit.end);
171
+ }
172
+ return output;
173
+ };
174
+ var escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
175
+ var loaderForPath = (filePath) => {
176
+ if (filePath.endsWith(".tsx"))
177
+ return "tsx";
178
+ if (filePath.endsWith(".jsx"))
179
+ return "jsx";
180
+ if (filePath.endsWith(".js") || filePath.endsWith(".mjs") || filePath.endsWith(".cjs")) {
181
+ return "js";
182
+ }
183
+ return "ts";
184
+ };
185
+ var createIslandRegistryDefinitionPlugin = (info) => {
186
+ const registryBase = basename(info.resolvedRegistryPath).replace(/\.[mc]?[jt]sx?$/, "");
187
+ const filter = new RegExp(`(^|[/\\\\])${escapeRegExp(registryBase)}\\.[mc]?[jt]sx?$`);
188
+ return {
189
+ name: "absolute-island-registry-definitions",
190
+ setup(build) {
191
+ build.onLoad({ filter }, async (args) => {
192
+ const source = await Bun.file(args.path).text();
193
+ const transformed = transformIslandRegistrySource(source, args.path, info);
194
+ if (transformed === null)
195
+ return;
196
+ return {
197
+ contents: transformed,
198
+ loader: loaderForPath(args.path)
199
+ };
200
+ });
201
+ }
202
+ };
203
+ };
204
+
205
+ // src/build/bunStringRawUnicodePlugin.ts
206
+ import { extname } from "path";
207
+ var NON_ASCII = /[^\x00-\x7f]/;
208
+ var getScriptKind = (filePath) => {
209
+ if (/\.[cm]?tsx$/.test(filePath))
210
+ return lazyTypescript.ScriptKind.TSX;
211
+ if (/\.[cm]?jsx$/.test(filePath))
212
+ return lazyTypescript.ScriptKind.JSX;
213
+ if (/\.[cm]?ts$/.test(filePath))
214
+ return lazyTypescript.ScriptKind.TS;
215
+ return lazyTypescript.ScriptKind.JS;
216
+ };
217
+ var getLoader = (filePath) => {
218
+ const extension = extname(filePath);
219
+ if (extension === ".tsx")
220
+ return "tsx";
221
+ if (extension === ".jsx")
222
+ return "jsx";
223
+ if (extension === ".ts" || extension === ".mts" || extension === ".cts") {
224
+ return "ts";
225
+ }
226
+ return "js";
227
+ };
228
+ var isStringRawTag = (node) => lazyTypescript.isPropertyAccessExpression(node.tag) && lazyTypescript.isIdentifier(node.tag.expression) && node.tag.expression.text === "String" && node.tag.name.text === "raw";
229
+ var getRawText = (node) => node.rawText ?? node.text;
230
+ var rewriteBunStringRawUnicode = (source, filePath = "input.ts") => {
231
+ if (!source.includes("String.raw") || !NON_ASCII.test(source))
232
+ return source;
233
+ const sourceFile = lazyTypescript.createSourceFile(filePath, source, lazyTypescript.ScriptTarget.Latest, true, getScriptKind(filePath));
234
+ const replacements = [];
235
+ const visit = (node) => {
236
+ if (lazyTypescript.isTaggedTemplateExpression(node) && isStringRawTag(node)) {
237
+ const rawSegments = lazyTypescript.isNoSubstitutionTemplateLiteral(node.template) ? [getRawText(node.template)] : [
238
+ getRawText(node.template.head),
239
+ ...node.template.templateSpans.map((span) => getRawText(span.literal))
240
+ ];
241
+ if (rawSegments.some((segment) => NON_ASCII.test(segment))) {
242
+ const expressions = lazyTypescript.isTemplateExpression(node.template) ? node.template.templateSpans.map((span) => {
243
+ const expression = source.slice(span.expression.getStart(sourceFile), span.expression.end);
244
+ return rewriteBunStringRawUnicode(expression, filePath);
245
+ }) : [];
246
+ const args = [
247
+ `{ raw: [${rawSegments.map((text) => JSON.stringify(text)).join(", ")}] }`,
248
+ ...expressions
249
+ ];
250
+ replacements.push({
251
+ end: node.end,
252
+ start: node.getStart(sourceFile),
253
+ value: `String.raw(${args.join(", ")})`
254
+ });
255
+ return;
256
+ }
257
+ }
258
+ lazyTypescript.forEachChild(node, visit);
259
+ };
260
+ visit(sourceFile);
261
+ let result = source;
262
+ for (const replacement of replacements.sort((a, b) => b.start - a.start)) {
263
+ result = result.slice(0, replacement.start) + replacement.value + result.slice(replacement.end);
264
+ }
265
+ return result;
266
+ };
267
+ var createBunStringRawUnicodePlugin = () => ({
268
+ name: "absolute-bun-string-raw-unicode",
269
+ setup(build) {
270
+ build.onLoad({ filter: /\.[cm]?[jt]sx?$/ }, async (args) => {
271
+ if (args.path.includes("/node_modules/"))
272
+ return;
273
+ const source = await Bun.file(args.path).text();
274
+ const contents = rewriteBunStringRawUnicode(source, args.path);
275
+ if (contents === source)
276
+ return;
277
+ return { contents, loader: getLoader(args.path) };
278
+ });
279
+ }
280
+ });
281
+
282
+ export { createIslandRegistryDefinitionPlugin, createBunStringRawUnicodePlugin };
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ // src/utils/normalizePath.ts
3
+ var normalizePath = (path) => path.replace(/\\/g, "/");
4
+
2
5
  // src/build/fileRoutes.ts
3
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
4
7
  import {
@@ -266,4 +269,4 @@ var syncFileRoutes = (config) => {
266
269
  return { ...scan, output: resolved.output, written };
267
270
  };
268
271
 
269
- export { ensureFileRouteModule };
272
+ export { normalizePath, scanFileRoutes, ensureFileRouteModule };
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // src/utils/isTestSourcePath.ts
3
+ var isTestSourcePath = (file) => {
4
+ const normalized = file.replace(/\\/g, "/");
5
+ return normalized.includes("/__tests__/") || /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(normalized);
6
+ };
7
+
8
+ export { isTestSourcePath };
@@ -25,32 +25,6 @@ var writePartialHoles = async (htmlPath, response) => {
25
25
 
26
26
  // src/core/prerenderNonce.ts
27
27
  import { rm as rm2 } from "fs/promises";
28
-
29
- // src/utils/logger.ts
30
- var colors = {
31
- blue: "\x1B[34m",
32
- bold: "\x1B[1m",
33
- cyan: "\x1B[36m",
34
- dim: "\x1B[2m",
35
- green: "\x1B[32m",
36
- magenta: "\x1B[35m",
37
- red: "\x1B[31m",
38
- reset: "\x1B[0m",
39
- white: "\x1B[37m",
40
- yellow: "\x1B[33m"
41
- };
42
- var frameworkColors = {
43
- angular: colors.magenta,
44
- assets: colors.dim,
45
- css: colors.cyan,
46
- html: colors.white,
47
- htmx: colors.white,
48
- react: colors.blue,
49
- svelte: colors.yellow,
50
- vue: colors.green
51
- };
52
-
53
- // src/core/prerenderNonce.ts
54
28
  var CSP_HEADERS = [
55
29
  "content-security-policy",
56
30
  "content-security-policy-report-only"
@@ -0,0 +1,16 @@
1
+ // @bun
2
+ // src/build/scanEntryPoints.ts
3
+ import { existsSync } from "fs";
4
+ var {Glob } = globalThis.Bun;
5
+ var scanEntryPoints = async (dir, pattern) => {
6
+ if (!existsSync(dir))
7
+ return [];
8
+ const entryPaths = [];
9
+ const glob = new Glob(pattern);
10
+ for await (const file of glob.scan({ absolute: true, cwd: dir })) {
11
+ entryPaths.push(file);
12
+ }
13
+ return entryPaths;
14
+ };
15
+
16
+ export { scanEntryPoints };
@@ -0,0 +1,39 @@
1
+ // @bun
2
+ import {
3
+ isDevelopmentRuntime
4
+ } from "./index-cba1cemz.js";
5
+ import {
6
+ formatTimestamp2
7
+ } from "./index-3ewt17wm.js";
8
+
9
+ // src/utils/logger.ts
10
+ var colors = {
11
+ blue: "\x1B[34m",
12
+ bold: "\x1B[1m",
13
+ cyan: "\x1B[36m",
14
+ dim: "\x1B[2m",
15
+ green: "\x1B[32m",
16
+ magenta: "\x1B[35m",
17
+ red: "\x1B[31m",
18
+ reset: "\x1B[0m",
19
+ white: "\x1B[37m",
20
+ yellow: "\x1B[33m"
21
+ };
22
+ var frameworkColors = {
23
+ angular: colors.magenta,
24
+ assets: colors.dim,
25
+ css: colors.cyan,
26
+ html: colors.white,
27
+ htmx: colors.white,
28
+ react: colors.blue,
29
+ svelte: colors.yellow,
30
+ vue: colors.green
31
+ };
32
+ var logTag = () => isDevelopmentRuntime() ? "[hmr]" : "[absolutejs]";
33
+ var logWarn = (message) => {
34
+ const timestamp = `${colors.dim}${formatTimestamp2()}${colors.reset}`;
35
+ const tag = `${colors.yellow}${logTag()}${colors.reset}`;
36
+ console.log(`${timestamp} ${tag} ${colors.yellow}warning ${message}${colors.reset}`);
37
+ };
38
+
39
+ export { logWarn };
@@ -0,0 +1,51 @@
1
+ // @bun
2
+ // src/build/scanConventions.ts
3
+ import { basename } from "path";
4
+ var {Glob } = globalThis.Bun;
5
+ import { existsSync } from "fs";
6
+ var CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
7
+ var classifyFile = (file, pageFiles, defaults, pages) => {
8
+ const fileName = basename(file);
9
+ const match = CONVENTION_RE.exec(fileName);
10
+ if (!match) {
11
+ pageFiles.push(file);
12
+ return;
13
+ }
14
+ const [, pageName, kind] = match;
15
+ if (!pageName) {
16
+ if (kind === "error")
17
+ defaults.error = file;
18
+ else if (kind === "loading")
19
+ defaults.loading = file;
20
+ else if (kind === "not-found")
21
+ defaults.notFound = file;
22
+ return;
23
+ }
24
+ if (!pages[pageName])
25
+ pages[pageName] = {};
26
+ if (kind === "error")
27
+ pages[pageName].error = file;
28
+ else if (kind === "loading")
29
+ pages[pageName].loading = file;
30
+ };
31
+ var scanConventions = async (pagesDir, pattern) => {
32
+ if (!existsSync(pagesDir)) {
33
+ const pageFiles = [];
34
+ return { conventions: undefined, pageFiles };
35
+ }
36
+ const pageFiles = [];
37
+ const defaults = {};
38
+ const pages = {};
39
+ const glob = new Glob(pattern);
40
+ for await (const file of glob.scan({ absolute: true, cwd: pagesDir })) {
41
+ classifyFile(file, pageFiles, defaults, pages);
42
+ }
43
+ const hasConventions = defaults.error !== undefined || defaults.loading !== undefined || defaults.notFound !== undefined || Object.keys(pages).length > 0;
44
+ const conventions = hasConventions ? {
45
+ ...defaults.error || defaults.loading || defaults.notFound ? { defaults } : {},
46
+ ...Object.keys(pages).length > 0 ? { pages } : {}
47
+ } : undefined;
48
+ return { conventions, pageFiles };
49
+ };
50
+
51
+ export { scanConventions };
@@ -2,11 +2,9 @@
2
2
  import {
3
3
  MILLISECONDS_IN_A_SECOND
4
4
  } from "./index-t8jmj8w1.js";
5
-
6
- // src/utils/startupTimings.ts
7
- var isTruthyFlag = (value) => value === "1" || value === "true";
8
- var devProfileEnabled = isTruthyFlag(process.env.ABSOLUTE_DEV_PROFILE);
9
- var startupTimingsEnabled = devProfileEnabled || isTruthyFlag(process.env.ABSOLUTE_STARTUP_TIMINGS);
5
+ import {
6
+ devProfileEnabled
7
+ } from "./index-va274tsf.js";
10
8
 
11
9
  // src/utils/bootTimeline.ts
12
10
  var ORIGIN_ENV = "ABSOLUTE_BOOT_ORIGIN_MS";
@@ -35,4 +33,4 @@ var markBootAt = (label, epochMs) => {
35
33
  };
36
34
  var processStartEpochMs = () => Date.now() - process.uptime() * MILLISECONDS_IN_A_SECOND;
37
35
 
38
- export { devProfileEnabled, bootTimelineChildEnv, markBoot };
36
+ export { bootTimelineChildEnv, markBoot };
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // src/utils/runtimeMode.ts
3
+ var ENV_VAR = "NODE_ENV";
4
+ var readEnv = () => typeof process === "undefined" ? undefined : process.env?.[ENV_VAR];
5
+ var getNodeEnv = () => readEnv();
6
+ var isDevelopmentRuntime = () => readEnv() === "development";
7
+
8
+ export { getNodeEnv, isDevelopmentRuntime };
@@ -1,10 +1,4 @@
1
1
  // @bun
2
- // src/utils/isTestSourcePath.ts
3
- var isTestSourcePath = (file) => {
4
- const normalized = file.replace(/\\/g, "/");
5
- return normalized.includes("/__tests__/") || /\.(?:test|spec)\.[cm]?[jt]sx?$/.test(normalized);
6
- };
7
-
8
2
  // src/build/workspacePackages.ts
9
3
  import { readFileSync, realpathSync } from "fs";
10
4
  import { join, sep } from "path";
@@ -51,4 +45,4 @@ var workspacePackageDirs = (projectRoot = process.cwd()) => {
51
45
  return [...dirs];
52
46
  };
53
47
 
54
- export { isTestSourcePath, isWorkspacePackageSpecifier, workspacePackageDirs };
48
+ export { isWorkspacePackageSpecifier, workspacePackageDirs };
@@ -0,0 +1,138 @@
1
+ // @bun
2
+ // src/svelte/staticAnalyzeSpaRoutes.ts
3
+ import { existsSync, promises as fs } from "fs";
4
+ import { join } from "path";
5
+ var DYNAMIC_SEGMENT_PATTERN = /^[:*]/;
6
+ var pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**");
7
+ var joinSegments = (parent, child) => {
8
+ if (!child)
9
+ return parent;
10
+ if (!parent)
11
+ return child;
12
+ return `${parent.replace(/\/+$/, "")}/${child.replace(/^\/+/, "")}`;
13
+ };
14
+ var readAttribute = (tag, name) => {
15
+ const re = new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\{?["']([^"']+)["']\\}?)`);
16
+ const match = re.exec(tag);
17
+ return match ? match[1] ?? match[2] ?? match[3] ?? null : null;
18
+ };
19
+ var findTagEnd = (source, from) => {
20
+ let depth = 0;
21
+ for (let index = from;index < source.length; index += 1) {
22
+ const char = source[index];
23
+ if (char === "{")
24
+ depth += 1;
25
+ if (char === "}")
26
+ depth -= 1;
27
+ if (char === ">" && depth <= 0)
28
+ return index;
29
+ }
30
+ return -1;
31
+ };
32
+ var findTags = (source, name) => {
33
+ const tags = [];
34
+ const opener = new RegExp(`<${name}\\b`, "g");
35
+ let match = opener.exec(source);
36
+ while (match !== null) {
37
+ const attrsStart = match.index + match[0].length;
38
+ const end = findTagEnd(source, attrsStart);
39
+ if (end === -1)
40
+ break;
41
+ tags.push({
42
+ attrs: source.slice(attrsStart, end).replace(/\/$/, ""),
43
+ end: end + 1,
44
+ start: match.index
45
+ });
46
+ opener.lastIndex = end + 1;
47
+ match = opener.exec(source);
48
+ }
49
+ return tags;
50
+ };
51
+ var findRouterBlock = (source) => {
52
+ const [openTag] = findTags(source, "Router");
53
+ if (!openTag)
54
+ return null;
55
+ const basepathRaw = readAttribute(openTag.attrs, "basepath");
56
+ const basepath = basepathRaw ?? "/";
57
+ const closeIndex = source.indexOf("</Router>", openTag.start);
58
+ if (closeIndex === -1)
59
+ return null;
60
+ const body = source.slice(openTag.end, closeIndex);
61
+ return { basepath, body };
62
+ };
63
+ var extractRoutesFromBody = (body) => {
64
+ const out = [];
65
+ for (const tag of findTags(body, "Route")) {
66
+ const path = readAttribute(tag.attrs, "path");
67
+ if (!path)
68
+ continue;
69
+ out.push({
70
+ dynamic: pathHasDynamic(path),
71
+ path,
72
+ redirected: false,
73
+ sitemapExcluded: false
74
+ });
75
+ }
76
+ return out;
77
+ };
78
+ var analyzeSvelteSpaRouteFile = async (filePath) => {
79
+ let source;
80
+ try {
81
+ source = await fs.readFile(filePath, "utf-8");
82
+ } catch {
83
+ return null;
84
+ }
85
+ if (!source.includes("<Router"))
86
+ return null;
87
+ const block = findRouterBlock(source);
88
+ if (!block)
89
+ return null;
90
+ const routes = extractRoutesFromBody(block.body);
91
+ if (routes.length === 0)
92
+ return null;
93
+ const baseHref = block.basepath.endsWith("/") ? block.basepath : `${block.basepath}/`;
94
+ const joinedRoutes = routes.map((r) => ({
95
+ ...r,
96
+ path: joinSegments("", r.path)
97
+ }));
98
+ return { baseHref, routes: joinedRoutes, sourceFile: filePath };
99
+ };
100
+ var walkSvelteFiles = async (dir, files) => {
101
+ let items;
102
+ try {
103
+ items = await fs.readdir(dir, { withFileTypes: true });
104
+ } catch {
105
+ return;
106
+ }
107
+ const directories = [];
108
+ for (const item of items) {
109
+ if (item.name === "node_modules" || item.name.startsWith("."))
110
+ continue;
111
+ const full = join(dir, item.name);
112
+ if (item.isDirectory()) {
113
+ directories.push(full);
114
+ } else if (item.isFile() && item.name.endsWith(".svelte")) {
115
+ files.push(full);
116
+ }
117
+ }
118
+ await Promise.all(directories.map((directory) => walkSvelteFiles(directory, files)));
119
+ };
120
+ var analyzeSvelteSpaRoutes2 = async (svelteDirectory) => {
121
+ if (!existsSync(svelteDirectory))
122
+ return [];
123
+ const files = [];
124
+ await walkSvelteFiles(svelteDirectory, files);
125
+ const hosts = [];
126
+ await Promise.all(files.map(async (file) => {
127
+ try {
128
+ const host = await analyzeSvelteSpaRouteFile(file);
129
+ if (host)
130
+ hosts.push(host);
131
+ } catch (err) {
132
+ console.warn(`[sitemap] Svelte SPA analysis failed for ${file}:`, err);
133
+ }
134
+ }));
135
+ return hosts;
136
+ };
137
+
138
+ export { analyzeSvelteSpaRoutes2 };
@@ -1,6 +1,7 @@
1
1
  // @bun
2
2
  // src/utils/stringModifiers.ts
3
3
  var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-");
4
+ var toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
5
  var toPascal = (str) => {
5
6
  if (!str.includes("-") && !str.includes("_")) {
6
7
  return str.charAt(0).toUpperCase() + str.slice(1);
@@ -8,4 +9,4 @@ var toPascal = (str) => {
8
9
  return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
9
10
  };
10
11
 
11
- export { toPascal };
12
+ export { toKebab, toPascal };